Skip to content

Commit 5dbd5a9

Browse files
committed
Add tests and fixes for hover feature
1 parent f47eef9 commit 5dbd5a9

File tree

3 files changed

+712
-11
lines changed

3 files changed

+712
-11
lines changed

language-server/src/features/hover.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ export default {
1717
// This is a little wierd because we want the hover to be on the keyword, but
1818
// the annotation is actually on the value not the keyword.
1919
if (keyword.parent && SchemaNode.typeOf(keyword.parent) === "property" && keyword.parent.children[0] === keyword) {
20-
return {
21-
contents: {
22-
kind: MarkupKind.Markdown,
23-
value: SchemaNode.annotation(keyword.parent.children[1], "description", annotationDialectUri).join("\n")
24-
},
25-
range: {
26-
start: document.positionAt(keyword.offset),
27-
end: document.positionAt(keyword.offset + keyword.textLength)
28-
}
29-
};
20+
const description = SchemaNode.annotation(keyword.parent.children[1], "description", annotationDialectUri);
21+
if (description.length > 0) {
22+
return {
23+
contents: {
24+
kind: MarkupKind.Markdown,
25+
value: description.join("\n")
26+
},
27+
range: {
28+
start: document.positionAt(keyword.offset),
29+
end: document.positionAt(keyword.offset + keyword.textLength - 1)
30+
}
31+
};
32+
}
3033
}
3134
});
3235
},

0 commit comments

Comments
 (0)