diff --git a/src/vs/workbench/api/node/extHostApiCommands.ts b/src/vs/workbench/api/node/extHostApiCommands.ts index 13d37a95aba..5065659b7e2 100644 --- a/src/vs/workbench/api/node/extHostApiCommands.ts +++ b/src/vs/workbench/api/node/extHostApiCommands.ts @@ -327,7 +327,7 @@ export class ExtHostApiCommands { position: position && typeConverters.Position.from(position) }; return this._commands.executeCommand('_executeDocumentHighlights', args) - .then(tryMapWith(typeConverters.toDocumentHighlight)); + .then(tryMapWith(typeConverters.DocumentHighlight.to)); } private _executeReferenceProvider(resource: URI, position: types.Position): Thenable { diff --git a/src/vs/workbench/api/node/extHostLanguageFeatures.ts b/src/vs/workbench/api/node/extHostLanguageFeatures.ts index 251dcea3c5f..1245b56dd23 100644 --- a/src/vs/workbench/api/node/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/node/extHostLanguageFeatures.ts @@ -222,18 +222,11 @@ class DocumentHighlightAdapter { return asWinJsPromise(token => this._provider.provideDocumentHighlights(doc, pos, token)).then(value => { if (Array.isArray(value)) { - return value.map(DocumentHighlightAdapter._convertDocumentHighlight); + return value.map(typeConvert.DocumentHighlight.from); } return undefined; }); } - - private static _convertDocumentHighlight(documentHighlight: vscode.DocumentHighlight): modes.DocumentHighlight { - return { - range: typeConvert.Range.from(documentHighlight.range), - kind: documentHighlight.kind - }; - } } class ReferenceAdapter { diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index 7fddbe18e50..67c9d39f43a 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -416,9 +416,16 @@ export namespace Hover { return new types.Hover(info.contents.map(MarkdownString.to), Range.to(info.range)); } } - -export function toDocumentHighlight(occurrence: modes.DocumentHighlight): types.DocumentHighlight { - return new types.DocumentHighlight(Range.to(occurrence.range), occurrence.kind); +export namespace DocumentHighlight { + export function from(documentHighlight: vscode.DocumentHighlight): modes.DocumentHighlight { + return { + range: Range.from(documentHighlight.range), + kind: documentHighlight.kind + }; + } + export function to(occurrence: modes.DocumentHighlight): types.DocumentHighlight { + return new types.DocumentHighlight(Range.to(occurrence.range), occurrence.kind); + } } export namespace CompletionTriggerKind {