microsoft / microsoft/language-server-protocol

Add visibility to SymbolInformation

Open
#98 22 comments 19 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

document symbols feature-request workspace symbols
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

I propose an addition to SymbolInformation that allows an LS to report the visibility (private, protected, public) to the client:

interface SymbolInformation {
  visibility?: Visibility;
}
enum Visibility {
  Private = 1,
  Protected = 2,
  Public = 3
}

A client can choose how he uses that information:

  • it could display an icon that indicates a symbol is private
  • after getting a list of symbols, it could allow the user to hide/show only public symbols

The same property could get added to CompletionItem.

I think private, protected and public should cover all languages, or are there more modifiers in some languages?

The enum should be structured to allow something like

if (symbol.visibility >= Visibility.Protected) {
  // symbol is at least protected or public
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SymbolInformation proposal in issue #98 and compare it with the suggested CompletionItem extension. Resolve whether the visibility enum covers the languages represented by the protocol and define the compatibility and ordering expectations before identifying the relevant protocol definitions and tests. Done means the design is agreed and both affected types are specified consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.