Skip to content

Commit 255113f

Browse files
Mikhail Bulashkimadeline
authored andcommitted
Remove donjayamanne.jupyter integration (microsoft#7277)
1 parent ed8eb4b commit 255113f

File tree

6 files changed

+3
-145
lines changed

6 files changed

+3
-145
lines changed

news/3 Code Health/6052.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove `donjamayanne.jupyter` integration
2+
(thanks [Mikhail Bulash](https://github.com/mikeroll/))

src/client/common/constants.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,6 @@ export namespace Delays {
7878
export const MaxUnitTestCodeLensDelay = 5000;
7979
}
8080

81-
export namespace LinterErrors {
82-
export namespace pylint {
83-
export const InvalidSyntax = 'E0001';
84-
}
85-
export namespace prospector {
86-
export const InvalidSyntax = 'F999';
87-
}
88-
export namespace flake8 {
89-
export const InvalidSyntax = 'E999';
90-
}
91-
}
92-
9381
export const STANDARD_OUTPUT_CHANNEL = 'STANDARD_OUTPUT_CHANNEL';
9482

9583
export function isTestExecution(): boolean {

src/client/extension.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
DebugConfigurationProvider,
2525
Disposable,
2626
ExtensionContext,
27-
extensions,
2827
languages,
2928
Memento,
3029
OutputChannel,
@@ -88,7 +87,6 @@ import { IServiceContainer, IServiceManager } from './ioc/types';
8887
import { getLanguageConfiguration } from './language/languageConfiguration';
8988
import { LinterCommands } from './linters/linterCommands';
9089
import { registerTypes as lintersRegisterTypes } from './linters/serviceRegistry';
91-
import { ILintingEngine } from './linters/types';
9290
import { PythonCodeActionProvider } from './providers/codeActionsProvider';
9391
import { PythonFormattingEditProvider } from './providers/formatProvider';
9492
import { LinterProvider } from './providers/linterProvider';
@@ -157,10 +155,6 @@ async function activateUnsafe(context: ExtensionContext): Promise<IExtensionApi>
157155
interpreterManager.refresh(workspaceService.hasWorkspaceFolders ? workspaceService.workspaceFolders![0].uri : undefined)
158156
.catch(ex => traceError('Python Extension: interpreterManager.refresh', ex));
159157

160-
const jupyterExtension = extensions.getExtension('donjayamanne.jupyter');
161-
const lintingEngine = serviceManager.get<ILintingEngine>(ILintingEngine);
162-
lintingEngine.linkJupyterExtension(jupyterExtension).ignoreErrors();
163-
164158
// Activate debug location tracker
165159
serviceManager.get<IDebugLocationTrackerFactory>(IDebugLocationTrackerFactory);
166160

src/client/jupyter/provider.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/client/linters/lintingEngine.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import { Minimatch } from 'minimatch';
88
import * as path from 'path';
99
import * as vscode from 'vscode';
1010
import { IDocumentManager, IWorkspaceService } from '../common/application/types';
11-
import { LinterErrors, STANDARD_OUTPUT_CHANNEL } from '../common/constants';
11+
import { STANDARD_OUTPUT_CHANNEL } from '../common/constants';
1212
import { IFileSystem } from '../common/platform/types';
1313
import { IConfigurationService, IOutputChannel } from '../common/types';
1414
import { StopWatch } from '../common/utils/stopWatch';
1515
import { IServiceContainer } from '../ioc/types';
16-
import { JupyterProvider } from '../jupyter/provider';
1716
import { sendTelemetryWhenDone } from '../telemetry';
1817
import { EventName } from '../telemetry/constants';
1918
import { LinterTrigger, LintingTelemetry } from '../telemetry/types';
@@ -27,15 +26,8 @@ lintSeverityToVSSeverity.set(LintMessageSeverity.Hint, vscode.DiagnosticSeverity
2726
lintSeverityToVSSeverity.set(LintMessageSeverity.Information, vscode.DiagnosticSeverity.Information);
2827
lintSeverityToVSSeverity.set(LintMessageSeverity.Warning, vscode.DiagnosticSeverity.Warning);
2928

30-
// tslint:disable-next-line:interface-name
31-
interface DocumentHasJupyterCodeCells {
32-
// tslint:disable-next-line:callable-types
33-
(doc: vscode.TextDocument, token: vscode.CancellationToken): Promise<Boolean>;
34-
}
35-
3629
@injectable()
3730
export class LintingEngine implements ILintingEngine {
38-
private documentHasJupyterCodeCells: DocumentHasJupyterCodeCells;
3931
private workspace: IWorkspaceService;
4032
private documents: IDocumentManager;
4133
private configurationService: IConfigurationService;
@@ -46,7 +38,6 @@ export class LintingEngine implements ILintingEngine {
4638
private fileSystem: IFileSystem;
4739

4840
constructor(@inject(IServiceContainer) private serviceContainer: IServiceContainer) {
49-
this.documentHasJupyterCodeCells = (_a, _b) => Promise.resolve(false);
5041
this.documents = serviceContainer.get<IDocumentManager>(IDocumentManager);
5142
this.workspace = serviceContainer.get<IWorkspaceService>(IWorkspaceService);
5243
this.configurationService = serviceContainer.get<IConfigurationService>(IConfigurationService);
@@ -110,7 +101,6 @@ export class LintingEngine implements ILintingEngine {
110101
return promise;
111102
});
112103

113-
const hasJupyterCodeCells = await this.documentHasJupyterCodeCells(document, cancelToken.token);
114104
// linters will resolve asynchronously - keep a track of all
115105
// diagnostics reported as them come in.
116106
let diagnostics: vscode.Diagnostic[] = [];
@@ -125,13 +115,6 @@ export class LintingEngine implements ILintingEngine {
125115
if (this.isDocumentOpen(document.uri)) {
126116
// Build the message and suffix the message with the name of the linter used.
127117
for (const m of msgs) {
128-
// Ignore magic commands from jupyter.
129-
if (hasJupyterCodeCells && document.lineAt(m.line - 1).text.trim().startsWith('%') &&
130-
(m.code === LinterErrors.pylint.InvalidSyntax ||
131-
m.code === LinterErrors.prospector.InvalidSyntax ||
132-
m.code === LinterErrors.flake8.InvalidSyntax)) {
133-
continue;
134-
}
135118
diagnostics.push(this.createDiagnostics(m, document));
136119
}
137120
// Limit the number of messages to the max value.
@@ -142,20 +125,6 @@ export class LintingEngine implements ILintingEngine {
142125
this.diagnosticCollection.set(document.uri, diagnostics);
143126
}
144127

145-
// tslint:disable-next-line:no-any
146-
public async linkJupyterExtension(jupyter: vscode.Extension<any> | undefined): Promise<void> {
147-
if (!jupyter) {
148-
return;
149-
}
150-
if (!jupyter.isActive) {
151-
await jupyter.activate();
152-
}
153-
// tslint:disable-next-line:no-unsafe-any
154-
jupyter.exports.registerLanguageProvider(PYTHON.language, new JupyterProvider());
155-
// tslint:disable-next-line:no-unsafe-any
156-
this.documentHasJupyterCodeCells = jupyter.exports.hasCodeCells;
157-
}
158-
159128
private sendLinterRunTelemetry(info: ILinterInfo, resource: vscode.Uri, promise: Promise<ILintMessage[]>, stopWatch: StopWatch, trigger: LinterTrigger): void {
160129
const linterExecutablePathName = info.pathName(resource);
161130
const properties: LintingTelemetry = {

src/client/linters/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,5 @@ export interface ILintingEngine {
7171
readonly diagnostics: vscode.DiagnosticCollection;
7272
lintOpenPythonFiles(): Promise<vscode.DiagnosticCollection>;
7373
lintDocument(document: vscode.TextDocument, trigger: LinterTrigger): Promise<void>;
74-
// tslint:disable-next-line:no-any
75-
linkJupyterExtension(jupyter: vscode.Extension<any> | undefined): Promise<void>;
7674
clearDiagnostics(document: vscode.TextDocument): void;
7775
}

0 commit comments

Comments
 (0)