Skip to content

Stale data lookups in completions #269

Open
@Nitrodist

Description

@Nitrodist

Hello, I am a vim+coc.nvim user and I use this project (elixir-ls) to provide code-completion etc.

I want to discuss the idea of using the stale analysis data during the various compilation steps so that code completion continues to work instead of returning nothing.

In my large project, it takes 12 seconds for code-completion to work again. I'm editing a test written in a .exs file in this example - maybe I'm doing something wrong (I am new!), but during those 12 seconds I know that I haven't made a functional change to anything, so I'd be fine with old lookups were to still be returned after I happen to use :w to save my work in progress. Even if it's 5 seconds, I'd rather have those 5 seconds of my life back, you know!

Let's say that I write to the file and it has compilation errors. This may be common because I'll return to my work after I've saved my work to disk before having lunch. I've now returned to fix my code and I don't have access to the basic information and advantages provided by code-completion with elixir-ls.

Stale data lookups fix these issues and it would improve the utility of elixir-ls considerably.

Environment

  • Elixir & Erlang versions (elixir --version):
elixir --version
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.10.3 (compiled with Erlang/OTP 21)
  • Operating system: macOS Catalina 10.15.4
  • Editor or IDE name vim + coc.nvim
  • LSP Client name:
    • coc.nvim

Logs

Compiling with Mix env test
[Info  - 11:41:05 a.m.] Compile took 402 milliseconds
[Info  - 11:41:05 a.m.] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 11:41:05 a.m.] [ElixirLS Dialyzer] Found 0 changed files in 76 milliseconds
[Info  - 11:41:08 a.m.] [ElixirLS Dialyzer] Analyzing 2 modules: [:metrics_exometer, :metrics_folsom]
[Info  - 11:41:08 a.m.] [ElixirLS Dialyzer] Analysis finished in 2775 milliseconds
[Info  - 11:41:10 a.m.] [ElixirLS Dialyzer] Writing manifest...
[Info  - 11:41:11 a.m.] [ElixirLS Dialyzer] Done writing manifest in 2304 milliseconds.
[Info  - 11:41:14 a.m.] Dialyzer analysis is up to date
[Info  - 11:41:21 a.m.] [ElixirLS WorkspaceSymbols] Indexing...
[Info  - 11:41:26 a.m.] [ElixirLS WorkspaceSymbols] Module discovery complete
[Info  - 11:41:26 a.m.] [ElixirLS WorkspaceSymbols] 480 callbacks added to index
[Info  - 11:41:30 a.m.] [ElixirLS WorkspaceSymbols] 2591 modules added to index
[Info  - 11:41:30 a.m.] [ElixirLS WorkspaceSymbols] 1712 types added to index
[Info  - 11:41:49 a.m.] [ElixirLS WorkspaceSymbols] 34255 functions added to index

Compiling with Mix env test
[Info  - 12:19:02 p.m.] Compile took 388 milliseconds
[Info  - 12:19:02 p.m.] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 12:19:03 p.m.] [ElixirLS Dialyzer] Found 0 changed files in 136 milliseconds
[Info  - 12:19:06 p.m.] [ElixirLS Dialyzer] Analyzing 2 modules: [:metrics_exometer, :metrics_folsom]
[Info  - 12:19:06 p.m.] [ElixirLS Dialyzer] Analysis finished in 3152 milliseconds
[Info  - 12:19:08 p.m.] [ElixirLS Dialyzer] Writing manifest...
[Info  - 12:19:09 p.m.] [ElixirLS Dialyzer] Done writing manifest in 2069 milliseconds.
[Info  - 12:19:14 p.m.] Dialyzer analysis is up to date
[Info  - 12:19:14 p.m.] [ElixirLS WorkspaceSymbols] Updating index...
[Info  - 12:19:19 p.m.] [ElixirLS WorkspaceSymbols] 0 modules need reindexing
[Info  - 12:19:19 p.m.] [ElixirLS WorkspaceSymbols] 0 modules added to index
[Info  - 12:19:19 p.m.] [ElixirLS WorkspaceSymbols] 0 types added to index
[Info  - 12:19:19 p.m.] [ElixirLS WorkspaceSymbols] 0 functions added to index
[Info  - 12:19:19 p.m.] [ElixirLS WorkspaceSymbols] 0 callbacks added to index

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions