Skip to content

Commit

Permalink
Expands macros when hovering a skMacro (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez authored Jan 2, 2025
1 parent 0c287fe commit d5e033a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion routes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,14 @@ proc hover*(
suggest = s
else:
break
var content = toMarkedStrings(suggest)
if suggest.symkind == "skMacro":
let expanded = await nimsuggest.get
.expand(uriToPath(uri), ls.uriToStash(uri), suggest.line, suggest.column)
if expanded.len > 0:
content.add MarkedStringOption %* {"language": "nim", "value": expanded[0].doc}
return some(Hover(
contents: some(%toMarkedStrings(suggest)),
contents: some(%content),
range: some(toLabelRange(suggest.toUtf16Pos(ls))),
))

Expand Down

0 comments on commit d5e033a

Please sign in to comment.