Skip to content

feat(solidlsp): add ls_args and ls_extra_args for custom LS launch command#1267

Open
arikon wants to merge 1 commit intooraios:mainfrom
arikon:feature/ls-args-ls-extra-args
Open

feat(solidlsp): add ls_args and ls_extra_args for custom LS launch command#1267
arikon wants to merge 1 commit intooraios:mainfrom
arikon:feature/ls-args-ls-extra-args

Conversation

@arikon
Copy link
Copy Markdown
Contributor

@arikon arikon commented Apr 1, 2026

Summary

  • ls_extra_args — extra arguments appended to the default language server launch command (e.g. ["--query-driver=/usr/bin/arm-none-eabi-gcc"])
  • ls_args — fully replaces default arguments; only the executable path is kept (e.g. ["--log=verbose"])
  • Both options work via ls_specific_settings in .serena/project.yml and apply to all language servers using LanguageServerDependencyProviderSinglePath
  • Documented new options in ClangdLanguageServer docstring as an example

Example config

ls_specific_settings:
  cpp:
    ls_extra_args:
      - "--query-driver=/usr/bin/arm-none-eabi-gcc"

@opcode81 opcode81 force-pushed the main branch 3 times, most recently from 089706c to 0e22958 Compare April 4, 2026 18:20
@arikon
Copy link
Copy Markdown
Contributor Author

arikon commented Apr 5, 2026

@opcode81 Could you have a look on this, please?

…encyProviderSinglePath

- ls_extra_args appends to the default launch command args
- ls_args fully replaces the default args (executable path is always kept)
- Documented new options in ClangdLanguageServer docstring
- Added unit tests for all combinations in test_cpp_dependency_provider.py
@arikon arikon force-pushed the feature/ls-args-ls-extra-args branch from 00e5f09 to 5bafde5 Compare April 5, 2026 07:39
@arikon
Copy link
Copy Markdown
Contributor Author

arikon commented Apr 5, 2026

Rebased on main

@MischaPanch
Copy link
Copy Markdown
Contributor

@arikon This is less innocent than it might first seem. The additional launch commands may require an invalidation of the symbols cache. Could you explain which problem you ran into that required this? Maybe it would be sufficient to just extend a single LS implementation before extending the config.

Extending the config like proposed here is a decision that we can't take back once released, so we have to properly think about this and we didn't have time to do so yet

@arikon
Copy link
Copy Markdown
Contributor Author

arikon commented Apr 6, 2026

@MischaPanch I'm running clangd из VSCode with such config and a bunch of .clangd files through the tree of my monorepo:

{
        "clangd.arguments": [
            "--enable-config",
            "--header-insertion=never",
            "--log=info",
            "--pretty",
            "-j=6",
            "--clang-tidy",
            "--query-driver=/Users/arikon/.ya/tools/v4/10234711056/bin/arm-none-eabi-g++,/Users/arikon/.ya/tools/v4/10234711056/bin/arm-none-eabi-gcc,/Users/arikon/.ya/tools/v4/10492063598/bin/clang,/Users/arikon/.ya/tools/v4/10492063598/bin/clang++,/Users/arikon/.ya/tools/v4/10592126941/riscv32-esp-elf/bin/riscv32-esp-elf-g++,/Users/arikon/.ya/tools/v4/10592126941/riscv32-esp-elf/bin/riscv32-esp-elf-gcc",
            "--all-scopes-completion"
        ]
}

.clangd in the root of monorepo looks like this:

Index:
  Background: Skip
---

If:
  PathMatch: smart_devices/libs/iot_cloud_sdk/.*
CompileFlags:
  CompilationDatabase: /Users/arikon/ws/vscode/iot_cloud_sdk/compile-commands/default/host
  Add:
    # Workaround: https://github.com/llvm/llvm-project/issues/189288
    - -isystem
    - /Users/arikon/.ya/tools/v4/9996985259/lib/clang/20/include

---

If:
  PathMatch:
    - smart_devices/libs/iot_cloud_sdk/platform/beken/.*
    - smart_devices/third_party/beken_freertos_sdk/.*
    - smart_devices/third_party/freertos/kernel/.*
    - smart_devices/third_party/lwip/.*
CompileFlags:
  CompilationDatabase: /Users/arikon/ws/vscode/iot_cloud_sdk/compile-commands/default/bk7238
  Remove:
    - -mthumb-interwork
    - -mabi=*
    - -mno-sched-prolog
  Add:
    - -Wno-unknown-attributes

---

If:
  PathMatch:
    - smart_devices/libs/iot_cloud_sdk/platform/esp32/.*
    - smart_devices/third_party/espressif/esp-idf/5.4
    - smart_devices/third_party/espressif/esp-idf-aux/5.4
CompileFlags:
  CompilationDatabase: /Users/arikon/ws/vscode/iot_cloud_sdk/compile-commands/default/esp32-esp-idf-5-4
  Add:
    - -Wno-unknown-attributes

The project is — multiplatfrom embedded SDK, so I need to tune clangd like this to make its LSP provide me with correct diagnostics.

I want that clangd ran by Serena will work exactly like clangd in VSCode.

So I need to provide minimun this bunch of args to Serena's clangd:

--enable-config
--clang-tidy
--query-driver=/Users/arikon/.ya/tools/v4/10234711056/bin/arm-none-eabi-g++,/Users/arikon/.ya/tools/v4/10234711056/bin/arm-none-eabi-gcc,/Users/arikon/.ya/tools/v4/10492063598/bin/clang,/Users/arikon/.ya/tools/v4/10492063598/bin/clang++,/Users/arikon/.ya/tools/v4/10592126941/riscv32-esp-elf/bin/riscv32-esp-elf-g++,/Users/arikon/.ya/tools/v4/10592126941/riscv32-esp-elf/bin/riscv32-esp-elf-gcc

@MischaPanch
Copy link
Copy Markdown
Contributor

MischaPanch commented Apr 6, 2026

clangd like this to make its LSP provide me with correct diagnostics.

Serena doesn't even offer any diagnostics tools now, I don't understand what practically changes for you if Serena runs its current clangd command instead of a customized version. Do you not get proper symbol resolution or are there any problems with performance? Why does it matter if the clangd session that Serena uses doesn't have the exact same parametrization as the one you use in VSC?

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.

2 participants