mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 00:16:57 +00:00
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.
This commit is contained in:
1 parent
97bc0980a2
commit
c74373e29a
2 files changed
+21
-19
No files matched your search
@@ -105,6 +105,7 @@ Status of the `main` branch. Changes prior to the next official version change w
|
||||
coverage-report output, but matched by bare dirname and so also hid legitimate source directories named
|
||||
`coverage` (e.g. `src/routes/coverage/`) from symbol tools. Generated report dirs are already covered by
|
||||
gitignore. Fixes #1523.
|
||||
- Fix: Restore `erlang` support (broken since v1.6.0 due to an implementation error)
|
||||
|
||||
* Tools:
|
||||
- Fix: `search_for_pattern` marked one line too many as matched whenever a match ended with a line
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import threading
|
||||
@@ -76,6 +75,25 @@ class ErlangLanguageServer(SolidLanguageServer):
|
||||
except (subprocess.SubprocessError, FileNotFoundError):
|
||||
return False
|
||||
|
||||
def _create_base_initialize_params(self) -> dict:
|
||||
"""
|
||||
Returns the base initialize params for Erlang LS.
|
||||
|
||||
processId, rootPath, rootUri, clientInfo and workspaceFolders are added by the builder.
|
||||
"""
|
||||
return {
|
||||
"capabilities": {
|
||||
"textDocument": {
|
||||
"synchronization": {"didSave": True},
|
||||
"completion": {"dynamicRegistration": True},
|
||||
"definition": {"dynamicRegistration": True},
|
||||
"references": {"dynamicRegistration": True},
|
||||
"documentSymbol": {"dynamicRegistration": True},
|
||||
"hover": {"dynamicRegistration": True},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
def _start_server(self) -> None:
|
||||
"""Start Erlang LS server process with proper initialization waiting."""
|
||||
|
||||
@@ -132,25 +150,8 @@ class ErlangLanguageServer(SolidLanguageServer):
|
||||
log.info("Starting Erlang LS server process")
|
||||
self.server.start()
|
||||
|
||||
# Send initialize request
|
||||
initialize_params = {
|
||||
"processId": None,
|
||||
"rootPath": self.repository_root_path,
|
||||
"rootUri": pathlib.Path(self.repository_root_path).as_uri(),
|
||||
"capabilities": {
|
||||
"textDocument": {
|
||||
"synchronization": {"didSave": True},
|
||||
"completion": {"dynamicRegistration": True},
|
||||
"definition": {"dynamicRegistration": True},
|
||||
"references": {"dynamicRegistration": True},
|
||||
"documentSymbol": {"dynamicRegistration": True},
|
||||
"hover": {"dynamicRegistration": True},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
log.info("Sending initialize request to Erlang LS")
|
||||
init_response = self.server.send.initialize(initialize_params) # type: ignore[arg-type]
|
||||
init_response = self.server.send.initialize(self._create_initialize_params())
|
||||
|
||||
# Verify server capabilities
|
||||
if "capabilities" in init_response:
|
||||
|
||||
Reference in new issue
Block a user