swiftlang / vscode-swift

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

Making changes in products does not reflect into other products. #906

Closed muchitto closed 4 months ago

muchitto commented 4 months ago

Describe the bug When a product depends on another product in the same project, it seems when making changes in the product (in this case the Library product/target), it does not reflect instantly in the executable product/target.

To Reproduce Steps to reproduce the behavior:

  1. Create file structure as follows:

    Sources/
    Library/
        Library.swift
    swift-error-test/
        main.swift
    Package.swift
  2. Add these files:

Library.swift:

public func libraryTest(thing: String) {
}

main.swift:

import Library

libraryTest(thing: "test")

Package.swift:

import PackageDescription

let package = Package(
  name: "swift-error-test",
  products: [
    .executable(name: "swift-error-test", targets: ["swift-error-test"]),
    .library(name: "Library", targets: ["Library"]),
  ],
  targets: [
    .executableTarget(
      name: "swift-error-test",
      dependencies: [
        "Library"
      ]
    ),
    .target(name: "Library"),
  ]
)
  1. Change something in Library.swift, change the name of the function or argument name.

I have to rebuild from command line and restart the the editor for the changes to be reflected.

Expected behavior Changes are instantly reflected.

Environment

adam-fowler commented 4 months ago

You need to rebuild at the moment for the index to be updated. There is work going on in SourceKit-LSP to enable background indexing, which will hopefully be available in Swift 6