Skip to content

Add action to the command palette to re-index a project #939

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

Closed
ahoppen opened this issue Jun 27, 2024 · 1 comment
Closed

Add action to the command palette to re-index a project #939

ahoppen opened this issue Jun 27, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ahoppen
Copy link
Member

ahoppen commented Jun 27, 2024

swiftlang/sourcekit-lsp#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 swiftlang/sourcekit-lsp#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.
@matthewbastien matthewbastien added the enhancement New feature or request label Jul 3, 2024
plemarquand added a commit to plemarquand/vscode-swift that referenced this issue Jul 10, 2024
Adds a command to trigger a re-indexing of the open project. Should only
be needed when background indexing is enabled and it gets out of sync.
While that is a bug, this can act as a temporary workaround.

Blocked By: swiftlang/sourcekit-lsp#1561
Issue: swiftlang#939
@ahoppen
Copy link
Member Author

ahoppen commented Jul 29, 2024

Implemented by #964

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants