mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Fixes #3204: [json] project.json intellisense broken due to server change
This commit is contained in:
@@ -39,6 +39,24 @@ export class JSONHover {
|
||||
if (!node) {
|
||||
return Promise.resolve(void 0);
|
||||
}
|
||||
|
||||
var createHover = (contents: MarkedString[]) => {
|
||||
let range = Range.create(document.positionAt(node.start), document.positionAt(node.end));
|
||||
let result: Hover = {
|
||||
contents: contents,
|
||||
range: range
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
let location = node.getNodeLocation();
|
||||
for (let i = this.contributions.length - 1; i >= 0; i--) {
|
||||
let contribution = this.contributions[i];
|
||||
let promise = contribution.getInfoContribution(textDocumentPosition.uri, location);
|
||||
if (promise) {
|
||||
return promise.then(htmlContent => createHover(htmlContent));
|
||||
}
|
||||
}
|
||||
|
||||
return this.schemaService.getSchemaForResource(textDocumentPosition.uri, doc).then((schema) => {
|
||||
if (schema) {
|
||||
@@ -46,33 +64,12 @@ export class JSONHover {
|
||||
doc.validate(schema.schema, matchingSchemas, node.start);
|
||||
|
||||
let description: string = null;
|
||||
let contributonId: string = null;
|
||||
matchingSchemas.every((s) => {
|
||||
if (s.node === node && !s.inverted && s.schema) {
|
||||
description = description || s.schema.description;
|
||||
contributonId = contributonId || s.schema.id;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
var createHover = (contents: MarkedString[]) => {
|
||||
let range = Range.create(document.positionAt(node.start), document.positionAt(node.end));
|
||||
let result: Hover = {
|
||||
contents: contents,
|
||||
range: range
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
let location = node.getNodeLocation();
|
||||
for (let i = this.contributions.length - 1; i >= 0; i--) {
|
||||
let contribution = this.contributions[i];
|
||||
let promise = contribution.getInfoContribution(textDocumentPosition.uri, location);
|
||||
if (promise) {
|
||||
return promise.then(htmlContent => createHover(htmlContent));
|
||||
}
|
||||
}
|
||||
|
||||
if (description) {
|
||||
return createHover([description]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user