suggest: refactoring outline to parser based - #919
Conversation
|
Your PR messages are very much improving, good work! Two comments that I have without having looked at the changes yet:
|
outline to parser based
|
the |
zerbina
left a comment
There was a problem hiding this comment.
I did a first pass over the changes, with the largest focus being on code style.
| if dirtyfile.isEmpty: msgs.setDirtyFile(conf, dirtyIdx, AbsoluteFile"") | ||
| else: msgs.setDirtyFile(conf, dirtyIdx, dirtyfile) | ||
|
|
||
| if cmd == ideOutline: return |
There was a problem hiding this comment.
I think it'd be better if the logic above is moved into a separate procedure (e.g., markDirtyFile), with executeCmd only being called if cmd is not ideOutline.
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
It needs to be clear what changes. You disabled the There's also missing a reason/motivation as to why the outline command is changed. That is, elaboration is missing on why Regarding the |
|
Please also make sure that the code is documented. At least the routines, types, and constants should have a documentation comment attached. |
see the current LSP server screenshot, the vscode style the deprecated symbol through line |
outline to parser basedoutline to parser based
|
I was rather tired yesterday, and thus my comments and review were only focused on surface-level details, apologies. The direction this PR takes is, in my opinion, wrong. I agree that outlining should only report the symbols as they appear in the document (so no symbol coming from After parsing, you only have identifiers, and trying to guess/approximate what symbols will result from them is cannot work reliably, especially with the amount of meta-programming on definitions that NimSkull allows for. Phrased differently: I think that the AST-based processing needs to stay. In
I agree with the first half of your statement, but having result be produced faster is of little use when the results are incorrect.
I strongly agree that outlining should report whether a symbol is marked as deprecated. However, as I said, it's only possible to know which entities are deprecated once you have access to symbols (through looking for the Approximating this by looking for For example: template drop() =
discard
var def {.deprecated, drop.} = 1Here, |
|
fair enough, even the example code rarely seen. don't know by what use case the user want to rewrite the pragms |
In the end, it's only relevant whether something is allowed by the language. Also, while changing pragmas post-declaration might be rarely used (if ever), dropping a definition by way of a template/macro is a realistic use case. In addition, to name a few more cases, a parser-based solution cannot support:
|

Summary
outlineprocessing from proceduresuggestSym, change toparser based processing
outlinethe document, not compiled AST.Details
proc outline*(graph: ModuleGraph; fileIdx: FileIndex)processingfull document.
flags*: set[SuggestFlag]field toSuggest, allow mark symbol asdeprecated.
nimsuggest/tests/tinclude.nimwhich used for old implementationthat require compiled included file.
nimsuggest/tests/toutline.nimfor testing new implementation.Notes for Reviewers