swiftlang / vscode-swift

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

BUG: #Preview gets flagged as an error (plugin for module 'PreviewsMacros' not found) #943

Open davidalejandroaguilar opened 3 days ago

davidalejandroaguilar commented 3 days ago

Feel free to dismiss if this only happens in beta, but would be great if someone has encountered this already (no open issues about this).

Also, if it can't be fixed, wondering if there's a way to tell the extension to ignore it.

On:

With this code:

// Error here
#Preview {
  ContentView()
}

Getting error:

External macro implementation type 'PreviewsMacros.SwiftUIView' could not be found for macro 'Preview(_:body:)'; plugin for module 'PreviewsMacros' not foundSourceKit
ContentView.swift(126, 1): 'Preview(_:body:)' declared here (SwiftUI.Preview)

VSCode settings:

  "[swift]": {
    "editor.defaultFormatter": "vknabel.vscode-swiftformat"
    // Also tried with:
    // "editor.defaultFormatter": "sswg.swift-lang"
  },
  "swift.path": "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
image