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

LSP: Add Document Symbol support #3252

Closed
leonqadirie opened this issue Jun 8, 2024 · 3 comments · Fixed by #3275
Closed

LSP: Add Document Symbol support #3252

leonqadirie opened this issue Jun 8, 2024 · 3 comments · Fixed by #3275
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:medium
Milestone

Comments

@leonqadirie
Copy link

leonqadirie commented Jun 8, 2024

Suggestion: Add LSP support for Document Symbols.

From the LSP spec:

They represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, e.g. the range of an identifier.

They provide a (subjectively) great way to quickly conceptualise/grasp and navigate code in editors that support them. An example of a buffer's Document Symbols in Rust is attached.

LSP Document Symbols - Example

@lpil
Copy link
Member

lpil commented Jun 12, 2024

Oooh very nice! Sounds like it should be straightforward to add too.

@lpil lpil added help wanted Contributions encouraged good first issue Good for newcomers priority:medium labels Jun 12, 2024
@lpil lpil added this to the LS03 milestone Jun 12, 2024
@PgBiel
Copy link
Contributor

PgBiel commented Jun 13, 2024

Working on it!

image

By the way, it seems that Zed already supports this feature for Gleam out of the box, but this will still matter for VSCode and (potentially) other editors.

@leonqadirie
Copy link
Author

Very nice, thank you!

Zed added support in this PR, without diving into the code I suspect they use Gleam's tree-sitter to implement the symbol view. It definitely matters for other editors!

@lpil lpil modified the milestones: LS03, LS04 Jul 22, 2024
@lpil lpil modified the milestones: LS04, LS03 Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:medium
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants