Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve interpreter selection on different platforms #517

Merged
merged 55 commits into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
7675901
Basic tokenizer
Dec 1, 2017
eb42669
Fixed property names
Dec 1, 2017
2756974
Tests, round I
Dec 1, 2017
c2c1ced
Tests, round II
Dec 2, 2017
a108c96
merge master
Dec 3, 2017
14864a5
tokenizer test
Dec 4, 2017
0ed51d6
Remove temorary change
Dec 4, 2017
51b544c
Fix merge issue
Dec 4, 2017
3cd11e6
Merge conflict
Dec 4, 2017
82e0ad1
Merge conflict
Dec 4, 2017
9295c1a
Completion test
Dec 4, 2017
06eb1a5
Fix last line
Dec 4, 2017
e9db8e0
Fix javascript math
Dec 4, 2017
d12ca03
Merge master
Dec 5, 2017
d8ab041
Make test await for results
Dec 5, 2017
db75cd0
Add license headers
Dec 5, 2017
9ab2c47
Rename definitions to types
Dec 5, 2017
d587485
License headers
Dec 5, 2017
1da5e0a
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 5, 2017
7668cee
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 11, 2017
1ac4932
Fix typo in completion details (typo)
Dec 11, 2017
2aa5a6c
Fix hover test
Dec 12, 2017
5db31bd
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 12, 2017
560d2af
Russian translations
Dec 13, 2017
c71024d
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 13, 2017
31aa087
Update to better translation
Dec 13, 2017
593ae05
Fix typo
Dec 13, 2017
e6d69bb
#70 How to get all parameter info when filling in a function param list
Dec 13, 2017
b5a23d3
Fix #70 How to get all parameter info when filling in a function para…
Dec 14, 2017
cd200f7
Clean up
Dec 14, 2017
7c33228
Clean imports
Dec 14, 2017
c4a6b90
CR feedback
Dec 14, 2017
f85b848
Trim whitespace for test stability
Dec 14, 2017
37c210b
More tests
Dec 15, 2017
61a5650
Better handle no-parameters documentation
Dec 15, 2017
a10305e
Better handle ellipsis and Python3
Dec 15, 2017
bfcae78
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 15, 2017
42a5f79
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 18, 2017
699c434
Basic services
Dec 20, 2017
dd9ba0a
Install check
Dec 21, 2017
443ad65
Output installer messages
Dec 21, 2017
fdde6b8
Warn default Mac OS interpreter
Dec 23, 2017
e8ea50a
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
Jan 2, 2018
8b7c920
Remove test change
Jan 2, 2018
253df9e
Add tests
Jan 2, 2018
97ed0a8
PR feedback
Jan 2, 2018
dcfc939
CR feedback
Jan 3, 2018
34790bb
Mock process instead
Jan 3, 2018
b6caacc
Fix Brew detection
Jan 3, 2018
bb648d7
Update test
Jan 3, 2018
d223410
Add check suppression option & suppress vor VE by default
Jan 3, 2018
6a92e60
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
Jan 3, 2018
6873309
Fix most linter tests
Jan 3, 2018
9bd8948
Merge conflict
Jan 3, 2018
11c3272
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
Jan 3, 2018
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
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,12 @@
},
"scope": "resource"
},
"python.disableInstallationCheck": {
"type": "boolean",
"default": false,
"description": "Whether to check if Python is installed.",
"scope": "resource"
},
"python.linting.enabled": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -1537,6 +1543,7 @@
"lodash": "^4.17.4",
"minimatch": "^3.0.3",
"named-js-regexp": "^1.3.1",
"opn": "^5.1.0",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.5.2",
"semver": "^5.4.1",
Expand Down Expand Up @@ -1600,6 +1607,7 @@
"tslint": "^5.7.0",
"tslint-eslint-rules": "^4.1.1",
"tslint-microsoft-contrib": "^5.0.1",
"typemoq": "^2.1.0",
"typescript": "^2.6.2",
"typescript-formatter": "^6.0.0",
"vscode": "^1.1.5",
Expand Down
60 changes: 60 additions & 0 deletions src/client/common/application/applicationShell.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';

// tslint:disable-next-line:no-require-imports no-var-requires
const opn = require('opn');

import { injectable } from 'inversify';
import * as vscode from 'vscode';
import { IApplicationShell } from './types';

@injectable()
export class ApplicationShell implements IApplicationShell {
public showInformationMessage(message: string, ...items: string[]): Thenable<string> ;
public showInformationMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string> ;
public showInformationMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T> ;
public showInformationMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T> ;
// tslint:disable-next-line:no-any
public showInformationMessage(message: string, options?: any, ...items: any[]): Thenable<any> {
return vscode.window.showInformationMessage(message, options, ...items);
}

public showWarningMessage(message: string, ...items: string[]): Thenable<string>;
public showWarningMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string>;
public showWarningMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T>;
public showWarningMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T>;
// tslint:disable-next-line:no-any
public showWarningMessage(message: any, options?: any, ...items: any[]) {
return vscode.window.showWarningMessage(message, options, ...items);
}

public showErrorMessage(message: string, ...items: string[]): Thenable<string>;
public showErrorMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string>;
public showErrorMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T>;
public showErrorMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T>;
// tslint:disable-next-line:no-any
public showErrorMessage(message: any, options?: any, ...items: any[]) {
return vscode.window.showErrorMessage(message, options, ...items);
}

public showQuickPick(items: string[] | Thenable<string[]>, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): Thenable<string>;
public showQuickPick<T extends vscode.QuickPickItem>(items: T[] | Thenable<T[]>, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): Thenable<T>;
// tslint:disable-next-line:no-any
public showQuickPick(items: any, options?: any, token?: any) {
return vscode.window.showQuickPick(items, options, token);
}

public showOpenDialog(options: vscode.OpenDialogOptions): Thenable<vscode.Uri[]> {
return vscode.window.showOpenDialog(options);
}
public showSaveDialog(options: vscode.SaveDialogOptions): Thenable<vscode.Uri> {
return vscode.window.showSaveDialog(options);
}
public showInputBox(options?: vscode.InputBoxOptions, token?: vscode.CancellationToken): Thenable<string> {
return vscode.window.showInputBox(options, token);
}
public openUrl(url: string): void {
opn(url);
}
}
194 changes: 194 additions & 0 deletions src/client/common/application/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';

import * as vscode from 'vscode';

export const IApplicationShell = Symbol('IApplicationShell');
export interface IApplicationShell {
showInformationMessage(message: string, ...items: string[]): Thenable<string | undefined>;

/**
* Show an information message to users. Optionally provide an array of items which will be presented as
* clickable buttons.
*
* @param message The message to show.
* @param options Configures the behaviour of the message.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showInformationMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined>;

/**
* Show an information message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showInformationMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;

/**
* Show an information message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param options Configures the behaviour of the message.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showInformationMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T | undefined>;

/**
* Show a warning message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showWarningMessage(message: string, ...items: string[]): Thenable<string | undefined>;

/**
* Show a warning message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param options Configures the behaviour of the message.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showWarningMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined>;

/**
* Show a warning message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showWarningMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;

/**
* Show a warning message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param options Configures the behaviour of the message.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showWarningMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T | undefined>;

/**
* Show an error message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showErrorMessage(message: string, ...items: string[]): Thenable<string | undefined>;

/**
* Show an error message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param options Configures the behaviour of the message.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showErrorMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined>;

/**
* Show an error message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showErrorMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;

/**
* Show an error message.
*
* @see [showInformationMessage](#window.showInformationMessage)
*
* @param message The message to show.
* @param options Configures the behaviour of the message.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
showErrorMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T | undefined>;

/**
* Shows a selection list.
*
* @param items An array of strings, or a promise that resolves to an array of strings.
* @param options Configures the behavior of the selection list.
* @param token A token that can be used to signal cancellation.
* @return A promise that resolves to the selection or `undefined`.
*/
showQuickPick(items: string[] | Thenable<string[]>, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): Thenable<string | undefined>;

/**
* Shows a selection list.
*
* @param items An array of items, or a promise that resolves to an array of items.
* @param options Configures the behavior of the selection list.
* @param token A token that can be used to signal cancellation.
* @return A promise that resolves to the selected item or `undefined`.
*/
showQuickPick<T extends vscode.QuickPickItem>(items: T[] | Thenable<T[]>, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): Thenable<T | undefined>;

/**
* Shows a file open dialog to the user which allows to select a file
* for opening-purposes.
*
* @param options Options that control the dialog.
* @returns A promise that resolves to the selected resources or `undefined`.
*/
showOpenDialog(options: vscode.OpenDialogOptions): Thenable<vscode.Uri[] | undefined>;

/**
* Shows a file save dialog to the user which allows to select a file
* for saving-purposes.
*
* @param options Options that control the dialog.
* @returns A promise that resolves to the selected resource or `undefined`.
*/
showSaveDialog(options: vscode.SaveDialogOptions): Thenable<vscode.Uri | undefined>;

/**
* Opens an input box to ask the user for input.
*
* The returned value will be `undefined` if the input box was canceled (e.g. pressing ESC). Otherwise the
* returned value will be the string typed by the user or an empty string if the user did not type
* anything but dismissed the input box with OK.
*
* @param options Configures the behavior of the input box.
* @param token A token that can be used to signal cancellation.
* @return A promise that resolves to a string the user provided or to `undefined` in case of dismissal.
*/
showInputBox(options?: vscode.InputBoxOptions, token?: vscode.CancellationToken): Thenable<string | undefined>;

/**
* Opens URL in a default browser.
*
* @param url Url to open.
*/
openUrl(url: string): void;
}
3 changes: 3 additions & 0 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface IPythonSettings {
workspaceSymbols: IWorkspaceSymbolSettings;
envFile: string;
disablePromptForFeatures: string[];
disableInstallationChecks: boolean;
}
export interface ISortImportSettings {
path: string;
Expand Down Expand Up @@ -145,6 +146,7 @@ export class PythonSettings extends EventEmitter implements IPythonSettings {
public terminal: ITerminalSettings;
public sortImports: ISortImportSettings;
public workspaceSymbols: IWorkspaceSymbolSettings;
public disableInstallationChecks: boolean;

private workspaceRoot: vscode.Uri;
private disposables: vscode.Disposable[] = [];
Expand Down Expand Up @@ -222,6 +224,7 @@ export class PythonSettings extends EventEmitter implements IPythonSettings {
} else {
this.linting = lintingSettings;
}
this.disableInstallationChecks = pythonSettings.get<boolean>('disableInstallationCheck') === true;
// tslint:disable-next-line:no-backbone-get-set-outside-model no-non-null-assertion
const sortImportSettings = systemVariables.resolveAny(pythonSettings.get<ISortImportSettings>('sortImports'))!;
if (this.sortImports) {
Expand Down
6 changes: 3 additions & 3 deletions src/client/common/installer/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ILinterHelper } from '../../linters/types';
import { ITestsHelper } from '../../unittests/common/types';
import { PythonSettings } from '../configSettings';
import { STANDARD_OUTPUT_CHANNEL } from '../constants';
import { IPlatformService } from '../platform/types';
import { IProcessService, IPythonExecutionFactory } from '../process/types';
import { ITerminalService } from '../terminal/types';
import { IInstaller, ILogger, InstallerResponse, IOutputChannel, IsWindows, ModuleNamePurpose, Product } from '../types';
Expand Down Expand Up @@ -82,8 +83,7 @@ ProductTypes.set(Product.rope, ProductType.RefactoringLibrary);
@injectable()
export class Installer implements IInstaller {
constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer,
@inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private outputChannel: vscode.OutputChannel,
@inject(IsWindows) private isWindows: boolean) {
@inject(IOutputChannel) @named(STANDARD_OUTPUT_CHANNEL) private outputChannel: vscode.OutputChannel) {
}
// tslint:disable-next-line:no-empty
public dispose() { }
Expand Down Expand Up @@ -229,7 +229,7 @@ export class Installer implements IInstaller {
return disablePromptForFeatures.indexOf(productName) === -1;
}
private installCTags() {
if (this.isWindows) {
if (this.serviceContainer.get<IPlatformService>(IPlatformService).isWindows) {
this.outputChannel.appendLine('Install Universal Ctags Win32 to enable support for Workspace Symbols');
this.outputChannel.appendLine('Download the CTags binary from the Universal CTags site.');
this.outputChannel.appendLine('Option 1: Extract ctags.exe from the downloaded zip to any folder within your PATH so that Visual Studio Code can run it.');
Expand Down
Loading