Skip to content

Commit

Permalink
Add tests and fixes for hover feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesrosiers committed Jun 26, 2024
1 parent f47eef9 commit 5dbd5a9
Show file tree
Hide file tree
Showing 3 changed files with 712 additions and 11 deletions.
23 changes: 13 additions & 10 deletions language-server/src/features/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ export default {
// This is a little wierd because we want the hover to be on the keyword, but
// the annotation is actually on the value not the keyword.
if (keyword.parent && SchemaNode.typeOf(keyword.parent) === "property" && keyword.parent.children[0] === keyword) {
return {
contents: {
kind: MarkupKind.Markdown,
value: SchemaNode.annotation(keyword.parent.children[1], "description", annotationDialectUri).join("\n")
},
range: {
start: document.positionAt(keyword.offset),
end: document.positionAt(keyword.offset + keyword.textLength)
}
};
const description = SchemaNode.annotation(keyword.parent.children[1], "description", annotationDialectUri);
if (description.length > 0) {
return {
contents: {
kind: MarkupKind.Markdown,
value: description.join("\n")
},
range: {
start: document.positionAt(keyword.offset),
end: document.positionAt(keyword.offset + keyword.textLength - 1)
}
};
}
}
});
},
Expand Down
Loading

0 comments on commit 5dbd5a9

Please sign in to comment.