Skip to content

Unable to configure extension on NixOS #988

Open
@thomaseizinger

Description

@thomaseizinger

Describe the bug

I am trying to configure this extension in NixOS. I am setting swift.path to a directory that has two symlinks:

  • swift to the swift binary
  • sourcekit-lsp to the sourcekit-lsp binary
❯ ls -la /nix/store/kqv3ydcl2awcsgirb85dz3ab4amd1f00-swift-vscode-env/bin
lrwxrwxrwx - root  1 Jan  1970 sourcekit-lsp -> /nix/store/kzfcyfl7s82744xhhh1j4gwlhyn0ihwn-sourcekit-lsp-5.8/bin/sourcekit-lsp
lrwxrwxrwx - root  1 Jan  1970 swift -> /nix/store/jlpi1wiiqknd9jdqlwvi330j89wjy6b4-swift-wrapper-5.8/bin/swift

Despite these things being in place, the extension tries to start the sourcekit-lsp binary from the wrong directory:

[Error - 15:19:02] SourceKit Language Server client: couldn't create connection to server.
Launching server using command /nix/store/jlpi1wiiqknd9jdqlwvi330j89wjy6b4-swift-wrapper-5.8/bin/sourcekit-lsp failed. Error: spawn /nix/store/jlpi1wiiqknd9jdqlwvi330j89wjy6b4-swift-wrapper-5.8/bin/sourcekit-lsp ENOENT

If I remove the symlink, the extension correctly starts the LSP server but it then complains that it cannot find swift (understandably).

To Reproduce

See above.

Expected behavior

To respect the configured symlinks.

Environment

  • OS: NixOS 24.11
  • Swift version: 5.8
  • Visual Studio Code version: 1.90.1
  • vscode-swift version: 1.10.2

Additional context

It is somewhat inconvenient that the configuration for sourcekit-lsp and swift is just one directory. Other LSPs that I use allow you to configure a direct path to the LSP binary. That seems to be more robust as I've not run into any issues with Rust and Kotlin for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions