Skip to content

sourcekit-lsp can be actived by {working_dir}/buildServer.json but not {working_dir}/.bsp/*.json #1791

@aelam

Description

@aelam

Describe the bug
A clear and concise description of what the bug is.

WHAT

If .bsp/*.json in project root , vscode-swift won't active sourcekit-lsp

How to reproduce

cases

  1. ✅ create a proper buildServer.json in project root, sourcekit-lsp would work, the bsp would work
  2. ❌ create a proper .bsp/*.json in project root, open in vscode, vscode-swift won't trigger sourcekit-lsp
  3. ✅ create a proper buildServer.json in project root, create an empty buildServer.json, sourcekit-lsp` would work, the bsp would work

WHY

If project root has .bsp/*.json (swift>6.1) or buildServer.json, sourcekit-lsp would launch sourcekit-lsp and if sourcekit-lsp is actived, it could try to launch the bsp server to work with it
Right now vscode-swift only check Package.swift, buildServer.json or compile_commands.json in the project, otherwise it won't trigger

Here are the code
https://github.com/swiftlang/vscode-swift/blob/02a9529090815f25a90201dda3e3218ca1119d4f/src/utilities/workspace.ts#L26C1-L45C1

I think if the swift version >= 6.1 , it should check the folders
the logic could follow the below as sourcekit-lsp

https://github.com/swiftlang/sourcekit-lsp/blob/520c7346eab7426a992da9ff242c40fb75f6b497/Sources/BuildServerIntegration/ExternalBuildServerAdapter.swift#L205-L265

How to fix

Add logic for checking swift >=6.1 && .bsp/*.json is present,

Another topic,

Actually according to the code of sourcekit-lsp, bsp cofig file in proper ***/Application Support/bsp folder could also work,
mean if the file is available in application support/ vscode-swift should try to launch sourcekit-lsp then let it launch bsp?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: [e.g. Ubuntu 20.04]
  • Swift version (output of swift --version)
  • Visual Studio Code version:
  • vscode-swift version:

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Unscreened

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions