Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[superseded] nimsuggest: fix nimsuggest#96 ; nimsuggest can handle files not yet known #9715

Closed

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Nov 14, 2018

/cc @PMunch @Araq @krux02

There is some support so that you can throw random .nim files which are not part of myproject at Nimsuggest too, but usually the query refer to modules/files that are part of myproject.

this wasn't true until this PR
it's a very useful feature that allows you to handle nim files not covered by your initial project.nim

@timotheecour
Copy link
Member Author

timotheecour commented Nov 15, 2018

EDIT:

although it works in a number of cases (handling files not yet known) it fails in this example:

/Users/timothee/git_clone/nim/timn/build/temp/nimsuggest --stdin /Users/timothee/git_clone/nim/Nim/lib/system.nim
def /Users/timothee/git_clone/nim/Nim/lib/system.nim:106:22
def /Users/timothee/git_clone/nim/Nim/compiler/modules.nim:69:63

will crash with:

> def /Users/timothee/git_clone/nim/Nim/lib/system.nim:106:22
def     skType  system.SomeInteger      SomeInteger     /Users/timothee/git_clone/nim/Nim/lib/system.nim        96      2       "type class matching all integer types" 100

> def /Users/timothee/git_clone/nim/Nim/compiler/modules.nim:69:63
/Users/timothee/git_clone/nim/timn/src/timn/adapted/nimsuggest.nim(636) nimsuggest
/Users/timothee/git_clone/nim/timn/src/timn/adapted/nimsuggest.nim(634) handleCmdLine
/Users/timothee/git_clone/nim/Nim/compiler/cmdlinehelper.nim(91) loadConfigsAndRunMainCommand
/Users/timothee/git_clone/nim/timn/src/timn/adapted/nimsuggest.nim(552) mainCommand
/Users/timothee/git_clone/nim/timn/src/timn/adapted/nimsuggest.nim(506) mainThread
/Users/timothee/git_clone/nim/timn/src/timn/adapted/nimsuggest.nim(481) execCmd
/Users/timothee/git_clone/nim/timn/src/timn/adapted/nimsuggest.nim(201) execute
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(126) compileProject
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(197) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2570) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(211) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(181) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(153) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(84) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(200) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2570) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(211) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(181) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(153) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(84) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(197) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2570) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(211) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(181) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(153) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(84) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(200) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2570) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(211) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(181) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(153) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(84) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(197) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2570) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(211) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(181) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(153) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(84) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(197) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2570) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(211) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(181) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(153) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(84) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(71) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(194) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(608) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(571) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2537) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1926) semStmtList
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2579) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1847) evalInclude
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1985) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(913) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2537) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(1926) semStmtList
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2461) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2095) semWhen
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(353) semConstExpr
/Users/timothee/git_clone/nim/Nim/compiler/vm.nim(1897) evalConstExpr
/Users/timothee/git_clone/nim/Nim/compiler/vm.nim(1893) evalConstExprAux
/Users/timothee/git_clone/nim/Nim/compiler/vm.nim(1544) rawExecute
/Users/timothee/git_clone/nim/Nim/lib/system.nim(2976) sysFatal
Error: unhandled exception: node is not accessible [FieldError]

/cc @Araq ; closing in favor of the more robust #9721 but still curious:
it's too bad as it was a fast way to refresh the index without recompiling everything; is there any way to avoid the above error?

=> followed up here: https://github.com/nim-lang/Nim/issues/9775

@timotheecour timotheecour changed the title nimsuggest: fix nimsuggest#96 ; nimsuggest can handle files not yet known [superseded] nimsuggest: fix nimsuggest#96 ; nimsuggest can handle files not yet known Nov 15, 2018
@timotheecour
Copy link
Member Author

=> revived here #9757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

project file update doesn't work
1 participant