Removed duplicated SymbolKind definition

Adjusted comment in autogenerated code, which from now on will be maintained manually
This commit is contained in:
Michael Panchenko committed 2026-03-23 11:07:53 +01:00
1 parent 4f0863dec5
commit 01bbf7254e
2 files changed
+15 -69

No files matched your search

+6 -39
View File
@@ -7,13 +7,18 @@ from __future__ import annotations
from enum import Enum, IntEnum
from typing import TYPE_CHECKING, NotRequired, Union
from sensai.util.helper import mark_used
from typing_extensions import TypedDict
from solidlsp.lsp_protocol_handler.lsp_types import DiagnosticSeverity
from solidlsp.lsp_protocol_handler.lsp_types import DiagnosticSeverity, SymbolKind
if TYPE_CHECKING:
from .ls import SymbolBody
# a lot of code relied on a previously duplicated SymbolKind definition here.
# This line is kept to avoid breaking downstream imports
mark_used(SymbolKind)
URI = str
DocumentUri = str
@@ -147,44 +152,6 @@ class CompletionItem(TypedDict):
about this item, like type or symbol information. """
class SymbolKind(IntEnum):
"""A symbol kind."""
# TODO: This is a duplicate of SymbolKind in lsp_types.
Unknown = 0
File = 1
Module = 2
Namespace = 3
Package = 4
Class = 5
Method = 6
Property = 7
Field = 8
Constructor = 9
Enum = 10
Interface = 11
Function = 12
Variable = 13
Constant = 14
String = 15
Number = 16
Boolean = 17
Array = 18
Object = 19
Key = 20
Null = 21
EnumMember = 22
Struct = 23
Event = 24
Operator = 25
TypeParameter = 26
@classmethod
def _missing_(cls, value: int) -> "SymbolKind":
return cls.Unknown
class SymbolTag(IntEnum):
"""Symbol tags are extra annotations that tweak the rendering of a symbol.
+9 -30
View File
@@ -1,32 +1,12 @@
# Code generated. DO NOT EDIT.
# The code in this module is mostly autogenerated using https://github.com/predragnikolic/OLSP
# To update it for higher LSP versions, autogenerate a new version in a different file and merge manually.
# LSP v3.17.0
# TODO: Look into use of https://pypi.org/project/ts2python/ to generate the types for https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
# Note by author of the autogenerator: Look into use of https://pypi.org/project/ts2python/ to generate the types f
# or https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
"""
This file provides the Python types corresponding to the Typescript types defined in the language server protocol.
This file is obtained from https://github.com/predragnikolic/OLSP under the MIT License with the following terms:
MIT License
Copyright (c) 2023 Предраг Николић
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from enum import Enum, IntEnum, IntFlag
@@ -166,6 +146,8 @@ class FoldingRangeKind(Enum):
class SymbolKind(IntEnum):
"""A symbol kind."""
Unknown = 0
"""Not an LSP type, we use it to represent symbols that don't have a known kind."""
File = 1
Module = 2
Namespace = 3
@@ -197,11 +179,8 @@ class SymbolKind(IntEnum):
TypeParameter = 26
@classmethod
def from_int(cls, value: int) -> "SymbolKind":
for symbol_kind in cls:
if symbol_kind.value == value:
return symbol_kind
raise ValueError(f"Invalid symbol kind: {value}")
def _missing_(cls, value: int) -> "SymbolKind":
return cls.Unknown
class SymbolTag(IntEnum):