Use module actual file instead of PSym.info (#19956)

After this you can do goto module from module import
This commit is contained in:
Ivan Yonchovski 2022-07-15 20:56:33 +03:00 • committed by GitHub
commit b0b9a3e5fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 12 deletions

View file

@ -157,19 +157,25 @@ proc symToSuggest*(g: ModuleGraph; s: PSym, isLocal: bool, section: IdeCmd, info
result.forth = "" result.forth = ""
when defined(nimsuggest) and not defined(noDocgen) and not defined(leanCompiler): when defined(nimsuggest) and not defined(noDocgen) and not defined(leanCompiler):
result.doc = extractDocComment(g, s) result.doc = extractDocComment(g, s)
let infox = if s.kind == skModule and s.ast.len != 0 and section != ideHighlight:
if useSuppliedInfo or section in {ideUse, ideHighlight, ideOutline}: result.filePath = toFullPath(g.config, s.ast[0].info)
info result.line = 1
else: result.column = 0
s.info result.tokenLen = 0
result.filePath = toFullPath(g.config, infox) else:
result.line = toLinenumber(infox) let infox =
result.column = toColumn(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.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 = proc `$`*(suggest: Suggest): string =
result = $suggest.section result = $suggest.section

View file

@ -0,0 +1,7 @@
import tv#[!]#3
discard """
$nimsuggest --v3 --tester $file
>def $1
def skModule tv3 */tv3.nim 1 0 "" 100
"""