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

add type function symbols to document symbol outline #448

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

ikrima
Copy link
Contributor

@ikrima ikrima commented Jan 12, 2022

Description

ZLS skips Type Functions when enumerating the document symbols. This leads to a lot of standard library files looking like this in the VSCode Document Outline:
image

With the PR, it looks like:
image
Go To Document Symbol also works:
image

Change

Recurse into functions if they are a type function

Questions

I'm not too familiar with VSCode extensions or the ZLS codebase. I ran the tests and did some sanity manual testing but please review accordingly

  • getDocumentSymbolsInternal: from looking at the code + cross referencing VSCode Api, looks like its just used to enumerate document symbols (call tree: documentSymbol()->getDocumentSymbols()->getDocumentSymbolsInternal())
    • sanity check: are there any other places this modification needs to be propogated?
    • sanity check: specifically so that symbol resolve/rename/goto def/etc aren't broken?
  • error handling: unsure what the pre/post conditions are of the parse tree when getDocumentSymbolsInternal is invoked
    so there might be superflous guards/checks
  • any tests to add?

Questions:
- `getDocumentSymbolsInternal`: from looking at the code + cross referencing VSCode Api, looks like its just used to enumerate document symbols
  (call tree: `documentSymbol()->getDocumentSymbols()->getDocumentSymbolsInternal()`)
  - sanity check: are there any other places this modification needs to be propogated?
  - sanity check: specifically so that symbol resolve/rename/goto def/etc aren't broken?
- error handling: unsure what the pre/post conditions are of the parse tree when `getDocumentSymbolsInternal` is invoked
  so there might be superflous guards/checks
- any tests to add?
@SuperAuguste
Copy link
Member

LGTM, but I'll have to manually check later when I'm available :)

@SuperAuguste
Copy link
Member

I don't believe anything else needs to be added / modified. Thanks!

@SuperAuguste SuperAuguste merged commit fefabc6 into zigtools:master Jan 13, 2022
@ikrima ikrima deleted the add-typefunc-outline-nodes branch January 21, 2022 15:06
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.

2 participants