mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
Use module actual file instead of PSym.info (#19956)
After this you can do goto module from module import
(cherry picked from commit b0b9a3e5fa)
This commit is contained in:
committed by
narimiran
parent
46f0f6e47e
commit
a3c2eb04b9
@@ -157,19 +157,25 @@ proc symToSuggest*(g: ModuleGraph; s: PSym, isLocal: bool, section: IdeCmd, info
|
||||
result.forth = ""
|
||||
when defined(nimsuggest) and not defined(noDocgen) and not defined(leanCompiler):
|
||||
result.doc = extractDocComment(g, s)
|
||||
let infox =
|
||||
if useSuppliedInfo or section in {ideUse, ideHighlight, ideOutline}:
|
||||
info
|
||||
else:
|
||||
s.info
|
||||
result.filePath = toFullPath(g.config, infox)
|
||||
result.line = toLinenumber(infox)
|
||||
result.column = toColumn(infox)
|
||||
if s.kind == skModule and s.ast.len != 0 and section != ideHighlight:
|
||||
result.filePath = toFullPath(g.config, s.ast[0].info)
|
||||
result.line = 1
|
||||
result.column = 0
|
||||
result.tokenLen = 0
|
||||
else:
|
||||
let infox =
|
||||
if useSuppliedInfo or section in {ideUse, ideHighlight, ideOutline}:
|
||||
info
|
||||
else:
|
||||
s.info
|
||||
result.filePath = toFullPath(g.config, infox)
|
||||
result.line = toLinenumber(infox)
|
||||
result.column = toColumn(infox)
|
||||
result.tokenLen = if section != ideHighlight:
|
||||
s.name.s.len
|
||||
else:
|
||||
getTokenLenFromSource(g.config, s.name.s, infox)
|
||||
result.version = g.config.suggestVersion
|
||||
result.tokenLen = if section != ideHighlight:
|
||||
s.name.s.len
|
||||
else:
|
||||
getTokenLenFromSource(g.config, s.name.s, infox)
|
||||
|
||||
proc `$`*(suggest: Suggest): string =
|
||||
result = $suggest.section
|
||||
|
||||
7
nimsuggest/tests/tv3_import.nim
Normal file
7
nimsuggest/tests/tv3_import.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
import tv#[!]#3
|
||||
|
||||
discard """
|
||||
$nimsuggest --v3 --tester $file
|
||||
>def $1
|
||||
def skModule tv3 */tv3.nim 1 0 "" 100
|
||||
"""
|
||||
Reference in New Issue
Block a user