diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 454433434e5f4f09a22728d51356ea1c87718717..3ecae97d4035b666d3207bcebb4585cfa6ddc41c 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -9,6 +9,8 @@ import Event from 'vs/base/common/event'; import severity from 'vs/base/common/severity'; import {createDecorator} from 'vs/platform/instantiation/common/instantiation'; import editor = require('vs/editor/common/editorCommon'); +import {Position} from 'vs/editor/common/core/position'; +import {ISuggestion} from 'vs/editor/common/modes'; import {Source} from 'vs/workbench/parts/debug/common/debugSource'; import {Range} from 'vs/editor/common/core/range'; import {RawContextKey, ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey'; @@ -19,6 +21,7 @@ export const DEBUG_SERVICE_ID = 'debugService'; export const CONTEXT_IN_DEBUG_MODE = new RawContextKey('inDebugMode', false); export const CONTEXT_NOT_IN_DEBUG_MODE:ContextKeyExpr = CONTEXT_IN_DEBUG_MODE.toNegated(); export const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug'; +export const DEBUG_SCHEME = 'debug'; // raw @@ -414,6 +417,7 @@ export interface IDebugService { continue(threadId: number): TPromise; pause(threadId: number): TPromise; restartFrame(frameId: number): TPromise; + completions(text: string, position: Position): TPromise; } // Editor interfaces diff --git a/src/vs/workbench/parts/debug/common/debugSource.ts b/src/vs/workbench/parts/debug/common/debugSource.ts index 974b5bf229d7930d8e3986dea8f451b34dbcf81a..ad440c30612900c37c85a620e6a44877aa8d852a 100644 --- a/src/vs/workbench/parts/debug/common/debugSource.ts +++ b/src/vs/workbench/parts/debug/common/debugSource.ts @@ -5,14 +5,14 @@ import uri from 'vs/base/common/uri'; import paths = require('vs/base/common/paths'); -import {IModel} from 'vs/workbench/parts/debug/common/debug'; +import {IModel, DEBUG_SCHEME} from 'vs/workbench/parts/debug/common/debug'; export class Source { public uri: uri; public available: boolean; - private static INTERNAL_URI_PREFIX = 'debug://internal/'; + private static INTERNAL_URI_PREFIX = `${DEBUG_SCHEME}://internal/`; constructor(public raw: DebugProtocol.Source, available = true) { this.uri = raw.path ? uri.file(paths.normalize(raw.path)) : uri.parse(Source.INTERNAL_URI_PREFIX + raw.name); diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index f1bf9a18995ba8f2ec40b076c2227e396d938f46..7e1e42fc831f6973083e343e936b440dd0132d04 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -17,6 +17,8 @@ import severity from 'vs/base/common/severity'; import {TPromise} from 'vs/base/common/winjs.base'; import aria = require('vs/base/browser/ui/aria/aria'); import editorbrowser = require('vs/editor/browser/editorBrowser'); +import {ISuggestion} from 'vs/editor/common/modes'; +import {Position} from 'vs/editor/common/core/position'; import {IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey'; import {IMarkerService} from 'vs/platform/markers/common/markers'; import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle'; @@ -947,6 +949,23 @@ export class DebugService implements debug.IDebugService { return this.session.restartFrame({ frameId }); } + public completions(text: string, position: Position): TPromise { + if (!this.session) { + return TPromise.as([]); + } + + return this.session.completions({ + frameId: this.viewModel.getFocusedStackFrame().frameId, + text, + column: position.column, + line: position.lineNumber + }).then(response => response.body.targets.map(item => ({ + label: item.label, + insertText: item.text || item.label, + type: 'property' + })), err => []); + } + private lazyTransitionToRunningState(threadId?: number): void { let setNewFocusedStackFrameScheduler: RunOnceScheduler; diff --git a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts index b5a2505a1a1940c8aba1e5122b9fed4e2e165e55..bfb0bb61b69b6d9760fcf4c5e4da596185325fda 100644 --- a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts +++ b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts @@ -274,6 +274,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes return this.send('restartFrame', args); } + public completions(args: DebugProtocol.CompletionsArguments): TPromise { + return this.send('completions', args); + } + public disconnect(restart = false, force = false): TPromise { if (this.stopServerPending && force) { return this.stopServer(); diff --git a/src/vs/workbench/parts/debug/test/common/mockDebugService.ts b/src/vs/workbench/parts/debug/test/common/mockDebugService.ts index d36b4cd86b53871d92cb8c5d760a37b13747e8bf..5f02269972bec09399954b5075caa762c74a33ba 100644 --- a/src/vs/workbench/parts/debug/test/common/mockDebugService.ts +++ b/src/vs/workbench/parts/debug/test/common/mockDebugService.ts @@ -6,6 +6,8 @@ import Event from 'vs/base/common/event'; import severity from 'vs/base/common/severity'; import {TPromise} from 'vs/base/common/winjs.base'; +import {ISuggestion} from 'vs/editor/common/modes'; +import {Position} from 'vs/editor/common/core/position'; import debug = require('vs/workbench/parts/debug/common/debug'); import {Source} from 'vs/workbench/parts/debug/common/debugSource'; @@ -134,6 +136,10 @@ export class MockDebugService implements debug.IDebugService { public restartFrame(frameId: number): TPromise { return TPromise.as(null); } + + public completions(text: string, position: Position): TPromise { + return TPromise.as([]); + } }