Skip to content

Add clangd prime file support#1374

Open
pikaro wants to merge 1 commit intooraios:mainfrom
pikaro:feature/clangd-prime-file
Open

Add clangd prime file support#1374
pikaro wants to merge 1 commit intooraios:mainfrom
pikaro:feature/clangd-prime-file

Conversation

@pikaro
Copy link
Copy Markdown

@pikaro pikaro commented Apr 18, 2026

  • Adds prime_file parameter to clangd configuration
  • Adds persistently open files to language server

Resolves #1373

Copy link
Copy Markdown
Contributor

@MischaPanch MischaPanch left a comment

Choose a reason for hiding this comment

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

Thanks! A test is failing due to the new changes

FAILED test/solidlsp/test_rename_didopen.py::test_request_rename_symbol_edit_opens_file_before_rename - AttributeError: 'DummyLanguageServer' object has no attribute '_persistently_open_file_uris'

Pls check whether this is also needed/useful for ccls

if not prime_files:
return
if not isinstance(prime_files, list):
raise TypeError("ls_specific_settings['cpp']['prime_files'] must be a list of relative file paths")
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.

use prime_files insteaf of accessing dict again

Comment thread src/solidlsp/ls.py
self._persistently_open_file_uris.add(uri)
return file_buffer

def close_file_persistently(self, relative_file_path: str | None = None, uri: str | None = None) -> None:
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.

I think persistently is a misnomer here. Rather, just close_file?

Also, both new methods should be private

``compile_commands.json`` if needed.
- clangd_version: Override the pinned Clangd version downloaded by Serena
(default: the bundled Serena version).
- prime_files: Translation units to keep open after startup in order to
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.

pls add an explanation to the docs in the corresponding section. Should this also be supported by ccls?

self.server_ready.wait()
self._prime_translation_units()

def _prime_translation_units(self) -> None:
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.

pls add a docstring on the what and why

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.

C++: clangd uses single-header TU resolution

2 participants