Skip to content

No such module 'PackagePlugin' #2115

Open
@tomwyr

Description

@tomwyr

Swift version

swiftlang-6.0.2.1.2 clang-1600.0.26.4

Platform

macOS 15.3.2

Editor

Visual Studio Code with Swift extension 2.2.0

Description

I noticed that module resolution stopped working recently in a Swift plugin project I've been working on. Swift analyzer displays No such module 'PackagePlugin' and stops any further code syntax analysis (code completion and documentation for other modules work but both became slower).

I'm noticing the same issue after setting up a new empty plugin project:

// Package.swift
// swift-tools-version: 6.0

import PackageDescription // No such module 'PackageDescription'

let package = Package(
  name: "PrintMessage",
  platforms: [.macOS(.v14)],
  products: [
    .plugin(
      name: "PrintMessage",
      targets: ["PrintMessage"]
    )
  ],
  targets: [
    .plugin(
      name: "PrintMessage",
      capability: .command(
        intent: .custom(
          verb: "print-message",
          description: "Prints message"
        )
      )
    )
  ]
)
// Plugins/PrintMessage/Plugin.swift

import PackagePlugin // No such module 'PackagePlugin'

@main
struct PrintMessagePlugin: CommandPlugin {
  func performCommand(context: PluginContext, arguments: [String]) throws {
    print("Message")
  }
}

The plugin command runs without any issues but not being able to see syntax analysis in the editor severely decreases the ability to develop projects that include plugins.

Steps to Reproduce

No response

Logging

sourcekit-lsp-diagnose-2025-04-16T16-30-38+02-00.zip

Not sure if I should've attached the entire directory that the diagnose command produced. Let me know, if there's more logs data that'd be helpful.

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