Multilspy: import, comment

This commit is contained in:
Michael Panchenko committed 2025-04-28 15:23:43 +02:00
1 parent 0a74937d90
commit 42fdb01d9a
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -32,6 +32,7 @@ from .lsp_protocol_handler import lsp_types as LSPTypes
from .lsp_protocol_handler.lsp_constants import LSPConstants
from .lsp_protocol_handler.lsp_types import SymbolKind
from .lsp_protocol_handler.server import (
Error,
LanguageServerHandler,
ProcessLaunchInfo,
)
@@ -614,7 +615,6 @@ class LanguageServer:
)
except Exception as e:
# Catch LSP internal error (-32603) and raise a more informative exception
from multilspy.lsp_protocol_handler.server import Error
if isinstance(e, Error) and getattr(e, 'code', None) == -32603:
raise RuntimeError(
f"LSP internal error (-32603) when requesting references for {relative_file_path}:{line}:{column}. "
@@ -161,7 +161,9 @@ class Gopls(LanguageServer):
) -> List[multilspy_types.Location]:
NUM_COLS_TO_TRY = 10
"""selectionRange in Gopls always return the wrong column,
the one at the beginnning of the declaration instead of the symbol. We do a dirty hack here."""
the one at the beginnning of the declaration instead of the symbol. We do a dirty hack here.
See https://github.com/golang/go/issues/73521
"""
actual_column = column
for actual_column in range(column, column+NUM_COLS_TO_TRY):
try: