elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 196 forks source link

Very slow 0.24.1 and a lot of errors in log #1133

Open hissssst opened 1 day ago

hissssst commented 1 day ago

Environment

Elixir 1.16.3 (compiled with Erlang/OTP 26)

* Elixir Language Server version: `v0.24.1`
* Operating system: linux
* Editor or IDE name (e.g. Emacs/VSCode): Kakoune
* Editor Plugin/LSP Client name and version: ...

### Current behavior

When hovering any function in `OtherModule` it takes too long to display doc and DEBUG log is filled with things like this about __every macro__ used in `OtherModule`

Nov 21 01:32:11.950 DEBG To editor xxx: evaluate-commands -verbatim -try-client 'client0' lsp-show-message-log 'elixir:elixir-ls' 'Unable to expand macro SomeModule.using/1: ** (ArgumentError) could not call Module.put_attribute/3 because the module OtherModule is already compiled (elixir 1.16.3) lib/module.ex:2360: Module.assert_not_readonly!/2 (elixir 1.16.3) lib/module.ex:2041: Module.put_attribute__/5 (project 0.1.0) lib/some_module.ex:94: SomeModule."MACRO-using__"/2 (elixir_sense 2.0.0) lib/elixir_sense/core/normalized/macro/env.ex:68: anonymous fn/5 in ElixirSense.Core.Normalized.Macro.Env.wrap_expansion/7 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:1889: ElixirSense.Core.Compiler.expand_macro_callback/7 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:28: ElixirSense.Core.Compiler.expand/3 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:2126: ElixirSense.Core.Compiler.expand_block/5 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:103: ElixirSense.Core.Compiler.do_expand/3 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:28: ElixirSense.Core.Compiler.expand/3 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:1913: ElixirSense.Core.Compiler.expand_macro_callback/7 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:28: ElixirSense.Core.Compiler.expand/3 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:2144: ElixirSense.Core.Compiler.expand_block/5 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:103: ElixirSense.Core.Compiler.do_expand/3 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler.ex:28: ElixirSense.Core.Compiler.expand/3 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler/clauses.ex:53: ElixirSense.Core.Compiler.Clauses.clause/4 (elixir_sense 2.0.0) lib/elixir_sense/core/compiler/fn.ex:16: anonymous fn/3 in ElixirSense.Core.Compiler.Fn.expand/4



Try hovering any function in any module and check these logs

### Expected behavior

Docs displayed much faster, like they used to be in previous release I used (no idea which version though)
hissssst commented 1 day ago

I also experience same errors when typing any character. Each time, error for every macro in module

lukaszsamson commented 1 day ago

The logged error is harmless. Please share a repro of a module that is particularly slow with hover etc.

hissssst commented 21 hours ago

I can't share a repro, it's a private project. But this error is occurring like 1000 of times on a single action. It might not be the issue, but it is strange that this error is there in the first place