Document the new LSP initialization pattern in the "adding new language
support" memory: override _create_base_initialize_params (server-specific
keys only), let the InitializeParamsBuilder supply the common keys, and call
_create_initialize_params() in _start_server. Includes notes on
builder-resolved workspace folders, nested initializationOptions folder
lists, and opting out via set_workspace_folders=False.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert every remaining SolidLanguageServer subclass from the old
_get_initialize_params method to the new _create_base_initialize_params
override, so common LSP initialize keys (processId, rootPath, rootUri,
clientInfo, workspaceFolders) are provided centrally by the
InitializeParamsBuilder rather than by each server.
- Drop the per-server processId/rootPath/rootUri/workspaceFolders and all
clientInfo entries (including the VS Code spoofs in rust_analyzer and
sourcekit); these are now set centrally.
- Preserve nested capabilities.workspace.workspaceFolders flags and any
server-specific initializationOptions.workspaceFolders (e.g. kotlin,
eclipse_jdtls).
- omnisharp keeps loading its JSON template but no longer sets the
centrally-managed keys.
- Update _start_server call sites to self._create_initialize_params() and
drop now-unnecessary cast()/type: ignore wrappers.
angular, svelte and vue are intentionally left as-is: they already override
_create_base_initialize_params for their TypeScript companion server, and
their remaining _get_initialize_params drives a separate language server
process.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
that use the newly introduced InitializeParamsBuilder
- Add new configuration option `ls_workspace_folders` to allow indexed source folders to be specified
explicitly. In monorepos, this allows the set of indexed folders to be restricted to a subset of
the repository. #1627
- Rename configuration option `additional_workspace_folders` to `ls_additional_workspace_folders`
and support the option across all language servers that use an InitializeParamsBuilder
(previously limited strictly to the TypeScript server).
Moved the option from SolidLSPSettings to LanguageServerConfig, where it belongs.
Apply InitializeParamsBuilder in TypeScriptLanguageServer and its subclasses.
which sets common settings centrally:
- processId
- rootPath
- rootUri
- clientInfo
- workspaceFolders
Apply builder in SolidLanguageServer, adding new abstract method
_create_base_initialize_params to be implemented by subclasses.
Applied in PyrightServer.
determine_programming_language_composition computed percentages over the total
file count, so files belonging to no supported language (images, plain text,
licenses, lock files) diluted the numbers — a repository with 2 Python files
and 23 assets reported Python at 8%. Percentages are now relative to files
matching at least one supported language, and the counting runs in a single
pass over the file list instead of one pass per language.
The only consumer (ProjectConfig.autogenerate) sorts languages by percentage,
which is unaffected by the uniform rescaling.
ls_base_cmd allows the user to override the base command with a
multi-element command (e.g. ["npx", "-y", "/my/local/package"]),
generalising ls_path, which it takes precedence over.
Generalises launch command creation from a base command which
the user can override via custom settings.
SinglePath and Uvx dependency providers are now specialisations of it;
the uvx command construction was moved from common.py into the Uvx provider.
The language support guide memory is updated accordingly.
Wrap os.scandir() with PermissionError guard in _iter_gitignore_files'
scan() function to prevent crash when a subdirectory is not readable.
Previously, PermissionError on the scandir call itself crashed the
entire gitignore walker, even when the path was listed in ignored_paths.
Fixesoraios/serena#1624
Co-authored-by: Claude <noreply@anthropic.com>
Add activation_command to project config
Adds two optional fields to ProjectConfig:
- activation_command: shell command run in the project root before the
language backend (LSP or JetBrains) initialises
- activation_command_timeout: safety backstop (default 180s); on expiry
the process tree is killed and activation continues
The command is only executed for trusted projects (trusted_project_path_patterns).
Exit code is the primary completion signal; failures and timeouts are logged
but never abort activation (no return channel to the LLM at that point).
Closes#1606
---------
Co-authored-by: Dominik Jain <dominik.jain@oraios-ai.de>
* Introduce abstractions: FileCollection, FileProxy
* Unify handling of pattern search in project files
(source code vs. all files)
This prepares for processing of external files,
which can implement FileProxy differently.
A plain truncate-and-write (open(path,"w")) is not atomic: a concurrent writer
(a second Serena process updating the auto-managed registered-projects list) or an
interrupted write can leave the file half-overwritten -- a shorter value over a longer
one leaves a stale tail, corrupting the YAML so every later load fails. This is what
wedged native benchmark runs (serena MCP crashed at startup with a ruamel ScannerError
-> 0 tools registered -> agent silently degraded to Bash).
Write to a temp file in the same dir, then os.replace onto the target (atomic;
last-writer-wins, never a corrupt interleave). Retry os.replace on Windows
PermissionError (WinError 5/32 sharing violation under contention). Adds
test/serena/util/test_yaml.py covering the shorter-over-longer corruption signature
plus a concurrent-writers stress.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Render the system prompt without activating a project: `project` is now an
optional positional (default None -> project-independent prompt). Drop the
--log-level option / logging.configure call so CLI logging stays off and only
the prompt reaches stdout, and remove two stray debug print()s
(default_modes/base_modes) that leaked onto stdout. IDE autostart is already
disabled here via with_headless_mode_overrides() (it nulls
jetbrains_launch_command). Also drop an accidental unused sqlalchemy import.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>