8000 Document `sorbet.savePackageFiles` by jez · Pull Request #8793 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Document sorbet.savePackageFiles #8793

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
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions website/docs/lsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,36 @@ _Response_:

- result: [`TextDocumentItem`]

### `sorbet.savePackageFiles` command

The Sorbet language server will sometimes request that the
`sorbet.savePackageFiles` command is run. This command is meant to be
implemented by language clients.

Each language client has a way to register commands that are not part of the
core language server protocol. For example, in Neovim, a command is registered
like this:

```lua
vim.lsp.commands['sorbet.savePackageFiles'] = function(command)
-- ...
endfunction
```

Sorbet includes this `sorbet.savePackageFiles` command in the `command` field of
certain `CodeAction` responses, and the Sorbet VS Code extension includes
[an implementation](https://github.com/sorbet/sorbet/blob/546293d16abbb6ea41704c147544569c7508a572/vscode_extension/src/commands/savePackageFiles.ts#L11).
The idea is that certain code actions make edits in files that the user did not
open on their own, and so by not saving the edits from Sorbet's code, they don't
realize that they need to switch over to those files and save them for the code
action's edits to have been reflected on disk.

See
[CodeAction](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction)
and
[Command](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#command)
in the LSP specification.

## Appendix

### A note on watchman
Expand Down
0