Skip to content

Commit

Permalink
Display python debug config ui when editing launch.json (#5016)
Browse files Browse the repository at this point in the history
For #3321
  • Loading branch information
DonJayamanne authored Apr 4, 2019
1 parent 56d44da commit 531cb00
Show file tree
Hide file tree
Showing 21 changed files with 1,005 additions and 306 deletions.
1 change: 0 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ function getFilesToProcess(fileList) {
* @param {hygieneOptions} options
*/
function getFileListToProcess(options) {
return [];
const mode = options ? options.mode : 'all';
const gulpSrcOptions = { base: '.' };

Expand Down
1 change: 1 addition & 0 deletions news/1 Enhancements/3321.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Launch the `Python` debug configuration UI when manually adding entries into the `launch.json` file.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,7 @@
"hash.js": "^1.1.7",
"iconv-lite": "^0.4.21",
"inversify": "^4.11.1",
"jsonc-parser": "^2.0.3",
"line-by-line": "^0.1.6",
"lodash": "^4.17.11",
"md5": "^2.2.1",
Expand Down
4 changes: 3 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@
"Common.loadingPythonExtension": "Python extension loading...",
"debug.selectConfigurationTitle": "Select a debug configuration",
"debug.selectConfigurationPlaceholder": "Debug Configuration",
"debug.launchJsonConfigurationsCompletionLabel": "Python",
"debug.launchJsonConfigurationsCompletionDescription": "Select Python Launch Configuration",
"debug.debugFileConfigurationLabel": "Python File",
"debug.debugFileConfigurationDescription": "Debug Python file",
"debug.debugModuleConfigurationLabel": "Module",
Expand Down Expand Up @@ -229,5 +231,5 @@
"DataScience.noRowsInDataViewer" : "Fetching data ...",
"DataScience.pandasTooOldForViewingFormat" : "Python package 'pandas' is version {0}. Version 0.20 or greater is required for viewing data.",
"DataScience.pandasRequiredForViewing" : "Python package 'pandas' is required for viewing data.",
"DataScience.valuesColumn": "values"
"DataScience.valuesColumn": "values"
}
8 changes: 8 additions & 0 deletions src/client/activation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export interface IExtensionActivationManager extends IDisposable {
}

export const IExtensionActivationService = Symbol('IExtensionActivationService');
/**
* Classes implementing this interface will have their `activate` methods
* invoked during the actiavtion of the extension.
* This is a great hook for extension activation code, i.e. you don't need to modify
* the `extension.ts` file to invoke some code when extension gets activated.
* @export
* @interface IExtensionActivationService
*/
export interface IExtensionActivationService {
activate(resource: Resource): Promise<void>;
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

'use strict';

import { CancellationToken, Uri } from 'vscode';
import { CancellationToken, Position, TextDocument, Uri } from 'vscode';
import { Commands as DSCommands } from '../../datascience/constants';
import { CommandSource } from '../../unittests/common/constants';
import { TestFunction, TestsToRun } from '../../unittests/common/types';
Expand Down Expand Up @@ -63,6 +63,7 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
['setContext']: [string, boolean];
['revealLine']: [{ lineNumber: number; at: 'top' | 'center' | 'bottom' }];
['python._loadLanguageServerExtension']: {}[];
['python.SelectAndInsertDebugConfiguration']: [TextDocument, Position, CancellationToken];
[Commands.Build_Workspace_Symbols]: [boolean, CancellationToken];
[Commands.Sort_Imports]: [undefined, Uri];
[Commands.Exec_In_Terminal]: [undefined, Uri];
Expand Down
16 changes: 16 additions & 0 deletions src/client/common/application/languageService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

import { injectable } from 'inversify';
import { CompletionItemProvider, DocumentSelector, languages } from 'vscode';
import { Disposable } from 'vscode-jsonrpc';
import { ILanguageService } from './types';

@injectable()
export class LanguageService implements ILanguageService {
public registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable {
return languages.registerCompletionItemProvider(selector, provider, ...triggerCharacters);
}
}
21 changes: 21 additions & 0 deletions src/client/common/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import {
Breakpoint,
BreakpointsChangeEvent,
CancellationToken,
CompletionItemProvider,
ConfigurationChangeEvent,
DebugConfiguration,
DebugConfigurationProvider,
DebugConsole,
DebugSession,
DebugSessionCustomEvent,
Disposable,
DocumentSelector,
Event,
FileSystemWatcher,
GlobPattern,
Expand Down Expand Up @@ -904,3 +906,22 @@ export interface ILiveShareTestingApi extends ILiveShareApi {
startSession(): Promise<void>;
stopSession(): Promise<void>;
}

export const ILanguageService = Symbol('ILanguageService');
export interface ILanguageService {
/**
* Register a completion provider.
*
* Multiple providers can be registered for a language. In that case providers are sorted
* by their [score](#languages.match) and groups of equal score are sequentially asked for
* completion items. The process stops when one or many providers of a group return a
* result. A failing provider (rejected promise or exception) will not fail the whole
* operation.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider A completion provider.
* @param triggerCharacters Trigger completion when the user types one of the characters, like `.` or `:`.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable;
}
3 changes: 3 additions & 0 deletions src/client/common/serviceRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import { CommandManager } from './application/commandManager';
import { DebugService } from './application/debugService';
import { DocumentManager } from './application/documentManager';
import { Extensions } from './application/extensions';
import { LanguageService } from './application/languageService';
import { TerminalManager } from './application/terminalManager';
import {
IApplicationEnvironment,
IApplicationShell,
ICommandManager,
IDebugService,
IDocumentManager,
ILanguageService,
ILiveShareApi,
ITerminalManager,
IWorkspaceService
Expand Down Expand Up @@ -91,6 +93,7 @@ export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<ITerminalManager>(ITerminalManager, TerminalManager);
serviceManager.addSingleton<IDebugService>(IDebugService, DebugService);
serviceManager.addSingleton<IApplicationEnvironment>(IApplicationEnvironment, ApplicationEnvironment);
serviceManager.addSingleton<ILanguageService>(ILanguageService, LanguageService);
serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
Expand Down
Loading

0 comments on commit 531cb00

Please sign in to comment.