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

LS unresponsive when dialyzing

Open phewitt opened this issue 3 years ago • 3 comments

I am working In a fairly large project and am noticing that whenever I change ANYTHING I lose all functionality (go to definition, hover info, function folding, autocomplete) for ~60-90 seconds. Looking at the ElixirLS output It seems to align pretty closely to how long it takes for Compiler + Dialyzer to run. As soon as Dialyzer analysis is up to date prints I have all the functionality again.

MIX_TARGET: 
==> data
Compiling 1 file (.ex)
[Info  - 9:36:48 PM] Compile took 3361 milliseconds
[Info  - 9:36:48 PM] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 9:36:50 PM] [ElixirLS Dialyzer] Found 1 changed files in 336 milliseconds
[Info  - 9:36:51 PM] [ElixirLS Dialyzer] Analyzing 0 modules: []
[Info  - 9:36:51 PM] [ElixirLS Dialyzer] Analysis finished in 203 milliseconds
[Info  - 9:37:00 PM] [ElixirLS Dialyzer] Writing manifest...
[Info  - 9:37:03 PM] [ElixirLS Dialyzer] Done writing manifest in 3806 milliseconds.
[Info  - 9:37:34 PM] [ElixirLS WorkspaceSymbols] Updating index...
[Info  - 9:37:35 PM] [ElixirLS WorkspaceSymbols] 2 modules need reindexing
[Info  - 9:37:35 PM] [ElixirLS WorkspaceSymbols] 0 callbacks added to index
[Info  - 9:37:35 PM] [ElixirLS WorkspaceSymbols] 0 types added to index
[Info  - 9:37:35 PM] [ElixirLS WorkspaceSymbols] 2 modules added to index
[Info  - 9:37:35 PM] [ElixirLS WorkspaceSymbols] 9 functions added to index
[Info  - 9:38:17 PM] Dialyzer analysis is up to date

This seems to be mostly ElixirLS performance. However, when using nvim with coc.nvim I still have functionality while ElixirLS is doing it's thing. which I thought it is basically using this extension?

I'm wondering if there is a way to cache the previous results or background this process so all of my symbols and functionality work while this is happening behind the scenes? Even if some of the symbols are stale I feel it would be much better UX if I could still get most functionality. Ideally I can add a new line and not have to wait 90 seconds to go to a function definition.

If anyone knows of a way to improve this please let me know. thanks for the extension! keep up the good work.

phewitt avatar Jan 21 '22 02:01 phewitt

Studying behavior more I am noticing the slow behavior either way. Dialyzer adds time, but not a whole lot. Our project has ~2k warnings and i'm noticing the delay seems to be when the warnings are coming.

[Trace - 11:00:58 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 11:00:58 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 11:00:58 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 11:00:58 PM] Received notification 'textDocument/publishDiagnostics'.

.
.
... 1996 more

Still weird that I lose all LS functionality while this is happening

phewitt avatar Jan 21 '22 04:01 phewitt

@phewitt Please try setting dialyzerEnabled to false. Otherwise you can try to fix/ignore your warnings ;)

lukaszsamson avatar Jan 23 '22 10:01 lukaszsamson

Probably we need to limit the number of diagnostics we are sending to the client to some reasonable number.

lukaszsamson avatar Jun 29 '22 21:06 lukaszsamson