mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-06 07:38:24 +00:00
Nimsuggest: Operators in symbol outline (#25565)
So the problem is that Nim Language Server won't show procs like \`+\`
and \`==\` in the Document Symbols or Workspace Symbols lists. Which is
really annoying given they are regular procs just named a bit
differently.
Initially, I thought the problem was with nim-lang/langserver and opened
an issue there: https://github.com/nim-lang/langserver/issues/380
But after an investigation, it turned out the issue is fixed on the
nimsuggest side.
Strangely enough, calling `outline foo.nim:0:0` in nimsuggest manually
does show \`+\` as well as regular procs (e.g. `foo`) but when
nimsuggest is invoked from lsp only `foo` would be there.
Anyway, with this fix all procs appear on the symbol lists.
(cherry picked from commit 2290c75f12)
This commit is contained in:
committed by
narimiran
parent
98c67dff7f
commit
2018b23dce
@@ -1018,7 +1018,7 @@ proc outlineNode(graph: ModuleGraph, n: PNode, endInfo: TLineInfo, infoPairs: Su
|
||||
if n.kind == nkSym and n.sym.checkSymbol(n.info):
|
||||
graph.suggestResult(n.sym, n.sym.info, ideOutline, endInfo.line, endInfo.col)
|
||||
return true
|
||||
elif n.kind == nkIdent:
|
||||
elif n.kind in {nkIdent, nkAccQuoted}:
|
||||
let symData = findByTLineInfo(n.info, infoPairs)
|
||||
if symData != nil and symData.sym.checkSymbol(symData.info):
|
||||
let sym = symData.sym
|
||||
@@ -1028,7 +1028,7 @@ proc outlineNode(graph: ModuleGraph, n: PNode, endInfo: TLineInfo, infoPairs: Su
|
||||
proc handleIdentOrSym(graph: ModuleGraph, n: PNode, endInfo: TLineInfo, infoPairs: SuggestFileSymbolDatabase): bool =
|
||||
result = false
|
||||
for child in n:
|
||||
if child.kind in {nkIdent, nkSym}:
|
||||
if child.kind in {nkIdent, nkAccQuoted, nkSym}:
|
||||
if graph.outlineNode(child, endInfo, infoPairs):
|
||||
return true
|
||||
elif child.kind == nkPostfix:
|
||||
|
||||
Reference in New Issue
Block a user