Skip to content

Remove custom decoding function from SourceKitLSPOptions #1646

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
Sep 7, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 6, 2024

We forgot to decode the following keys in the custom decode function, which meant that you couldn’t set them using SourceKit-LSP’s config.json file.

  • backgroundPreparationMode
  • sourcekitdRequestTimeout
  • cancelTextDocumentRequestsOnEditAndClose

We had the custom decoder function so that the keys weren’t required in the JSON but we could access eg. SwiftPMOptions without needing to deal with optionals in the codebase.

Make the accesses to these nested options structs a little more verbose but eliminate the source of the above bug, which seems like a good tradeoff.

@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2024

@swift-ci Please test

public var swiftPM: SwiftPMOptions
public var compilationDatabase: CompilationDatabaseOptions
public var fallbackBuildSystem: FallbackBuildSystemOptions
// Pretend that all of these keys are
Copy link
Contributor

Choose a reason for hiding this comment

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

Are....

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, leftover comment. Removed it.

We forgot to decode the following keys in the custom decode function, which meant that you couldn’t set them using SourceKit-LSP’s `config.json` file.
- `backgroundPreparationMode`
- `sourcekitdRequestTimeout`
- `cancelTextDocumentRequestsOnEditAndClose`

We had the custom decoder function so that the keys weren’t required in the JSON but we could access eg. `SwiftPMOptions` without needing to deal with optionals in the codebase.

Make the accesses to these nested options structs a little more verbose but eliminate the source of the above bug, which seems like a good tradeoff.
@ahoppen ahoppen force-pushed the no-custom-decode-options branch from 0359b53 to d86a32b Compare September 6, 2024 20:45
@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2024

@swift-ci Please test Windows

@ahoppen ahoppen enabled auto-merge September 6, 2024 21:20
@ahoppen ahoppen merged commit dfbf8f4 into swiftlang:main Sep 7, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants