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

feat: support document symbols requests in lsp #115

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MaartenStaa
Copy link
Contributor

@MaartenStaa MaartenStaa commented Mar 12, 2024

This allows requesting a list/tree of symbols in the current document. The following items are currently exposed:

  • load statements:
    • The module path
    • The loaded symbol names
  • def statements:
    • The function node
    • Argument names
  • Closures, when assigned to a named variable
  • Structs (calls to struct), when assigned to a named variable
  • Build system targets (function calls containing a name argument)

Example from starlark_syntax/testcases/parse/android_sdk_repository_template.star:

Screenshot 2024-03-12 at 14 37 51

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 12, 2024
@MaartenStaa MaartenStaa force-pushed the add-document-symbols branch from 28bbf76 to c05fce3 Compare March 12, 2024 14:05
This allows requesting a list/tree of symbols in the current document.
The following items are currently exposed:

- `load` statements:
    - The module path
    - The loaded symbol names
- `def` statements:
    - The function node
    - Argument names
- Closures, when assigned to a named variable
- Structs (calls to `struct`), when assigned to a named variable
- Build system targets (function calls containing a `name` argument)
vec![
#[allow(deprecated)]
DocumentSymbol {
name: "foo.star".to_owned(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not very good test: it is not readable, and modifying this test would be very hard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, just pushed a commit to make the test much more readable and maintainable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants