Skip to content

Added ability to auto update Insiders build of extension #6308

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

Merged
merged 33 commits into from
Jul 11, 2019
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
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"cucumberautocomplete.skipDocStringsFormat": true,
"python.linting.flake8Args": ["--max-line-length=120"]
"python.linting.flake8Args": [
"--max-line-length=120"
]
}
1 change: 1 addition & 0 deletions news/1 Enhancements/2772.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added ability to auto update Insiders build of extension
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,21 @@
"title": "%python.command.python.setInterpreter.title%",
"category": "Python"
},
{
"command": "python.switchToStable",
"title": "%python.command.python.switchToStable.title%",
"category": "Python"
},
{
"command": "python.switchToInsidersDaily",
"title": "%python.command.python.switchToInsidersDaily.title%",
"category": "Python"
},
{
"command": "python.switchToInsidersWeekly",
"title": "%python.command.python.switchToInsidersWeekly.title%",
"category": "Python"
},
{
"command": "python.updateSparkLibrary",
"title": "%python.command.python.updateSparkLibrary.title%",
Expand Down Expand Up @@ -569,6 +584,24 @@
}
],
"commandPalette": [
{
"command": "python.switchToStable",
"title": "%python.command.python.switchToStable.title%",
"category": "Python",
"when": "config.python.insidersChannel != 'Stable'"
},
{
"command": "python.switchToInsidersDaily",
"title": "%python.command.python.switchToInsidersDaily.title%",
"category": "Python",
"when": "config.python.insidersChannel != 'InsidersDaily'"
},
{
"command": "python.switchToInsidersWeekly",
"title": "%python.command.python.switchToInsidersWeekly.title%",
"category": "Python",
"when": "config.python.insidersChannel != 'InsidersWeekly'"
},
{
"command": "python.viewOutput",
"title": "%python.command.python.viewOutput.title%",
Expand Down Expand Up @@ -2115,6 +2148,17 @@
"default": false,
"description": "Uncomment shell assignments (#!), line magic (#!%) and cell magic (#!%%) when parsing code cells.",
"scope": "resource"
},
"python.insidersChannel": {
"type": "string",
"default": "Stable",
"description": "Set to \"Insiders\" to automatically download and install the latest Insiders builds of the extension, which include upcoming features and bug fixes.",
"enum": [
"Stable",
"InsidersWeekly",
"InsidersDaily"
],
"scope": "application"
}
}
},
Expand Down
27 changes: 20 additions & 7 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"python.command.python.debugtests.title": "Debug All Tests",
"python.command.python.execInTerminal.title": "Run Python File in Terminal",
"python.command.python.setInterpreter.title": "Select Interpreter",
"python.command.python.switchToStable.title": "Switch to Stable build",
"python.command.python.switchToInsidersDaily.title": "Switch to Insiders build (daily)",
"python.command.python.switchToInsidersWeekly.title": "Switch to Insiders build (weekly)",
"python.command.python.updateSparkLibrary.title": "Update Workspace PySpark Libraries",
"python.command.python.refactorExtractVariable.title": "Extract Variable",
"python.command.python.refactorExtractMethod.title": "Extract Method",
Expand Down Expand Up @@ -109,6 +112,16 @@
"Interpreters.LoadingInterpreters": "Loading Python Interpreters",
"Logging.CurrentWorkingDirectory": "cwd:",
"Common.doNotShowAgain": "Do not show again",
"Common.reload": "Reload",
"ExtensionChannels.installingInsidersMessage": "Installing Insiders... ",
"ExtensionChannels.installingStableMessage": "Installing Stable... ",
"ExtensionChannels.installationCompleteMessage": "complete.",
"ExtensionChannels.downloadingInsidersMessage": "Downloading Insiders Extension... ",
"ExtensionChannels.useStable": "Use Stable",
"ExtensionChannels.promptMessage": "We noticed you are using Visual Studio Code Insiders. Reload to use the Insiders build of the extension.",
"ExtensionChannels.reloadMessage": "Please reload the window switching between insiders channels",
"ExtensionChannels.downloadCompletedOutputMessage": "Insiders build download complete.",
"ExtensionChannels.startingDownloadOutputMessage": "Starting download for Insiders build.",
"Interpreters.environmentPromptMessage": "We noticed a new virtual environment has been created. Do you want to select it for the workspace folder?",
"DataScience.restartKernelMessage": "Do you want to restart the IPython kernel? All variables will be lost.",
"DataScience.restartKernelMessageYes": "Yes",
Expand Down Expand Up @@ -231,9 +244,9 @@
"Testing.configureTests": "Configure Test Framework",
"Testing.disableTests": "Disable Tests",
"Common.openOutputPanel": "Show output",
"LanguageService.downloadFailedOutputMessage": "download failed",
"LanguageService.extractionFailedOutputMessage": "extraction failed",
"LanguageService.extractionCompletedOutputMessage": "complete",
"LanguageService.downloadFailedOutputMessage": "Language server download failed",
"LanguageService.extractionFailedOutputMessage": "Language server extraction failed",
"LanguageService.extractionCompletedOutputMessage": "Language server dowload complete",
"LanguageService.extractionDoneOutputMessage": "done",
"LanguageService.reloadVSCodeIfSeachPathHasChanged": "Search paths have changed for this Python interpreter. Please reload the extension to ensure that the IntelliSense works correctly",
"DataScience.variableExplorerNameColumn": "Name",
Expand Down Expand Up @@ -285,9 +298,9 @@
"DataScience.imageListLabel": "Image",
"DataScience.exportImageFailed": "Error exporting image: {0}",
"downloading.file": "Downloading {0}...",
"downloading.file.progress": "{0}{1} of {2} KB ({3})",
"downloading.file.progress": "{0}{1} of {2} KB ({3}%)",
"DataScience.jupyterDataRateExceeded": "Cannot view variable because data rate exceeded. Please restart your server with a higher data rate limit. For example, --NotebookApp.iopub_data_rate_limit=10000000000.0",
"DataScience.addCellBelowCommandTitle" : "Add cell",
"DataScience.debugCellCommandTitle" : "Debug cell",
"DataScience.variableExplorerDisabledDuringDebugging" : "Variables are not available while debugging."
"DataScience.addCellBelowCommandTitle": "Add cell",
"DataScience.debugCellCommandTitle": "Debug cell",
"DataScience.variableExplorerDisabledDuringDebugging": "Variables are not available while debugging."
}
2 changes: 1 addition & 1 deletion src/client/activation/languageServer/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IApplicationShell, IWorkspaceService } from '../../common/application/t
import { STANDARD_OUTPUT_CHANNEL } from '../../common/constants';
import '../../common/extensions';
import { IFileSystem } from '../../common/platform/types';
import { IOutputChannel, Resource, IFileDownloader } from '../../common/types';
import { IFileDownloader, IOutputChannel, Resource } from '../../common/types';
import { createDeferred } from '../../common/utils/async';
import { Common, LanguageService } from '../../common/utils/localize';
import { StopWatch } from '../../common/utils/stopWatch';
Expand Down
12 changes: 10 additions & 2 deletions src/client/common/application/applicationEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

import { inject, injectable } from 'inversify';
import * as path from 'path';
import { parse } from 'semver';
import * as vscode from 'vscode';
import { IPlatformService } from '../platform/types';
import { ICurrentProcess, IPathUtils } from '../types';
import { OSType } from '../utils/platform';
import { IApplicationEnvironment } from './types';
import { Channel, IApplicationEnvironment } from './types';

@injectable()
export class ApplicationEnvironment implements IApplicationEnvironment {
Expand All @@ -18,7 +19,7 @@ export class ApplicationEnvironment implements IApplicationEnvironment {
@inject(ICurrentProcess) private readonly process: ICurrentProcess) { }

public get userSettingsFile(): string | undefined {
const vscodeFolderName = vscode.env.appName.indexOf('Insider') > 0 ? 'Code - Insiders' : 'Code';
const vscodeFolderName = this.channel === 'insiders' ? 'Code - Insiders' : 'Code';
switch (this.platform.osType) {
case OSType.OSX:
return path.join(this.pathUtils.home, 'Library', 'Application Support', vscodeFolderName, 'User', 'settings.json');
Expand Down Expand Up @@ -58,4 +59,11 @@ export class ApplicationEnvironment implements IApplicationEnvironment {
// tslint:disable-next-line:non-literal-require no-require-imports
return require('../../../../package.json');
}
public get channel(): Channel {
return this.appName.indexOf('Insider') > 0 ? 'insiders' : 'stable';
}
public get extensionChannel(): Channel {
const version = parse(this.packageJson.version);
return !version || version.prerelease.length > 0 ? 'insiders' : 'stable';
}
}
4 changes: 4 additions & 0 deletions src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;
* @interface ICommandNameWithoutArgumentTypeMapping
*/
interface ICommandNameWithoutArgumentTypeMapping {
[Commands.SwitchToInsidersDaily]: [];
[Commands.SwitchToInsidersWeekly]: [];
[Commands.SwitchToStable]: [];
[Commands.Set_Interpreter]: [];
[Commands.Set_ShebangInterpreter]: [];
[Commands.Run_Linter]: [];
Expand Down Expand Up @@ -61,6 +64,7 @@ interface ICommandNameWithoutArgumentTypeMapping {
* @extends {ICommandNameWithoutArgumentTypeMapping}
*/
export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgumentTypeMapping {
['workbench.extensions.installExtension']: [Uri | 'ms-python.python'];
['setContext']: [string, boolean];
['revealLine']: [{ lineNumber: number; at: 'top' | 'center' | 'bottom' }];
['python._loadLanguageServerExtension']: {}[];
Expand Down
13 changes: 13 additions & 0 deletions src/client/common/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,17 @@ export interface IApplicationEnvironment {
* @memberof IApplicationShell
*/
readonly shell: string | undefined;
/**
* Gets the vscode channel (whether 'insiders' or 'stable').
*/
readonly channel: Channel;
/**
* Gets the extension channel (whether 'insiders' or 'stable').
*
* @type {string}
* @memberof IApplicationShell
*/
readonly extensionChannel: Channel;
}

export const IWebPanelMessageListener = Symbol('IWebPanelMessageListener');
Expand Down Expand Up @@ -961,3 +972,5 @@ export interface ILanguageService {
*/
registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable;
}

export type Channel = 'stable' | 'insiders';
11 changes: 9 additions & 2 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { EventName } from '../telemetry/constants';
import { IWorkspaceService } from './application/types';
import { WorkspaceService } from './application/workspace';
import { isTestExecution } from './constants';
import { ExtensionChannels } from './insidersBuild/types';
import { IS_WINDOWS } from './platform/constants';
import {
IAnalysisSettings,
Expand All @@ -21,7 +22,8 @@ import {
ISortImportSettings,
ITerminalSettings,
ITestingSettings,
IWorkspaceSymbolSettings
IWorkspaceSymbolSettings,
Resource
} from './types';
import { debounceSync } from './utils/decorators';
import { SystemVariables } from './variables/systemVariables';
Expand Down Expand Up @@ -55,6 +57,7 @@ export class PythonSettings implements IPythonSettings {
public analysis!: IAnalysisSettings;
public autoUpdateLanguageServer: boolean = true;
public datascience!: IDataScienceSettings;
public insidersChannel!: ExtensionChannels;

protected readonly changed = new EventEmitter<void>();
private workspaceRoot: Uri;
Expand All @@ -66,7 +69,9 @@ export class PythonSettings implements IPythonSettings {
return this.changed.event;
}

constructor(workspaceFolder: Uri | undefined, private readonly interpreterAutoSelectionService: IInterpreterAutoSeletionProxyService,
constructor(
workspaceFolder: Resource,
private readonly interpreterAutoSelectionService: IInterpreterAutoSeletionProxyService,
workspace?: IWorkspaceService) {
this.workspace = workspace || new WorkspaceService();
this.workspaceRoot = workspaceFolder ? workspaceFolder : Uri.file(__dirname);
Expand Down Expand Up @@ -356,6 +361,8 @@ export class PythonSettings implements IPythonSettings {
} else {
this.datascience = dataScienceSettings;
}

this.insidersChannel = pythonSettings.get<ExtensionChannels>('insidersChannel')!;
}

public get pythonPath(): string {
Expand Down
Loading