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

Cherry picks from main for point release #17665

Merged
merged 8 commits into from
Oct 13, 2021
Merged
1 change: 1 addition & 0 deletions news/1 Enhancements/17658.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Provide IntelliSense status information when using `github.dev` or any other web platform.
1 change: 1 addition & 0 deletions news/2 Fixes/16980.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure we use fragment when formatting notebook cells.
1 change: 1 addition & 0 deletions news/2 Fixes/17252.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hide UI elements that are not applicable when using `github.dev` or any other web platform.
1 change: 1 addition & 0 deletions news/2 Fixes/17712.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Localize strings on `github.dev` using VSCode FS API.
1 change: 1 addition & 0 deletions news/2 Fixes/7160.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure commands run are not logged twice in Python output channel.
1 change: 1 addition & 0 deletions news/3 Code Health/16732.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Log commands run by the discovery component in the output channel.
212 changes: 193 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"id": "pythonWelcome",
"title": "Get started with Python development",
"description": "Your first steps to set up a Python project with all the powerful tools and features that the Python extension has to offer!",
"when": "workspacePlatform != webworker",
"steps": [
{
"id": "python.installPythonWin",
Expand Down Expand Up @@ -1707,117 +1708,290 @@
],
"menus": {
"commandPalette": [
{
"category": "Python",
"command": "python.analysis.clearCache",
"title": "%python.command.python.analysis.clearCache.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.analysis.restartLanguageServer",
"title": "%python.command.python.analysis.restartLanguageServer.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.clearPersistentStorage",
"title": "%python.command.python.clearPersistentStorage.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.clearWorkspaceInterpreter",
"title": "%python.command.python.clearWorkspaceInterpreter.title%"
"title": "%python.command.python.clearWorkspaceInterpreter.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.configureTests",
"title": "%python.command.python.configureTests.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.createTerminal",
"title": "%python.command.python.createTerminal.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.enableLinting",
"title": "%python.command.python.enableLinting.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.enableSourceMapSupport",
"title": "%python.command.python.enableSourceMapSupport.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.execInTerminal",
"title": "%python.command.python.execInTerminal.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.execInTerminal-icon",
"icon": "$(play)",
"title": "%python.command.python.execInTerminal.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.debugInTerminal",
"icon": "$(debug-alt)",
"title": "%python.command.python.debugInTerminal.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.execSelectionInDjangoShell",
"title": "%python.command.python.execSelectionInDjangoShell.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.execSelectionInTerminal",
"title": "%python.command.python.execSelectionInTerminal.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.goToPythonObject",
"title": "%python.command.python.goToPythonObject.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.launchTensorBoard"
"command": "python.launchTensorBoard",
"title": "%python.command.python.launchTensorBoard.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.refreshTensorBoard",
"enablement": "python.hasActiveTensorBoardSession",
"icon": "$(refresh)",
"title": "%python.command.python.refreshTensorBoard.title%",
"when": "!virtualWorkspace"
},
{
"category": "Test",
"command": "python.refreshTests",
"icon": "$(refresh)",
"title": "%python.command.python.refreshTests.title%",
"when": "!virtualWorkspace"
},
{
"category": "Test",
"command": "python.refreshingTests",
"icon": {
"dark": "resources/dark/discovering-tests.svg",
"light": "resources/light/discovering-tests.svg"
},
"title": "%python.command.python.refreshingTests.title%",
"when": "!virtualWorkspace"
},
{
"category": "Test",
"command": "python.stopRefreshingTests",
"icon": "$(stop-circle)",
"title": "%python.command.python.stopRefreshingTests.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.reportIssue",
"title": "%python.command.python.reportIssue.title%",
"when": "!virtualWorkspace"
},
{
"category": "Test",
"command": "testing.reRunFailTests",
"icon": "$(run-errors)",
"title": "%python.command.testing.rerunFailedTests.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.runLinting",
"title": "%python.command.python.runLinting.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.setInterpreter",
"title": "%python.command.python.setInterpreter.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.setLinter",
"title": "%python.command.python.setLinter.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python Refactor",
"command": "python.sortImports",
"title": "%python.command.python.sortImports.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.startREPL",
"title": "%python.command.python.startREPL.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.viewLanguageServerOutput",
"enablement": "python.hasLanguageServerOutputChannel",
"title": "%python.command.python.viewLanguageServerOutput.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.clearWorkspaceInterpreter",
"title": "%python.command.python.clearWorkspaceInterpreter.title%",
"when": "!virtualWorkspace"
},
{
"category": "Python",
"command": "python.switchOffInsidersChannel",
"title": "%python.command.python.switchOffInsidersChannel.title%",
"when": "config.python.insidersChannel != 'default'"
"when": "config.python.insidersChannel != 'default' && !virtualWorkspace"
},
{
"category": "Python",
"command": "python.switchToDailyChannel",
"title": "%python.command.python.switchToDailyChannel.title%",
"when": "config.python.insidersChannel != 'daily'"
"when": "config.python.insidersChannel != 'daily' && !virtualWorkspace"
},
{
"category": "Python",
"command": "python.switchToWeeklyChannel",
"title": "%python.command.python.switchToWeeklyChannel.title%",
"when": "config.python.insidersChannel != 'weekly'"
"when": "config.python.insidersChannel != 'weekly' && !virtualWorkspace"
},
{
"category": "Python",
"command": "python.viewOutput",
"title": "%python.command.python.viewOutput.title%"
"title": "%python.command.python.viewOutput.title%",
"when": "!virtualWorkspace"
}
],
"editor/context": [
{
"command": "python.execInTerminal",
"group": "Python",
"when": "resourceLangId == python"
"when": "resourceLangId == python && !virtualWorkspace"
},
{
"command": "python.execSelectionInDjangoShell",
"group": "Python",
"when": "editorHasSelection && editorLangId == python && python.isDjangoProject"
"when": "editorHasSelection && editorLangId == python && python.isDjangoProject && !virtualWorkspace"
},
{
"command": "python.execSelectionInTerminal",
"group": "Python",
"when": "editorFocus && editorLangId == python"
"when": "editorFocus && editorLangId == python && !virtualWorkspace"
},
{
"command": "python.sortImports",
"group": "Refactor",
"title": "Refactor: Sort Imports",
"when": "editorLangId == python && !notebookEditorFocused"
"when": "editorLangId == python && !notebookEditorFocused && !virtualWorkspace"
}
],
"editor/title": [
{
"command": "python.refreshTensorBoard",
"group": "navigation@0",
"when": "python.hasActiveTensorBoardSession"
"when": "python.hasActiveTensorBoardSession && !virtualWorkspace"
}
],
"editor/title/run": [
{
"command": "python.execInTerminal-icon",
"group": "navigation@0",
"title": "%python.command.python.execInTerminal.title%",
"when": "resourceLangId == python && !isInDiffEditor"
"when": "resourceLangId == python && !isInDiffEditor && !virtualWorkspace"
},
{
"command": "python.debugInTerminal",
"group": "navigation@1",
"title": "%python.command.python.debugInTerminal.title%",
"when": "resourceLangId == python && !isInDiffEditor"
"when": "resourceLangId == python && !isInDiffEditor && !virtualWorkspace"
}
],
"explorer/context": [
{
"command": "python.execInTerminal",
"group": "Python",
"when": "resourceLangId == python"
"when": "resourceLangId == python && !virtualWorkspace"
}
],
"view/title": [
{
"command": "python.refreshTests",
"when": "view == workbench.view.testing && !refreshingTests && inShowRefreshingTestsExperiment",
"when": "view == workbench.view.testing && !refreshingTests && inShowRefreshingTestsExperiment && !virtualWorkspace",
"group": "navigation@0"
},
{
"command": "python.refreshingTests",
"when": "view == workbench.view.testing && refreshingTests && inShowRefreshingTestsExperiment",
"when": "view == workbench.view.testing && refreshingTests && inShowRefreshingTestsExperiment && !virtualWorkspace",
"group": "navigation@0"
},
{
"command": "python.stopRefreshingTests",
"when": "view == workbench.view.testing && refreshingTests && inShowRefreshingTestsExperiment",
"when": "view == workbench.view.testing && refreshingTests && inShowRefreshingTestsExperiment && !virtualWorkspace",
"group": "navigation@0"
},
{
"command": "testing.reRunFailTests",
"when": "view == workbench.view.testing && hasFailedTests && inShowRunFailedTestsExperiment",
"when": "view == workbench.view.testing && hasFailedTests && inShowRunFailedTestsExperiment && !virtualWorkspace",
"group": "navigation@1"
}
]
},
"viewsWelcome": [
{
"view": "testing",
"contents": "Configure a test framework to see your tests here.\n[Configure Python Tests](command:python.configureTests)"
"contents": "Configure a test framework to see your tests here.\n[Configure Python Tests](command:python.configureTests)",
"when": "!virtualWorkspace"
}
],
"yamlValidation": [
Expand Down
3 changes: 3 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@
"Testing.configureTests": "Configure Test Framework",
"Testing.testNotConfigured": "No test framework configured.",
"Common.openOutputPanel": "Show output",
"LanguageService.statusItem.name":"Python IntelliSense Status",
"LanguageService.statusItem.text": "Partial Mode",
"LanguageService.statusItem.detail": "Limited IntelliSense provided by Pylance",
"LanguageService.lsFailedToStart": "We encountered an issue starting the language server. Reverting to Jedi language engine. Check the Python output panel for details.",
"LanguageService.lsFailedToDownload": "We encountered an issue downloading the language server. Reverting to Jedi language engine. Check the Python output panel for details.",
"LanguageService.lsFailedToExtract": "We encountered an issue extracting the language server. Reverting to Jedi language engine. Check the Python output panel for details.",
Expand Down
5 changes: 4 additions & 1 deletion src/client/browser/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import { LanguageClientMiddlewareBase } from '../activation/languageClientMiddle
import { ILSExtensionApi } from '../activation/node/languageServerFolderService';
import { LanguageServerType } from '../activation/types';
import { AppinsightsKey, PVSC_EXTENSION_ID, PYLANCE_EXTENSION_ID } from '../common/constants';
import { loadLocalizedStringsForBrowser } from '../common/utils/localizeHelpers';
import { EventName } from '../telemetry/constants';
import { createStatusItem } from './intellisenseStatus';

interface BrowserConfig {
distUrl: string; // URL to Pylance's dist folder.
}

export async function activate(context: vscode.ExtensionContext): Promise<void> {
// Run in a promise and return early so that VS Code can go activate Pylance.

await loadLocalizedStringsForBrowser();
const pylanceExtension = vscode.extensions.getExtension<ILSExtensionApi>(PYLANCE_EXTENSION_ID);
if (pylanceExtension) {
runPylance(context, pylanceExtension);
Expand Down Expand Up @@ -114,6 +116,7 @@ async function runPylance(
const disposable = languageClient.start();

context.subscriptions.push(disposable);
context.subscriptions.push(createStatusItem());
} catch (e) {
console.log(e);
}
Expand Down
26 changes: 26 additions & 0 deletions src/client/browser/intellisenseStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

// IMPORTANT: Do not import any node fs related modules here, as they do not work in browser.
import * as vscode from 'vscode';
import { Common, LanguageService } from './localize';

export function createStatusItem(): vscode.Disposable {
if ('createLanguageStatusItem' in vscode.languages) {
const statusItem = vscode.languages.createLanguageStatusItem('python.projectStatus', {
language: 'python',
});
statusItem.name = LanguageService.statusItem.name();
statusItem.severity = vscode.LanguageStatusSeverity.Warning;
statusItem.text = LanguageService.statusItem.text();
statusItem.detail = LanguageService.statusItem.detail();
statusItem.command = {
title: Common.learnMore(),
command: 'vscode.open',
arguments: [vscode.Uri.parse('https://aka.ms/AAdzyh4')],
};
return statusItem;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
return { dispose: () => {} };
}
Loading