Skip to content

Return compiler arguments for invalid package manifests #8138

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

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Nov 22, 2024

Currently, when there‘s a syntax error in a package manifest, we don’t get any build settings from it in SourceKit-LSP and thus loose almost all semantic functionality. If we can’t parse the package manifest, fall back to providing build settings by assuming it has the current Swift tools version.

Fixes swiftlang/sourcekit-lsp#1704
rdar://136423767

Currently, when there‘s a syntax error in a package manifest, we don’t get any build settings from it in SourceKit-LSP and thus loose almost all semantic functionality. If we can’t parse the package manifest, fall back to providing build settings by assuming it has the current Swift tools version.

Fixes swiftlang/sourcekit-lsp#1704
rdar://136423767
@ahoppen
Copy link
Member Author

ahoppen commented Nov 22, 2024

swiftlang/sourcekit-lsp#1846

@swift-ci Please test

guard self.currentToolsVersion >= manifestToolsVersion || SwiftVersion.current.isDevelopment,
manifestToolsVersion >= ToolsVersion.minimumRequired
else {
throw StringError("invalid tools version")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you include the invalid tools version in the string to make the issue easier to debug?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this error path also have corresponding test coverage here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just shuffled code around and I don’t know how I would trigger this error scenario.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #8172

@MaxDesiatov MaxDesiatov added bug needs tests This change needs test coverage labels Nov 27, 2024
@ahoppen ahoppen merged commit 49c9fed into swiftlang:main Dec 9, 2024
5 checks passed
@ahoppen ahoppen deleted the invalid-manifest-compilerargs branch December 9, 2024 23:20
ahoppen added a commit that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs tests This change needs test coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No such module PackagePlugin
3 participants