Skip to content

Commit

Permalink
outline no need filename param
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Sep 12, 2023
1 parent 039d614 commit 856e7a9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nimlsp/nimlsppkg/nimsuggest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ proc processFlags(sug: Suggest; n: ParsedNode) =
if identDeprecated or colonDeprecated:
sug.flags.incl SuggestFlag.deprecated

proc parsedNodeToSugget(n: ParsedNode; moduleName: string): Suggest =
proc parsedNodeToSugget(n: ParsedNode; module: PSym): Suggest =
if n.kind in {pnkError, pnkEmpty}: return
if n.kind notin {pnkConstSection..pnkTypeDef, pnkIdentDefs}: return
new(result)
Expand All @@ -207,24 +207,24 @@ proc parsedNodeToSugget(n: ParsedNode; moduleName: string): Suggest =
# name.add ","

if name != "":
result.qualifiedPath = @[moduleName, name]
result.qualifiedPath = @[module.name.s, name]
result.line = token.line.int
result.column = token.col.int
result.tokenLen = name.len
result.symkind = byte pnkToSymKind(n.kind)

proc outline(graph: ModuleGraph; file: AbsoluteFile; fileIdx: FileIndex) =
proc outline(graph: ModuleGraph; fileIdx: FileIndex) =
let conf = graph.config
var parser: Parser
var sug: Suggest
var parsedNode: ParsedNode
var s: ParsedNode
let m = splitFile(file.string)
let m = graph.getModule fileIdx
const Sections = {pnkTypeSection, pnkConstSection, pnkLetSection, pnkVarSection}
template suggestIt(parsedNode: ParsedNode) =
sug = parsedNodeToSugget(parsedNode, m.name)
sug = parsedNodeToSugget(parsedNode, m)
if sug != nil:
sug.filepath = file.string
sug.filepath = toFullPath(conf, fileIdx)
conf.suggestionResultHook(sug)
if setupParser(parser, fileIdx, graph.cache, conf):
while true:
Expand Down Expand Up @@ -260,7 +260,7 @@ proc executeNoHooks(cmd: IdeCmd, file, dirtyfile: AbsoluteFile, line, col: int,
needCompile = false
if conf.ideCmd == ideOutline:
needCompile = false
outline(graph, file, dirtyIdx)
outline(graph, dirtyIdx)

if needCompile:
if not isKnownFile:
Expand Down

0 comments on commit 856e7a9

Please sign in to comment.