Skip to content

Commit d470523

Browse files
committed
* 'master' of https://github.com/Microsoft/vscode-python: Fixes #56 list all environments (#219) Fixes #57 Disable activation on debugging (#220) Fixes #26 Do not run linters when linters are disabled (#222)
2 parents acc2109 + 7b0838b commit d470523

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"Other"
4343
],
4444
"activationEvents": [
45-
"onDebug",
4645
"onLanguage:python",
4746
"onCommand:python.execInTerminal",
4847
"onCommand:python.sortImports",

src/client/common/utils.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,15 @@ export function getWindowsLineEndingCount(document: TextDocument, offset: Number
413413
}
414414

415415
export function arePathsSame(path1: string, path2: string) {
416-
path1 = IS_WINDOWS ? path1.replace(/\//g, "\\") : path1;
417-
path2 = IS_WINDOWS ? path2.replace(/\//g, "\\") : path2;
418-
return path1.toUpperCase() === path2.toUpperCase();
416+
path1 = path.normalize(path1);
417+
path2 = path.normalize(path2);
418+
if (IS_WINDOWS) {
419+
return path1.toUpperCase() === path2.toUpperCase();
420+
} else {
421+
return path1 === path2;
422+
}
419423
}
420424

421-
export function areBasePathsSame(path1: string, path2: string) {
422-
path1 = IS_WINDOWS ? path1.replace(/\//g, "\\") : path1;
423-
path2 = IS_WINDOWS ? path2.replace(/\//g, "\\") : path2;
424-
return path.dirname(path1).toUpperCase() === path.dirname(path2).toUpperCase();
425-
}
426425
export async function getInterpreterVersion(pythonPath: string) {
427426
return await new Promise<string>((resolve, reject) => {
428427
child_process.execFile(pythonPath, ['--version'], (error, stdout, stdErr) => {

src/client/interpreter/locators/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import * as _ from 'lodash';
33
import { Disposable, Uri, workspace } from 'vscode';
44
import { RegistryImplementation } from '../../common/registry';
5-
import { areBasePathsSame, arePathsSame, Is_64Bit, IS_WINDOWS } from '../../common/utils';
5+
import { arePathsSame, Is_64Bit, IS_WINDOWS } from '../../common/utils';
66
import { IInterpreterLocatorService, PythonInterpreter } from '../contracts';
7-
import { IInterpreterVersionService, InterpreterVersionService } from '../interpreterVersion';
7+
import { InterpreterVersionService } from '../interpreterVersion';
88
import { VirtualEnvironmentManager } from '../virtualEnvs';
99
import { fixInterpreterDisplayName, fixInterpreterPath } from './helpers';
1010
import { CondaEnvFileService, getEnvironmentsFile as getCondaEnvFile } from './services/condaEnvFileService';
@@ -46,16 +46,15 @@ export class PythonInterpreterLocatorService implements IInterpreterLocatorServi
4646
}
4747
private async getInterpretersPerResource(resource?: Uri) {
4848
const locators = this.getLocators(resource);
49-
const promises = locators.map(provider => provider.getInterpreters(resource));
49+
const promises = locators.map(async provider => provider.getInterpreters(resource));
5050
const listOfInterpreters = await Promise.all(promises);
5151

5252
// tslint:disable-next-line:underscore-consistent-invocation
5353
return _.flatten(listOfInterpreters)
5454
.map(fixInterpreterDisplayName)
5555
.map(fixInterpreterPath)
5656
.reduce<PythonInterpreter[]>((accumulator, current) => {
57-
if (accumulator.findIndex(item => arePathsSame(item.path, current.path)) === -1 &&
58-
accumulator.findIndex(item => areBasePathsSame(item.path, current.path)) === -1) {
57+
if (accumulator.findIndex(item => arePathsSame(item.path, current.path)) === -1) {
5958
accumulator.push(current);
6059
}
6160
return accumulator;

src/client/providers/lintProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ export class LintProvider implements vscode.Disposable {
160160
const workspaceRootPath = (workspaceFolder && typeof workspaceFolder.uri.fsPath === 'string') ? workspaceFolder.uri.fsPath : undefined;
161161
const relativeFileName = typeof workspaceRootPath === 'string' ? path.relative(workspaceRootPath, document.fileName) : document.fileName;
162162
const settings = PythonSettings.getInstance(document.uri);
163+
if (document.languageId !== PythonLanguage.language || !settings.linting.enabled) {
164+
return;
165+
}
163166
const ignoreMinmatches = settings.linting.ignorePatterns.map(pattern => {
164167
return new Minimatch(pattern);
165168
});

tslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"Thenable",
4343
"PromiseLike"
4444
],
45-
"completed-docs": false
45+
"completed-docs": false,
46+
"no-unsafe-any": false
4647
}
4748
}

0 commit comments

Comments
 (0)