Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems in Macros should show the original source line #1224

Closed
NinjaLikesCheez opened this issue Nov 26, 2024 · 3 comments
Closed

Problems in Macros should show the original source line #1224

NinjaLikesCheez opened this issue Nov 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@NinjaLikesCheez
Copy link

Describe the bug
When a diagnostic is issued in a macro expansion, VSCode's 'problem' window will link to the swift-generated-source/expanded macro source file and not the source file where the problem happens.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new SPM library target
  2. In the test file use the #expect macro to try a non-throwing function
  3. A warning (No calls to throwing functions occur within 'try' expression) will occur and clicking it will take you to the expanded macro source

Expected behavior
When clicking the warning, I'd expect to be taken to the original-source-range where the issue occurred.

Environment

  • OS: macOS Sequoia 15.1.1
  • Swift version: 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
  • Visual Studio Code version: Version: 1.95.3 (Universal)
  • vscode-swift version: v1.11.3

Additional context

import Testing
@testable import Test

func test() -> Bool {
	return true
}

@Test func example() async throws {
    // Write your test here and use APIs like `#expect(...)` to check expected conditions.
		#expect(try await test())
}
``` is a test case
@plemarquand
Copy link
Contributor

@NinjaLikesCheez thanks for the report! I think #1234 should address this issue. It will be shipped in the next release of the extension.

@award999 award999 moved this from In Progress to Needs Verification in Swift Extension for Visual Studio Code Dec 6, 2024
@award999 award999 added the needs verification Issue has been fixed, but requires verification before closing label Dec 6, 2024
@award999
Copy link
Contributor

award999 commented Dec 6, 2024

verified with c047d4e

@award999 award999 closed this as completed Dec 6, 2024
@award999 award999 removed the needs verification Issue has been fixed, but requires verification before closing label Dec 6, 2024
@award999 award999 moved this from Needs Verification to Done in Swift Extension for Visual Studio Code Dec 6, 2024
@NinjaLikesCheez
Copy link
Author

@NinjaLikesCheez thanks for the report! I think #1234 should address this issue. It will be shipped in the next release of the extension.

You're amazing - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants