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

[#98] Add SymbolTag values for access modifiers and other modifiers #2003

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 118 additions & 2 deletions _specifications/lsp/3.18/language/documentSymbol.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,127 @@ export namespace SymbolTag {

/**
* Render a symbol as obsolete, usually using a strike-out.
* @since 3.16
*/
export const Deprecated: 1 = 1;
export const Deprecated = 1;

/**
* Render a symbol with visibility / access modifier "private".
* @since 3.18
*/
export const Private = 2;

/**
* Render a symbol with visibility "package private", e.g. in Java.
* @since 3.18
*/
export const Package = 3;

/**
* Render a symbol with visibility / access modifier "protected".
* The modifier could be combined e.g. with "internal" or "private" in languages like C#.
* @since 3.18
*/
export const Protected = 4;

/**
* Render a symbol with visibility / access modifier "public".
* @since 3.18
*/
export const Public = 5;

/**
* Render a symbol with visibility / access modifier "internal", e.g. in C# or Kotlin.
* @since 3.18
*/
export const Internal= 6;

/**
* Render a symbol with visibility / access modifier "file", e.g. in C#.
* @since 3.18
*/
export const File = 7;

/**
* Render a symbol as "static".
* @since 3.18
*/
export const Static = 8;

/**
* Render a symbol as "abstract".
* @since 3.18
*/
export const Abstract = 9;

/**
* Render a symbol as "final".
* @since 3.18
*/
export const Final = 10;

/**
* Render a symbol as "sealed", e.g. classes and interfaces in Kotlin.
* @since 3.18
*/
export const Sealed = 11;

/**
* Render a symbol as "transient", e.g. in Java.
* @since 3.18
*/
export const Transient = 12;

/**
* Render a symbol as "volatile", e.g. in Java.
* @since 3.18
*/
export const Volatile = 13;

/**
* Render a symbol as "synchronized", e.g. in Java.
* @since 3.18
*/
export const Synchronized = 14;

/**
* Render a symbol as "virtual", e.g. in C++.
* @since 3.18
*/
export const Virtual = 15;

Choose a reason for hiding this comment

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

Const for C++ would be useful, too

Copy link
Author

Choose a reason for hiding this comment

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

I reconsidered a Const tag and I think we can use the ReadOnly tag for that purpose. Having both tags, Const and ReadOnly might be confusing since they mean the same in principle. Besides, I don't think, we should use many language-specific keywords as tags in LSP specification. Instead, we should describe the concepts behind them.


/**
* Render a symbol as "nullable", e.g. types with '?' in Kotlin.
* @since 3.18
*/
export const Nullable = 16;

/**
* Render a symbol as "never null", e.g. types without '?' in Kotlin.
* @since 3.18
*/
export const NonNull = 17;

/**
* Render a symbol as declaration.
* @since 3.18
*/
export const Declaration = 18;

/**
* Render a symbol as definition (in contrast to declaration), e.g. in header files in C++.
* @since 3.18
*/
export const Definition = 19;

/**
* Render a symbol as "read-only", i.e. variables / properties that cannot be changed.
* @since 3.18
*/
export const ReadOnly = 20;
}

export type SymbolTag = 1;
export type SymbolTag = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
```

<div class="anchorHolder"><a href="#documentSymbol" name="documentSymbol" class="linkableAnchor"></a></div>
Expand Down
117 changes: 116 additions & 1 deletion _specifications/lsp/3.18/metaModel/metaModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -14164,7 +14164,122 @@
{
"name": "Deprecated",
"value": 1,
"documentation": "Render a symbol as obsolete, usually using a strike-out."
"documentation": "Render a symbol as obsolete, usually using a strike-out.",
"since": "3.16"
},
{
"name": "Private",
"value": 2,
"documentation": "Render a symbol with visibility / access modifier \"private\".",
"since": "3.18"
},
{
"name": "Package",
"value": 3,
"documentation": "Render a symbol with visibility \"package private\", e.g. in Java.",
"since": "3.18"
},
{
"name": "Protected",
"value": 4,
"documentation": "Render a symbol with visibility / access modifier \"protected\". The modifier could be combined e.g. with \"internal\" or \"private\" in languages like C#.",
"since": "3.18"
},
{
"name": "Public",
"value": 5,
"documentation": "Render a symbol with visibility / access modifier \"public\".",
"since": "3.18"
},
{
"name": "Internal",
"value": 6,
"documentation": "Render a symbol with visibility / access modifier \"internal\", e.g. in C# or Kotlin.",
"since": "3.18"
},
{
"name": "File",
"value": 7,
"documentation": "Render a symbol with visibility / access modifier \"file\", e.g. in C#.",
"since": "3.18"
},
{
"name": "Static",
"value": 8,
"documentation": "Render a symbol as \"static\".",
"since": "3.18"
},
{
"name": "Abstract",
"value": 9,
"documentation": "Render a symbol as \"abstract\".",
"since": "3.18"
},
{
"name": "Final",
"value": 10,
"documentation": "Render a symbol as \"final\".",
"since": "3.18"
},
{
"name": "Sealed",
"value": 11,
"documentation": "Render a symbol as \"sealed\", e.g. classes and interfaces in Kotlin.",
"since": "3.18"
},
{
"name": "Transient",
"value": 12,
"documentation": "Render a symbol as \"transient\", e.g. in Java.",
"since": "3.18"
},
{
"name": "Volatile",
"value": 13,
"documentation": "Render a symbol as \"volatile\", e.g. in Java.",
"since": "3.18"
},
{
"name": "Synchronized",
"value": 14,
"documentation": "Render a symbol as \"synchronized\", e.g. in Java.",
"since": "3.18"
},
{
"name": "Virtual",
"value": 15,
"documentation": "Render a symbol as \"virtual\", e.g. in C++.",
"since": "3.18"
},
{
"name": "Nullable",
"value": 16,
"documentation": "Render a symbol as \"nullable\", e.g. types with '?' in Kotlin.",
"since": "3.18"
},
{
"name": "NonNull",
"value": 17,
"documentation": "Render a symbol as \"never null\", e.g. types without '?' in Kotlin.",
"since": "3.18"
},
{
"name": "Declaration",
"value": 18,
"documentation": "Render a symbol as declaration.",
"since": "3.18"
},
{
"name": "Definition",
"value": 19,
"documentation": "Render a symbol as definition (in contrast to declaration), e.g. in header files in C++.",
"since": "3.18"
},
{
"name": "ReadOnly",
"value": 20,
"documentation": "Render a symbol as \"read-only\", i.e. variables / properties that cannot be changed.",
"since": "3.18"
}
],
"documentation": "Symbol tags are extra annotations that tweak the rendering of a symbol.\n\n@since 3.16",
Expand Down