Skip to content
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

Feature request: Disable/customize automatic builds (from orig. old-repo issue "Don't compile automatically", included) #341

Closed
justinmorrow opened this issue Aug 13, 2020 · 4 comments · Fixed by #440 or elixir-lsp/vscode-elixir-ls#308
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@justinmorrow
Copy link

Refiled from an old issue at JakeBecker/elixir-ls#120 (by @crbelaus)

The simplest suggestion I saw was simply adding a config option to disable automatic builds. See comment from @toranb for a potential spot to put the config check.

Related ideas for helping similar issues:

  1. Add support for config options already supported by mix compile (assuming that's the command ElixirLS uses to build). Even something as simple as a string option whose contents are just appended to the mix compile command. Especially the :build_embedded option, though I wouldn't be surprised if that flag would impact performance significantly.
  2. Add a --no-compile option for dialyzer, like provided by dialyxer.

Original post

with choice comment(s) to help anyone trying to write a PR.
NOTE: original post discussion might be dated, taking place from 2018 to early 2019.


crbelaus commented on Sep 11, 2018

Environment

* Elixir & Erlang versions (elixir --version): 1.7.1

* Operating system: Mac OS

* Client (editor or IDE): Visual Studio Code

Currently, when I save a file ElixirLS automatically compiles in the environment specified by the elixirLS.mixEnv setting (by default test). I am working in a project that has many files and modifying some of them triggers lots of additional recompilations. Having ElixirLS automatically recompile them with every change usually puts a high load on my CPU.

I've tried to change the elixirLS.mixEnv setting to dev with the hope of having ElixirLS and my local Phoenix server to use the same build and avoiding each one of them to perform a separated compilation. Turns out that this does not work as expected because Phoenix builds are stored in _build while ElixirLS builds are stored in .elixir_ls/build.

My question is, is there any way to avoid ElixirLS trigger automatic recompilations and instead use the builds generated in the _build directory? Something along the lines of what the extensions vscode-elixir and atom-elixir do which use the _build directory files for inference and autocompletion.

...

OvermindDL1 commented on Sep 11, 2018

Except that 'feature' in vscode/atom causes so many bugs and miscompiled beam files that I had to change them to use test exclusively so there wouldn't be any concurrent recompilation breakages like zero-sized beam files. What elixir-ls currently does is far superior.

...

crbelaus commented on Sep 12, 2018

Yes @OvermindDL1 I've found the same problems when two sources try to save the build artifacts to the same path. What I meant was to make the extension use the build artifacts stored in _build but don't compile anything itself.

This way I could control when the application is compiled by running mix compile manually or using the Phoenix autoreload feature. The extension would limit itself to read those compilation artifacts.

Thank you @JakeBecker ! I will try to build a PR 🔬

...

toranb commented on Apr 11, 2019

I would also love this config option but a gentle nudge in the right direction might help land a PR sooner ;) rather than later

edit: I would guess this might be an easy escape valve to check for configuration before doing the re-compile

https://github.com/JakeBecker/elixir-ls/blob/master/apps/language_server/lib/language_server/server.ex#L298


If relevant, here's my env info

Environment

  • Elixir & Erlang versions (elixir --version):
 Erlang/OTP 22 [erts-10.7.2.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe]
 Elixir 1.9.2 (compiled with Erlang/OTP 20)
  • Operating system: Mac
  • Editor or IDE name (e.g. Emacs/VSCode): VSCode
  • Editor Plugin/LSP Client name: jakebecker.elixir-ls
@laodc
Copy link

laodc commented Sep 3, 2020

I would LOVE to be able to disable compiling.

As i'm coding on a sshfs mounted drive and i'm getting constant conflicts with the server end and my dev end.
also argon2 nmake over sshfs hangs my whole system (which is an unrelated issue)

@lukaszsamson
Copy link
Collaborator

PRs are welcome

@laodc
Copy link

laodc commented Sep 3, 2020

PRs are welcome

Sadly I wouldn't classify myself even remotely good enough to make a PR. I'd be spending like a month just trying to see where to set something i'm pretty sure. lol.

I'd give it a try still if no one else is able to do it.

@justinmorrow
Copy link
Author

@laodc I don't have much spare time to go after it on my own, but I might be able to point you in the right direction for where to start. I'm not familiar with this repo at all, but if you wanna go after it and need help just ping me back :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
3 participants