Skip to content

Commit 7970e11

Browse files
author
Ivan
committed
Implement _create_base_initialize_params for ErlangLanguageServer
ErlangLanguageServer was left behind when the initialize-params refactor moved server-specific capabilities into _create_base_initialize_params. It still built its initialize dict inline in _start_server, so the class never satisfied the abstract method declared on SolidLanguageServer and could not be instantiated at all: Can't instantiate abstract class ErlangLanguageServer without an implementation for abstract method '_create_base_initialize_params' Move the capabilities block into the required method, following the pattern used by the other backends, and let _start_server build its params via _create_initialize_params(). processId/rootPath/rootUri are dropped from the literal since the builder supplies them.
1 parent 97bc098 commit 7970e11

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

src/solidlsp/language_servers/erlang_language_server.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import logging
44
import os
5-
import pathlib
65
import shutil
76
import subprocess
87
import threading
@@ -76,6 +75,25 @@ def _check_rebar3_available(cls) -> bool:
7675
except (subprocess.SubprocessError, FileNotFoundError):
7776
return False
7877

78+
def _create_base_initialize_params(self) -> dict:
79+
"""
80+
Returns the base initialize params for Erlang LS.
81+
82+
processId, rootPath, rootUri, clientInfo and workspaceFolders are added by the builder.
83+
"""
84+
return {
85+
"capabilities": {
86+
"textDocument": {
87+
"synchronization": {"didSave": True},
88+
"completion": {"dynamicRegistration": True},
89+
"definition": {"dynamicRegistration": True},
90+
"references": {"dynamicRegistration": True},
91+
"documentSymbol": {"dynamicRegistration": True},
92+
"hover": {"dynamicRegistration": True},
93+
}
94+
},
95+
}
96+
7997
def _start_server(self) -> None:
8098
"""Start Erlang LS server process with proper initialization waiting."""
8199

@@ -132,25 +150,8 @@ def check_server_ready(params: dict) -> None:
132150
log.info("Starting Erlang LS server process")
133151
self.server.start()
134152

135-
# Send initialize request
136-
initialize_params = {
137-
"processId": None,
138-
"rootPath": self.repository_root_path,
139-
"rootUri": pathlib.Path(self.repository_root_path).as_uri(),
140-
"capabilities": {
141-
"textDocument": {
142-
"synchronization": {"didSave": True},
143-
"completion": {"dynamicRegistration": True},
144-
"definition": {"dynamicRegistration": True},
145-
"references": {"dynamicRegistration": True},
146-
"documentSymbol": {"dynamicRegistration": True},
147-
"hover": {"dynamicRegistration": True},
148-
}
149-
},
150-
}
151-
152153
log.info("Sending initialize request to Erlang LS")
153-
init_response = self.server.send.initialize(initialize_params) # type: ignore[arg-type]
154+
init_response = self.server.send.initialize(self._create_initialize_params())
154155

155156
# Verify server capabilities
156157
if "capabilities" in init_response:

0 commit comments

Comments
 (0)