-
Notifications
You must be signed in to change notification settings - Fork 39
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first pass over the changes, with the largest focus being on code style.
@@ -489,7 +602,7 @@ proc executeCmd*(cmd: IdeCmd, file, dirtyfile: AbsoluteFile, line, col: int; | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Co-authored-by: zerbina <[email protected]>
Co-authored-by: zerbina <[email protected]>
Co-authored-by: zerbina <[email protected]>
Co-authored-by: zerbina <[email protected]>
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.} = 1 Here, |
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
outline
processing from proceduresuggestSym
, change toparser based processing
outline
the 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.nim
which used for old implementationthat require compiled included file.
nimsuggest/tests/toutline.nim
for testing new implementation.Notes for Reviewers