Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

CLI flag to disable LSP #6686

Closed
dsseng opened this issue Apr 10, 2023 · 8 comments
Closed

CLI flag to disable LSP #6686

dsseng opened this issue Apr 10, 2023 · 8 comments
Labels
C-enhancement Category: Improvements

Comments

@dsseng
Copy link
Contributor

dsseng commented Apr 10, 2023

When working on large projects, you might want to simply search for something or do brief changes, not triggering LSP builds which can use a lot of RAM and battery power if you use a laptop.

Proposal: either a CLI flag or environment variable to make Helix ignore LSP server configs and not start them.

@dsseng dsseng added the C-enhancement Category: Improvements label Apr 10, 2023
@the-mikedavis
Copy link
Member

the-mikedavis commented Apr 10, 2023

You can use the -c/--config file to load a configuration file at a specified path and the editor.lsp.enable key to enable/disable LSP. We don't want to introduce many CLI flags especially if they overlap with regular config options.

@dsseng
Copy link
Contributor Author

dsseng commented Apr 11, 2023

Just a copy of config? Might be viable

@7flash
Copy link

7flash commented May 3, 2023

I would find it better to ask lsp validate my file after I finished typing, instead of current behavior where it's blinking with validation on every symbol while I am typing; that seems to be a default behavior in vscode too, but it's very annoying and I hope to find solution with throttle or something

@ghost
Copy link

ghost commented Jun 8, 2023

Is :format supposed to be a NOP when you have editor.lsp.enable=false in your config? Noticed while editing rust code and being surprised rustfmt doesn't seem to be run.

helix 23.05 (fee8e3f7)

It works for shell scripts for which I have the recommended config from the wiki:

[[language]]
name = "bash"
indent = { tab-width = 4, unit = "    " }
formatter = { command = 'shfmt', args = ["-i", "4"] }

@ghost
Copy link

ghost commented Jun 8, 2023

Since we already have :lsp-restart and :lsp-stop, how about :lsp-start? I disable lsp by default and would like to sometimes during a session start the server on demand. :lsp-restart didn't start anything, which I thought would happen, but editor.lsp.enable=false seems to prevent that.

@gabydd
Copy link
Member

gabydd commented Jun 9, 2023

Is :format supposed to be a NOP when you have editor.lsp.enable=false in your config? Noticed while editing rust code and being surprised rustfmt doesn't seem to be run.

helix 23.05 (fee8e3f7)

It works for shell scripts for which I have the recommended config from the wiki:

[[language]]
name = "bash"
indent = { tab-width = 4, unit = "    " }
formatter = { command = 'shfmt', args = ["-i", "4"] }

For rust, rustfmt is actually run by rust-analyzer so the language server provides the formatting when you run :format which is why there is not formatting when lsp is disabled

@ghost
Copy link

ghost commented Jun 9, 2023

Thank you! Fixed by adding a rustfmt section in languagues.toml. Though I would say, to avoid surprising other users who disable lsp by default, it makes sense to have the fallback built-in for use when lsp is disabled. Or you could argue someone disabling lsp could also add a rustfmt rule.

@willhansen
Copy link

Just ran into a use case where this feature would be convenient:

A recent change in my code is causing the LSP to take up all the RAM and freeze everything. I want to open the editor without the LSP running for the short-term, so I can fix this problem and get everything working again.

  • Calling :lsp-stop every time the lsp automatically restarts is inconvenient.
  • Setting up a modified configuration file with this single feature disabled is also inconvenient.
  • A single CLI flag would be very convenient.

@helix-editor helix-editor locked and limited conversation to collaborators Apr 7, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10226 Apr 7, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

5 participants