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 SymbolInformation.display_name #158

Merged
merged 2 commits into from
May 25, 2023
Merged

Add SymbolInformation.display_name #158

merged 2 commits into from
May 25, 2023

Conversation

olafurpg
Copy link
Member

Towards #154

Previously, there was no reliable way to get the name of a symbol. You could parse it from the symbol descriptor but that only worked for global symbols (not locals) and was error-prone when the indexer chooses to a special encoding in the symbol for some reason (for example, all-lowercase because symbols are case-insensitive).

Now, clients can use SymbolInformation.display_name to reliably get the name of a symbol to render in API docs or some other application.

Test plan

Green CI.

Towards #154

Previously, there was no reliable way to get the name of a symbol. You
could parse it from the symbol descriptor but that only worked for
global symbols (not locals) and was error-prone when the indexer chooses
to a special encoding in the symbol for some reason (for example,
all-lowercase because symbols are case-insensitive).

Now, clients can use `SymbolInformation.display_name` to reliably get
the name of a symbol to render in API docs or some other application.
@olafurpg
Copy link
Member Author

cc/ @donsbot I'd love your input here.

@donsbot
Copy link
Contributor

donsbot commented May 25, 2023

Main things I'd check:

  • it will almost always be the 'local identifier' (without qualified scope stuff). E.g. a::b::c::foo() might be the fully qualified name, but the local name is "foo"

Breaking it out like this makes it amenable to search. I might want to find the symbol with queries like:

foo
::foo
c::foo

which would be interpreted as matching any identifier foo in the code, or only foo inside parent c.

@olafurpg
Copy link
Member Author

@donsbot good point. I updated the docstring to add an example to make it clear that the display name should not contain the fully-qualified scope.

@olafurpg olafurpg merged commit c781a12 into main May 25, 2023
@olafurpg olafurpg deleted the olafurpg/display_name branch May 25, 2023 06:12
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.

3 participants