swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
763 stars 55 forks source link

[CursorAI] Activating Swift extension failed: Failed to find lldb-dap in Swift toolchain #1069

Closed xzilja closed 3 weeks ago

xzilja commented 2 months ago

Describe the bug I am trying out CursorAI which is an editor based off VSCode 1.91.1. Commonly there are no issues with extensions, but when I add Swift one, I get an error toast saying "Activating Swift extension failed: Failed to find lldb-dap in Swift toolchain".

After some googling around, common fix stated is "install swift", however when I run swift --version I do get following output

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0

So am currently not sure if there is anything else I could try, hence leading me to think that this might be a bug with either using cursor or swift 6.0?

I also did not get any prompts to set any extras up after installing the extension.

To Reproduce Steps to reproduce the behavior:

  1. Download https://www.cursor.com
  2. Add Swift Extension, restart editor just in case
  3. Open any swift project that uses some import i.e. SwiftUI and you'll get errors all across when using any of the views
  4. Additionally observe error toast that pops up at the bottom left

Expected behavior Should install and set everything up correctly.

Environment

Additional context

plemarquand commented 2 months ago

Hi @xzilja, from inside Cursor could you do > Swift: Capture VS Code Swift Diagnostic Bundle, choose Capture Minimal Diagnostics and attach the results to this issue?

Do you have Xcode installed, have you installed a Swift toolchain from https://www.swift.org/download/, or none of the above?

In the meantime you can try working around this by setting "swift.debugger.useDebugAdapterFromToolchain": false in your VS Code user settings.json.

xzilja commented 2 months ago

@plemarquand Sure thing, here are the results extension-logs.txt settings.txt

I have latest XCode 16 RC installed and did not install Swift toolchain separately (is this one of the requirements? I was under impression that it comes bundled with XCode when it is set up).

I tried adding "swift.debugger.useDebugAdapterFromToolchain": false but am still seeing a lot of "not found" errors like this one that happens for @Model macro from SwfitData for example (all is fine within XCode):

External macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not foundSourceKit
MyTestModel.swift(5, 13): 'Model()' declared here (SwiftData.Model)
plemarquand commented 2 months ago

Thanks for attaching more info. Xcode16 Beta should be sufficient, I was just trying to get an idea of how Swift was installed on your system.

plemarquand commented 2 months ago

Apologies, I should have said set "swift.debugger.useDebugAdapterFromToolchain": true not false. That will use the lldb debug adapter from Xcode and not from the CodeLLDB VS Code extension.

matthewbastien commented 1 month ago

@xzilja I've addressed the failed activation with my most recent PR, but it's not really going to solve your issue if you want to use lldb-dap (if you're not enabling swift.debugger.useDebugAdapterFromToolchain then you're probably fine for now). I'm interested in determining why the extension couldn't identify your lldb-dap executable. Could you try running xcrun --find lldb-dap in your terminal and provide the output here?

award999 commented 1 month ago

@xzilja could you try running xcrun --find lldb-dap in your terminal and provide the output here?

award999 commented 3 weeks ago

@xzilja we're closing this, please reopen if you're still seeing