The request is not intended to be something that users invoke regularly but it is useful as a workaround should SourceKit-LSP’s index up-to-date tracker get out of sync with the project state (which we know can happen in some situations like https://github.com/apple/sourcekit-lsp/issues/1264). The workflow should thus be as follow:
The command palette has a SourceKit-LSP: Re-index project item
When it is selected, the workspace/triggerReindex is sent to the SourceKit-LSP server.
If a methodNotFound error (error code -32601) is returned, a custom error message should be displayed in VS Code that says that says: The installed version of SourceKit-LSP does not support background indexing. If any other error is returned, that error should be displayed as a popup.
If the request succeeds, a popup should be displayed saying something like: Re-indexing a project should never be necessary and indicates a bug in SourceKit-LSP. Please file an issue at https://github.com/swiftlang/sourcekit-lsp/issues/new describing which symbol was out-of-date and how you got into the state. If the user chooses to file an issue, we should enter the workflow to create a diagnose bundle.
https://github.com/swiftlang/sourcekit-lsp/pull/1507 added a
workspace/triggerReindex
request to SourceKit-LSP, which re-indexes a project in SourceKit-LSP if background indexing is enabled.The request is not intended to be something that users invoke regularly but it is useful as a workaround should SourceKit-LSP’s index up-to-date tracker get out of sync with the project state (which we know can happen in some situations like https://github.com/apple/sourcekit-lsp/issues/1264). The workflow should thus be as follow:
SourceKit-LSP: Re-index project
itemworkspace/triggerReindex
is sent to the SourceKit-LSP server.methodNotFound
error (error code -32601) is returned, a custom error message should be displayed in VS Code that says that says: The installed version of SourceKit-LSP does not support background indexing. If any other error is returned, that error should be displayed as a popup.