diff --git a/src/multilspy/language_server.py b/src/multilspy/language_server.py index 3845ba84..d797d132 100644 --- a/src/multilspy/language_server.py +++ b/src/multilspy/language_server.py @@ -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}. " diff --git a/src/multilspy/language_servers/gopls/gopls.py b/src/multilspy/language_servers/gopls/gopls.py index 73970cfd..f17ffcf8 100644 --- a/src/multilspy/language_servers/gopls/gopls.py +++ b/src/multilspy/language_servers/gopls/gopls.py @@ -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: