diff --git a/package.json b/package.json index 20ea9ddd16cc..053c5370522e 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "Other" ], "activationEvents": [ - "onDebug", "onLanguage:python", "onCommand:python.execInTerminal", "onCommand:python.sortImports", diff --git a/src/client/common/utils.ts b/src/client/common/utils.ts index 820c81b596da..ae6de92ee7b6 100644 --- a/src/client/common/utils.ts +++ b/src/client/common/utils.ts @@ -413,16 +413,15 @@ export function getWindowsLineEndingCount(document: TextDocument, offset: Number } export function arePathsSame(path1: string, path2: string) { - path1 = IS_WINDOWS ? path1.replace(/\//g, "\\") : path1; - path2 = IS_WINDOWS ? path2.replace(/\//g, "\\") : path2; - return path1.toUpperCase() === path2.toUpperCase(); + path1 = path.normalize(path1); + path2 = path.normalize(path2); + if (IS_WINDOWS) { + return path1.toUpperCase() === path2.toUpperCase(); + } else { + return path1 === path2; + } } -export function areBasePathsSame(path1: string, path2: string) { - path1 = IS_WINDOWS ? path1.replace(/\//g, "\\") : path1; - path2 = IS_WINDOWS ? path2.replace(/\//g, "\\") : path2; - return path.dirname(path1).toUpperCase() === path.dirname(path2).toUpperCase(); -} export async function getInterpreterVersion(pythonPath: string) { return await new Promise((resolve, reject) => { child_process.execFile(pythonPath, ['--version'], (error, stdout, stdErr) => { diff --git a/src/client/interpreter/locators/index.ts b/src/client/interpreter/locators/index.ts index 09ab1c21bc18..198c37f25869 100644 --- a/src/client/interpreter/locators/index.ts +++ b/src/client/interpreter/locators/index.ts @@ -2,9 +2,9 @@ import * as _ from 'lodash'; import { Disposable, Uri, workspace } from 'vscode'; import { RegistryImplementation } from '../../common/registry'; -import { areBasePathsSame, arePathsSame, Is_64Bit, IS_WINDOWS } from '../../common/utils'; +import { arePathsSame, Is_64Bit, IS_WINDOWS } from '../../common/utils'; import { IInterpreterLocatorService, PythonInterpreter } from '../contracts'; -import { IInterpreterVersionService, InterpreterVersionService } from '../interpreterVersion'; +import { InterpreterVersionService } from '../interpreterVersion'; import { VirtualEnvironmentManager } from '../virtualEnvs'; import { fixInterpreterDisplayName, fixInterpreterPath } from './helpers'; import { CondaEnvFileService, getEnvironmentsFile as getCondaEnvFile } from './services/condaEnvFileService'; @@ -46,7 +46,7 @@ export class PythonInterpreterLocatorService implements IInterpreterLocatorServi } private async getInterpretersPerResource(resource?: Uri) { const locators = this.getLocators(resource); - const promises = locators.map(provider => provider.getInterpreters(resource)); + const promises = locators.map(async provider => provider.getInterpreters(resource)); const listOfInterpreters = await Promise.all(promises); // tslint:disable-next-line:underscore-consistent-invocation @@ -54,8 +54,7 @@ export class PythonInterpreterLocatorService implements IInterpreterLocatorServi .map(fixInterpreterDisplayName) .map(fixInterpreterPath) .reduce((accumulator, current) => { - if (accumulator.findIndex(item => arePathsSame(item.path, current.path)) === -1 && - accumulator.findIndex(item => areBasePathsSame(item.path, current.path)) === -1) { + if (accumulator.findIndex(item => arePathsSame(item.path, current.path)) === -1) { accumulator.push(current); } return accumulator; diff --git a/src/client/providers/lintProvider.ts b/src/client/providers/lintProvider.ts index b734800bfa83..9e6e81c6b2f3 100644 --- a/src/client/providers/lintProvider.ts +++ b/src/client/providers/lintProvider.ts @@ -160,6 +160,9 @@ export class LintProvider implements vscode.Disposable { const workspaceRootPath = (workspaceFolder && typeof workspaceFolder.uri.fsPath === 'string') ? workspaceFolder.uri.fsPath : undefined; const relativeFileName = typeof workspaceRootPath === 'string' ? path.relative(workspaceRootPath, document.fileName) : document.fileName; const settings = PythonSettings.getInstance(document.uri); + if (document.languageId !== PythonLanguage.language || !settings.linting.enabled) { + return; + } const ignoreMinmatches = settings.linting.ignorePatterns.map(pattern => { return new Minimatch(pattern); }); diff --git a/tslint.json b/tslint.json index 7ff727e68b34..9acc3a190ee9 100644 --- a/tslint.json +++ b/tslint.json @@ -42,6 +42,7 @@ "Thenable", "PromiseLike" ], - "completed-docs": false + "completed-docs": false, + "no-unsafe-any": false } }