Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/ci/templates/build_compile_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ steps:
targets: "prePublishNonBundle"
condition: and(succeeded(), eq(variables['build'], 'false'))

- bash: npx tslint ./src/**/*.ts{,x}
- bash: npx tslint --project tsconfig.json
displayName: "code hygiene"
condition: and(succeeded(), eq(variables['build'], 'false'))

Expand Down
2 changes: 1 addition & 1 deletion src/client/activation/serviceRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { LanguageServerPackageService } from './languageServer/languageServerPac
import { LanguageServerManager } from './languageServer/manager';
import { LanguageServerOutputChannel } from './languageServer/outputChannel';
import { PlatformData } from './languageServer/platformData';
import { IDownloadChannelRule, IExtensionActivationManager, IExtensionActivationService, IExtensionSingleActivationService, ILanguageClientFactory, ILanguageServer, ILanguageServerActivator, ILanguageServerAnalysisOptions, ILanguageServerCompatibilityService as ILanagueServerCompatibilityService, ILanguageServerDownloader, ILanguageServerExtension, ILanguageServerFolderService, ILanguageServerManager, ILanguageServerPackageService, IPlatformData, LanguageClientFactory, LanguageServerActivator, ILanguageServerOutputChannel } from './types';
import { IDownloadChannelRule, IExtensionActivationManager, IExtensionActivationService, IExtensionSingleActivationService, ILanguageClientFactory, ILanguageServer, ILanguageServerActivator, ILanguageServerAnalysisOptions, ILanguageServerCompatibilityService as ILanagueServerCompatibilityService, ILanguageServerDownloader, ILanguageServerExtension, ILanguageServerFolderService, ILanguageServerManager, ILanguageServerOutputChannel, ILanguageServerPackageService, IPlatformData, LanguageClientFactory, LanguageServerActivator } from './types';

export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<IExtensionActivationService>(IExtensionActivationService, LanguageServerExtensionActivationService);
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
MessageItem,
MessageOptions,
OpenDialogOptions,
OutputChannel,
Progress,
ProgressOptions,
QuickPick,
Expand Down Expand Up @@ -51,8 +52,7 @@ import {
WorkspaceEdit,
WorkspaceFolder,
WorkspaceFolderPickOptions,
WorkspaceFoldersChangeEvent,
OutputChannel
WorkspaceFoldersChangeEvent
} from 'vscode';
import * as vsls from 'vsls/vscode';

Expand Down
1 change: 1 addition & 0 deletions src/client/common/featureDeprecationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class FeatureDeprecationManager implements IFeatureDeprecationManager {

if (notify) {
this.notifyDeprecation(deprecatedInfo)
// tslint:disable-next-line: no-console
.catch(ex => console.error('Python Extension: notifyDeprecation', ex));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/client/common/net/socket/socketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class SocketServer extends EventEmitter implements ISocketServer {
const port = typeof options.port === 'number' ? options.port! : 0;
const host = typeof options.host === 'string' ? options.host! : 'localhost';
this.socketServer!.on('error', ex => {
// tslint:disable-next-line: no-console
console.error('Error in Socket Server', ex);
const msg = `Failed to start the socket server. (Error: ${ex.message})`;

Expand Down
1 change: 1 addition & 0 deletions src/client/common/utils/multiStepInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface IQuickPickParameters<T extends QuickPickItem> {
shouldResume?(): Promise<boolean>;
}

// tslint:disable-next-line: interface-name
export interface InputBoxParameters {
title: string;
step?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList
return fullCommandList;
}

// tslint:disable-next-line: max-func-body-length
private createCodeLens(document: TextDocument, cellRange: { range: Range; cell_type: string }, commandName: string, isFirst: boolean): CodeLens | undefined {
// We only support specific commands
// Be careful here. These arguments will be serialized during liveshare sessions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ export class InteractiveWindow extends WebViewHost<IInteractiveWindowMapping> im
}
}

// tslint:disable-next-line: max-func-body-length
private async submitCode(code: string, file: string, line: number, id?: string, _editor?: TextEditor, debug?: boolean): Promise<boolean> {
let result = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ export class DebugStreamProvider implements IDebugStreamProvider {
// start as a server, and print to console in VS Code debugger for extension developer.
// Do not print this out when running unit tests.
if (!isTestExecution()) {
// tslint:disable-next-line: no-console
console.error(`waiting for debug protocol on port ${debugPort}`);
}
this.server = createServer((socket) => {
if (!isTestExecution()) {
// tslint:disable-next-line: no-console
console.error('>> accepted connection from client');
}
resolve(socket);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class LocalDebugClient extends DebugClient<LaunchRequestArguments> {
// Only once connected do we know that the application has successfully launched.
this.debugServer!.DebugClientConnected
.then(resolve)
// tslint:disable-next-line: no-console
.catch(ex => console.error('Python Extension: debugServer.DebugClientConnected', ex));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat
name: DebugConfigStrings.pyramid.snippet.name(),
type: DebuggerTypeName,
request: 'launch',
module: "pyramid.scripts.pserve",
module: 'pyramid.scripts.pserve',
args: [
iniPath || defaultIni
],
Expand Down
1 change: 0 additions & 1 deletion src/client/debugger/extension/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { CancellationToken, DebugConfiguration, WorkspaceFolder } from 'vscode';
import { DebugConfigurationType, IDebugConfigurationProvider } from '../types';


export const IDebugConfigurationResolver = Symbol('IDebugConfigurationResolver');
export interface IDebugConfigurationResolver<T extends DebugConfiguration> {
resolveDebugConfiguration(folder: WorkspaceFolder | undefined, debugConfiguration: T, token?: CancellationToken): Promise<T | undefined>;
Expand Down
3 changes: 2 additions & 1 deletion src/client/formatters/baseFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IApplicationShell, IWorkspaceService } from '../common/application/type
import { STANDARD_OUTPUT_CHANNEL } from '../common/constants';
import '../common/extensions';
import { isNotInstalledError } from '../common/helpers';
import { traceError } from '../common/logger';
import { IPythonToolExecutionService } from '../common/process/types';
import { IDisposableRegistry, IInstaller, IOutputChannel, Product } from '../common/types';
import { IServiceContainer } from '../ioc/types';
Expand Down Expand Up @@ -93,7 +94,7 @@ export abstract class BaseFormatter {
const isInstalled = await installer.isInstalled(this.product, resource);
if (!isInstalled) {
customError += `\nYou could either install the '${this.Id}' formatter, turn it off or use another formatter.`;
installer.promptToInstall(this.product, resource).catch(ex => console.error('Python Extension: promptToInstall', ex));
installer.promptToInstall(this.product, resource).catch(ex => traceError('Python Extension: promptToInstall', ex));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { inject, injectable } from 'inversify';
import * as path from 'path';
import { ConfigurationTarget, Uri, window } from 'vscode';
import { traceError } from '../../common/logger';
import { InterpreterInfomation, IPythonExecutionFactory } from '../../common/process/types';
import { StopWatch } from '../../common/utils/stopWatch';
import { IServiceContainer } from '../../ioc/types';
Expand Down Expand Up @@ -31,11 +32,11 @@ export class PythonPathUpdaterService implements IPythonPathUpdaterServiceManage
// tslint:disable-next-line:no-unsafe-any prefer-type-cast
const message = reason && typeof reason.message === 'string' ? reason.message as string : '';
window.showErrorMessage(`Failed to set 'pythonPath'. Error: ${message}`);
console.error(reason);
traceError(reason);
}
// do not wait for this to complete
this.sendTelemetry(stopWatch.elapsedTime, failed, trigger, pythonPath)
.catch(ex => console.error('Python Extension: sendTelemetry', ex));
.catch(ex => traceError('Python Extension: sendTelemetry', ex));
}
private async sendTelemetry(duration: number, failed: boolean, trigger: 'ui' | 'shebang' | 'load', pythonPath: string) {
const telemtryProperties: PythonInterpreterTelemetry = {
Expand Down
1 change: 1 addition & 0 deletions src/client/interpreter/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export interface IInterpreterWatcherBuilder {
}

export const InterpreterLocatorProgressHandler = Symbol('InterpreterLocatorProgressHandler');
// tslint:disable-next-line: interface-name
export interface InterpreterLocatorProgressHandler {
register(): void;
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/interpreter/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { inject, injectable } from 'inversify';
import { compare } from 'semver';
import { ConfigurationTarget } from 'vscode';
import { IDocumentManager, IWorkspaceService } from '../common/application/types';
import { traceError } from '../common/logger';
import { IFileSystem } from '../common/platform/types';
import { InterpreterInfomation, IPythonExecutionFactory } from '../common/process/types';
import { IPersistentStateFactory, Resource } from '../common/types';
Expand Down Expand Up @@ -72,7 +73,7 @@ export class InterpreterHelper implements IInterpreterHelper {
await store.updateValue(details);
return details;
} catch (ex) {
console.error(`Failed to get interpreter information for '${pythonPath}'`, ex);
traceError(`Failed to get interpreter information for '${pythonPath}'`, ex);
return;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/interpreter/interpreterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from 'path';
import { Disposable, Event, EventEmitter, Uri } from 'vscode';
import '../../client/common/extensions';
import { IDocumentManager, IWorkspaceService } from '../common/application/types';
import { traceError } from '../common/logger';
import { getArchitectureDisplayName } from '../common/platform/registry';
import { IFileSystem } from '../common/platform/types';
import { IPythonExecutionFactory } from '../common/process/types';
Expand Down Expand Up @@ -258,7 +259,7 @@ export class InterpreterService implements Disposable, IInterpreterService {
this.didChangeInterpreterEmitter.fire();
const interpreterDisplay = this.serviceContainer.get<IInterpreterDisplay>(IInterpreterDisplay);
interpreterDisplay.refresh()
.catch(ex => console.error('Python Extension: display.refresh', ex));
.catch(ex => traceError('Python Extension: display.refresh', ex));
}
}
private async collectInterpreterDetails(pythonPath: string, resource: Uri | undefined) {
Expand Down
3 changes: 2 additions & 1 deletion src/client/interpreter/locators/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { inject, injectable } from 'inversify';
import * as path from 'path';
import { traceError } from '../../common/logger';
import { IS_WINDOWS } from '../../common/platform/constants';
import { IFileSystem } from '../../common/platform/types';
import { fsReaddirAsync } from '../../common/utils/fs';
Expand All @@ -12,7 +13,7 @@ export function lookForInterpretersInDirectory(pathToCheck: string): Promise<str
return fsReaddirAsync(pathToCheck)
.then(subDirs => subDirs.filter(fileName => CheckPythonInterpreterRegEx.test(path.basename(fileName))))
.catch(err => {
console.error('Python Extension (lookForInterpretersInDirectory.fsReaddirAsync):', err);
traceError('Python Extension (lookForInterpretersInDirectory.fsReaddirAsync):', err);
return [] as string[];
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class BaseVirtualEnvService extends CacheableLocatorService {
return scriptOrBinDirs.length === 1 ? scriptOrBinDirs[0] : '';
})
.catch((err) => {
console.error('Python Extension (getProspectiveDirectoriesForLookup):', err);
traceError('Python Extension (getProspectiveDirectoriesForLookup):', err);
// Ignore exceptions.
return '';
}));
Expand Down
12 changes: 6 additions & 6 deletions src/client/providers/jediProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { IInterpreterService } from '../interpreter/contracts';
import { IServiceContainer } from '../ioc/types';
import { sendTelemetryEvent } from '../telemetry';
import { EventName } from '../telemetry/constants';
import { Logger } from './../common/logger';
import { Logger, traceError } from './../common/logger';

const pythonVSCodeTypeMappings = new Map<string, CompletionItemKind>();
pythonVSCodeTypeMappings.set('none', CompletionItemKind.Value);
Expand Down Expand Up @@ -212,7 +212,7 @@ export class JediProxy implements Disposable {
this.commands.set(executionCmd.id, executionCmd);
this.commandQueue.push(executionCmd.id);
} catch (ex) {
console.error(ex);
traceError(ex);
//If 'This socket is closed.' that means process didn't start at all (at least not properly).
if (ex.message === 'This socket is closed.') {
this.killProcess();
Expand Down Expand Up @@ -278,7 +278,7 @@ export class JediProxy implements Disposable {
this.pidUsageFailures.counter = 0;
this.pidUsageFailures.timer.reset();
}
console.error('Python Extension: (pidusage)', err);
traceError('Python Extension: (pidusage)', err);
} else {
const limit = Math.min(Math.max(this.pythonSettings.jediMemoryLimit, 1024), 8192);
let restartJedi = false;
Expand Down Expand Up @@ -690,7 +690,7 @@ export class JediProxy implements Disposable {
const filePaths = await Promise.all(filePathPromises);
return filePaths.concat(...pythonPaths, ...resolvedPaths).filter(p => p.length > 0);
} catch (ex) {
console.error('Python Extension: jediProxy.filePaths', ex);
traceError('Python Extension: jediProxy.filePaths', ex);
return [];
}
}
Expand Down Expand Up @@ -872,7 +872,7 @@ export class JediProxyHandler<R extends ICommandResult> implements Disposable {
executionCmd.token = cancellation.token;

return this.jediProxy.sendCommand<R>(executionCmd).catch(reason => {
console.error(reason);
traceError(reason);
return undefined;
});
}
Expand All @@ -885,7 +885,7 @@ export class JediProxyHandler<R extends ICommandResult> implements Disposable {
}

return this.jediProxy.sendCommand<R>(executionCmd).catch(reason => {
console.error(reason);
traceError(reason);
return undefined;
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/providers/renameProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from 'vscode';
import { EXTENSION_ROOT_DIR, STANDARD_OUTPUT_CHANNEL } from '../common/constants';
import { getWorkspaceEditsFromPatch } from '../common/editor';
import { traceError } from '../common/logger';
import { IConfigurationService, IInstaller, IOutputChannel, Product } from '../common/types';
import { IServiceContainer } from '../ioc/types';
import { RefactorProxy } from '../refactor/proxy';
Expand Down Expand Up @@ -61,7 +62,7 @@ export class PythonRenameProvider implements RenameProvider {
if (reason === 'Not installed') {
const installer = this.serviceContainer.get<IInstaller>(IInstaller);
installer.promptToInstall(Product.rope, document.uri)
.catch(ex => console.error('Python Extension: promptToInstall', ex));
.catch(ex => traceError('Python Extension: promptToInstall', ex));
return Promise.reject('');
} else {
window.showErrorMessage(reason);
Expand Down
3 changes: 2 additions & 1 deletion src/client/providers/simpleRefactorProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import { Commands } from '../common/constants';
import { getTextEditsFromPatch } from '../common/editor';
import { traceError } from '../common/logger';
import { IConfigurationService, IInstaller, Product } from '../common/types';
import { StopWatch } from '../common/utils/stopWatch';
import { IServiceContainer } from '../ioc/types';
Expand Down Expand Up @@ -150,7 +151,7 @@ function extractName(textEditor: vscode.TextEditor, newName: string,
}).catch(error => {
if (error === 'Not installed') {
installer.promptToInstall(Product.rope, textEditor.document.uri)
.catch(ex => console.error('Python Extension: simpleRefactorProvider.promptToInstall', ex));
.catch(ex => traceError('Python Extension: simpleRefactorProvider.promptToInstall', ex));
return Promise.reject('');
}
let errorMessage = `${error}`;
Expand Down
3 changes: 2 additions & 1 deletion src/client/providers/updateSparkLibraryProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import * as path from 'path';
import * as vscode from 'vscode';
import { Commands } from '../common/constants';
import { traceError } from '../common/logger';
import { sendTelemetryEvent } from '../telemetry';
import { EventName } from '../telemetry/constants';

Expand All @@ -19,7 +20,7 @@ function updateSparkLibrary() {
//Done
}, reason => {
vscode.window.showErrorMessage(`Failed to update ${extraLibPath}. Error: ${reason.message}`);
console.error(reason);
traceError(reason);
});
vscode.window.showInformationMessage('Make sure you have SPARK_HOME environment variable set to the root path of the local spark installation!');
sendTelemetryEvent(EventName.UPDATE_PYSPARK_LIBRARY);
Expand Down
3 changes: 2 additions & 1 deletion src/client/refactor/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ChildProcess } from 'child_process';
import * as path from 'path';
import { Disposable, Position, Range, TextDocument, TextEditorOptions, Uri, window } from 'vscode';
import '../common/extensions';
import { traceError } from '../common/logger';
import { IS_WINDOWS } from '../common/platform/constants';
import { IPythonExecutionFactory } from '../common/process/types';
import { IPythonSettings } from '../common/types';
Expand Down Expand Up @@ -136,7 +137,7 @@ export class RefactorProxy extends Disposable {
errorResponse = dataStr.split(/\r?\n/g).filter(line => line.length > 0).map(resp => JSON.parse(resp));
this._previousStdErrData = '';
} catch (ex) {
console.error(ex);
traceError(ex);
// Possible we've only received part of the data, hence don't clear previousData
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/terminals/codeExecution/codeExecutionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { Disposable, Event, EventEmitter, Uri } from 'vscode';
import { ICommandManager, IDocumentManager } from '../../common/application/types';
import { Commands } from '../../common/constants';
import '../../common/extensions';
import { traceError } from '../../common/logger';
import { IFileSystem } from '../../common/platform/types';
import { BANNER_NAME_INTERACTIVE_SHIFTENTER, IDisposableRegistry, IPythonExtensionBanner, Resource } from '../../common/types';
import { noop } from '../../common/utils/misc';
import { IServiceContainer } from '../../ioc/types';
import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
import { EventName } from '../../telemetry/constants';
import { ICodeExecutionHelper, ICodeExecutionManager, ICodeExecutionService } from '../../terminals/types';
import { traceError } from '../../common/logger';

@injectable()
export class CodeExecutionManager implements ICodeExecutionManager {
Expand Down
Loading