Skip to content

Respect .clangd CompilationDatabase configuration #1816

Open
@ADKaster

Description

@ADKaster

Description

SourceKit-LSP does not search in the relative path provided by the clangd config file's CompilationDatabase configuration.

https://clangd.llvm.org/config#compilationdatabase

Example .clangd:

CompileFlags:
  CompilationDatabase: Build/release

Diagnostics:
  UnusedIncludes: None
  MissingIncludes: None

Given only this configuration, clangd finds my compile_commands.json in Build/release relative to the project root.

SourceKit-LSP only finds my compile_commands json after creating a symlink to the project root.

Here's the log from the Swift tab of VsCode's Output window:

13:58:42: Swift version 6.1-dev (LLVM cdc8e8b92cfb482, Swift fc03688e63434e8)
Swift Path: /home/andrew/.local/share/swiftly/toolchains/main-snapshot-2024-09-18/usr/bin
Toolchain Path: /home/andrew/.local/share/swiftly/toolchains/main-snapshot-2024-09-18/usr
Runtime Library Path: /home/andrew/.local/share/swiftly/toolchains/main-snapshot-2024-09-18/usr/lib/swift/linux
Default Target: x86_64-unknown-linux-gnu
13:58:42: SourceKit-LSP setup
13:58:42: focus: undefined
14:36:48: unfocus: undefined
14:36:49: ladybird-browser: add: /home/andrew/ladybird-org/ladybird-browser
14:36:49: ladybird-browser: focus: /home/andrew/ladybird-org/ladybird-browser

At 14:36:49 I added the symlink ln -s Build/release/compile_commands.json compile_commands.json, and SourceKit-LSP immediately picked it up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions