Skip to content

fix: make ErlangLanguageServer instantiable (implement _create_base_initialize_params) - #1794

Merged
opcode81 merged 1 commit into
oraios:mainfrom
ibakard:fix/erlang-initialize-params
Aug 1, 2026
Merged

fix: make ErlangLanguageServer instantiable (implement _create_base_initialize_params)#1794
opcode81 merged 1 commit into
oraios:mainfrom
ibakard:fix/erlang-initialize-params

Conversation

@ibakard

@ibakard ibakard commented Aug 1, 2026

Copy link
Copy Markdown

Problem

ErlangLanguageServer cannot be instantiated at all. Every Serena tool fails on an Erlang project during project initialisation:

The language server manager is not initialized, indicating a problem during project initialisation.
Failed to start 1 language server(s):
erlang: Can't instantiate abstract class ErlangLanguageServer without an implementation
for abstract method '_create_base_initialize_params'

Because the failure is at initialisation, it takes down every tool, not just the one called — get_symbols_overview, find_symbol, find_referencing_symbols and the editing tools all fail identically.

Cause

When server-specific initialize params were moved behind the abstract _create_base_initialize_params hook on SolidLanguageServer (ls.py), the Erlang backend was not converted with the others. It still builds its initialize dict inline inside _start_server and passes it straight to self.server.send.initialize(...), so it never implements the abstract method and the class is left abstract.

This is not environment-specific: it reproduces with erlang_ls correctly installed and on PATH, on current main.

Fix

Convert the backend to the same pattern the other language servers use (compare ocaml_lsp_server.py):

  • Move the capabilities block out of _start_server into _create_base_initialize_params.
  • Drop processId / rootPath / rootUri from the literal — DefaultInitializeParamsBuilder supplies those, and the method's docstring explicitly says implementations should not set them.
  • Have _start_server build its params via self._create_initialize_params().
  • Remove the now-unused pathlib import.

No behavioural change beyond making the class instantiable; the capabilities advertised to erlang_ls are the same ones the inline dict sent. The # type: ignore[arg-type] on the initialize call is no longer needed, since _create_initialize_params() returns a properly typed InitializeParams.

Verification

Against a real rebar3 umbrella project (~12 OTP applications), with erlang_ls on PATH:

  • ErlangLanguageServer.__abstractmethods__ is now empty — the class instantiates.
  • get_symbols_overview on a 700-line module returns its functions, records and macros.
  • find_referencing_symbols on a record returns 26 cross-references with correct locations and snippets.

Note on erlang_ls vs ELP

erlang_ls was archived on 2025-08-15, and #771 tracks moving to ELP; #1149 attempted that and was closed over a branch/CI problem rather than on the merits. This PR takes no position on that migration — it only makes the Erlang backend that currently ships actually usable. If ELP support lands later, this file is likely replaced wholesale, but until then the shipped backend is 100% non-functional and this is a small fix.

@AmirF194 AmirF194 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONTRIBUTING.md asks for a CHANGELOG.md entry on every PR (under "Submitting Pull Requests"), and every recently merged PR here has one (#1779, #1763, #1759, #1758, #1754). This one doesn't yet; probably belongs under "Language Servers".

The fix itself checks out. _create_base_initialize_params matches the pattern ocaml_lsp_server.py and the other converted backends use, and SolidLanguageServer._create_initialize_params() (ls.py:3193) already supplies processId/rootUri/clientInfo/workspaceFolders through the builder, so dropping them from the literal here is correct rather than a behavior change.

@opcode81

opcode81 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution. It's a shame that ty did not detect this. IDEA does:
image

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.
@opcode81
opcode81 force-pushed the fix/erlang-initialize-params branch from 7970e11 to c94d9c6 Compare August 1, 2026 09:41
@opcode81
opcode81 merged commit c74373e into oraios:main Aug 1, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants