elixir-ls icon indicating copy to clipboard operation
elixir-ls copied to clipboard

add support for disabling automatic builds though a config

Open Hanspagh opened this issue 5 years ago • 8 comments

closes #341

Adds a config check before starting a build in trigger_build. I was hesitant to add it to build_enabled since it also seems to be used by dialyzer_enabled

I tried to follow what was outlined in this comment

First PR on a language server, so any feedback is very welcome.

Hanspagh avatar Dec 22 '20 09:12 Hanspagh

Hmm, I don't think this approach will work very well since the code would never get rebuilt which means that your auto completions and go to implementation, etc. will be out of date. And if you wanted to build you'd have to go in your settings to enable autoBuild, trigger a build, and then go back to settings to disable it.

Here's some potential approaches:

  1. Add a custom command to build (will have to add support to all clients)
  2. When this setting is enabled then use the projects _build instead of .elixir_ls/build
  • Additionally we'll have to add support to load updated code from mix compile, possibly with a file watcher, or possibly do a manually check when we would have triggered a build (although there would likely be race conditions)
  1. Add some other method to build only when the user wants to build

@lukaszsamson any other ideas or thoughts on implementing this feature?

axelson avatar Dec 22 '20 18:12 axelson

My understanding was that the config would start (My understanding was that people wanted to disable builds entirely). You bring up some good points with the above, I will see if I can tackle them, I am still new to the code base, so feel free to add any pointers.

Hanspagh avatar Dec 22 '20 21:12 Hanspagh

@axelson I think you covered all of the aspects in your comment.

Add a custom command to build (will have to add support to all clients)

I like that idea

When this setting is enabled then use the projects _build instead of .elixir_ls/build

It would be risky IMO. Every elixir release changes something in the build system. IIRC There were issues with race conditions/locks between mix and elixirLS in the past.

Add some other method to build only when the user wants to build

File watcher on mix.exs?. Besides that I can't think of anything that doesn't involve client code changes or using external tools.

lukaszsamson avatar Dec 23 '20 09:12 lukaszsamson

@Hanspagh Thank you for this PR. Even though it wasn't merged, I'm using your branch to make my editor setup take way less CPU. ❤️

Disables a couple of features but super worth it in my opinion.

paulstatezny avatar Nov 22 '21 18:11 paulstatezny

I think we can merge it and add rebuild command later. @Hanspagh can you resolve merge conflict?

lukaszsamson avatar Nov 24 '21 07:11 lukaszsamson

@Hanspagh Hello, thank you for your PR, do you think it would be possible to update the branch, so it can be merged?

DaliborHorinek avatar Apr 24 '22 19:04 DaliborHorinek

should we merge?

abdul-hamid-achik avatar Apr 29 '22 18:04 abdul-hamid-achik

The merge conflicts is solved now atleast, then you can decide what wanna do with this :)

Hanspagh avatar May 02 '22 13:05 Hanspagh