mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Fixes #3204: [json] project.json intellisense broken due to server change
This commit is contained in:
@@ -11,11 +11,12 @@ import JsonSchema = require('./json-toolbox/jsonSchema');
|
||||
import nls = require('./utils/nls');
|
||||
import {IJSONWorkerContribution} from './jsonContributions';
|
||||
|
||||
import {CompletionItem, CompletionItemKind, CompletionList, ITextDocument, TextDocumentPosition, Range, TextEdit} from 'vscode-languageserver';
|
||||
import {CompletionItem, CompletionItemKind, CompletionList, ITextDocument, TextDocumentPosition, Range, TextEdit, RemoteConsole} from 'vscode-languageserver';
|
||||
|
||||
export interface ISuggestionsCollector {
|
||||
add(suggestion: CompletionItem): void;
|
||||
error(message:string): void;
|
||||
log(message:string): void;
|
||||
setAsIncomplete(): void;
|
||||
}
|
||||
|
||||
@@ -23,10 +24,24 @@ export class JSONCompletion {
|
||||
|
||||
private schemaService: SchemaService.IJSONSchemaService;
|
||||
private contributions: IJSONWorkerContribution[];
|
||||
private console: RemoteConsole;
|
||||
|
||||
constructor(schemaService: SchemaService.IJSONSchemaService, contributions: IJSONWorkerContribution[] = []) {
|
||||
constructor(schemaService: SchemaService.IJSONSchemaService, console: RemoteConsole, contributions: IJSONWorkerContribution[] = []) {
|
||||
this.schemaService = schemaService;
|
||||
this.contributions = contributions;
|
||||
this.console = console;
|
||||
}
|
||||
|
||||
public doResolve(item: CompletionItem) : Thenable<CompletionItem> {
|
||||
for (let i = this.contributions.length - 1; i >= 0; i--) {
|
||||
if (this.contributions[i].resolveSuggestion) {
|
||||
let resolver = this.contributions[i].resolveSuggestion(item);
|
||||
if (resolver) {
|
||||
return resolver;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Promise.resolve(item);
|
||||
}
|
||||
|
||||
public doSuggest(document: ITextDocument, textDocumentPosition: TextDocumentPosition, doc: Parser.JSONDocument): Thenable<CompletionList> {
|
||||
@@ -63,7 +78,10 @@ export class JSONCompletion {
|
||||
result.isIncomplete = true;
|
||||
},
|
||||
error: (message: string) => {
|
||||
console.log(message);
|
||||
this.console.error(message);
|
||||
},
|
||||
log: (message: string) => {
|
||||
this.console.log(message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user