Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

format on save doesn't seem to work with vintage #1725

Closed
radiohertz opened this issue Jun 5, 2021 · 3 comments
Closed

format on save doesn't seem to work with vintage #1725

radiohertz opened this issue Jun 5, 2021 · 3 comments
Labels
sublime issue Issues related to shortcomings or bugs in the ST API

Comments

@radiohertz
Copy link

radiohertz commented Jun 5, 2021

Describe the bug
When vintage is enabled and :w is used to save the file, lsp doesn't format the file. I have to manually do CTRL + s.

To Reproduce
Steps to reproduce the behavior:

  1. Enable vintage and lsp_format_on_save
  2. Save a file with ':w'

Expected behavior
lsp should format the file

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Arch Linux
  • Sublime Text version: 4107-1
  • LSP version: 1.4
  • Language servers used: clangd
@rwols
Copy link
Member

rwols commented Jun 5, 2021

If you log what command is ran with sublime.log_commands(True), you can see that :w runs the save command.

For LSP we must instead run an lsp_save command in order to asynchronously run code-actions-on-save, and asynchronously format-on-save.

There is no way to run code asynchronously via the on_pre_save callback in the ST API, hence lsp_save exists.

@rwols rwols added the sublime issue Issues related to shortcomings or bugs in the ST API label Jun 5, 2021
@rwols
Copy link
Member

rwols commented Jun 10, 2021

Note that NeoVintageous allows you to map :w to lsp_save.

@radiohertz
Copy link
Author

radiohertz commented Jun 11, 2021

Note that NeoVintageous allows you to map :w to lsp_save.

Ok thanks, will try it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
sublime issue Issues related to shortcomings or bugs in the ST API
Projects
None yet
Development

No branches or pull requests

2 participants