elixir-lsp / vscode-elixir-ls

Elixir language support and debugger for VS Code, powered by ElixirLS.
https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls
MIT License
545 stars 106 forks source link

Completions broke? #403

Closed CharlesIrvineKC closed 10 months ago

CharlesIrvineKC commented 10 months ago

Environment

Elixir 1.16.0 (compiled with Erlang/OTP 26)

I just updated to the latest version of ElixirLS and my completions aren't working. If I type "def" and invoke completions, I just get "no suggestions".

Any suggestions on how I might trouble shoot? I've tried deleting my ".elixir_ls" dir and restarting vscode.

CharlesIrvineKC commented 10 months ago

If I load the previous version of ElixirLS (0.18.1) completions start working again. And, when I reload the most recent version (0.19.0), completions stop working.

lukaszsamson commented 10 months ago

Please post output logs, LSP message traces or a repo that reproduces this problem. I cannot reproduce that

Screenshot 2024-01-22 at 18 21 27
CharlesIrvineKC commented 10 months ago

The only log file that looks suspicious is sharedProcess.log logs.zip

This is just a bare bones repo that I just created with: mix new complete_problem complete_problem.zip

I don't know where to find the "LSP message traces". I glad to send it if you tell me how to get it.

CharlesIrvineKC commented 10 months ago

When I invoke completions on test.ex, here is what I see:

no_completions

CharlesIrvineKC commented 10 months ago

After I revert to version 0.18.3, I get the expected completions:

completions_are_present

lukaszsamson commented 10 months ago

@CharlesIrvineKC https://github.com/elixir-lsp/vscode-elixir-ls#check-elixirls-output

CharlesIrvineKC commented 10 months ago

ElixirLS output logs:

exlixir_output.log

lukaszsamson commented 10 months ago

Your repo works on my machine.

Screenshot 2024-01-23 at 15 36 02

Your logs look correct. You can also enable tracing in ElixirLS extension settings

Screenshot 2024-01-23 at 15 38 16

You should then see something like this in the output tab

[Trace - 15:38:29] Sending request 'textDocument/completion - (13)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/myuser/Downloads/complete_problem/lib/test.ex"
    },
    "position": {
        "line": 0,
        "character": 5
    },
    "context": {
        "triggerKind": 1
    }
}

[Trace - 15:38:29] Received response 'textDocument/completion - (13)' in 28ms.
Result: {
    "isIncomplete": true,
    "items": [
        {
            "command": {
                "command": "editor.action.triggerParameterHints",
                "title": "Trigger Parameter Hint"
            },
            "deprecated": false,
            "detail": "macro",
            "documentation": {
                "kind": "markdown",
                "value": "Defines a public macro with the given name and body."
            },
            "insertText": "defmacro $1 do\n\t$0\nend",
            "insertTextFormat": 2,
            "insertTextMode": 2,
            "kind": 21,
            "label": "defmacro",
            "labelDetails": {
                "description": "Kernel.defmacro/2",
                "detail": "(call, expr \\\\ nil)"
            },
            "sortText": "00000000",
            "tags": []
        },
        ...
CharlesIrvineKC commented 10 months ago

With verbose setting:

exlixir_output.log

lukaszsamson commented 10 months ago

ElixirLS extension is working correctly and returning completions. Please verify that no other extension is interfering. Please verify your VSCode settings - maybe some setting is filtering completions

CharlesIrvineKC commented 10 months ago

Did you ever check the sharedProcess.log file in the logs.zip file I posted? There was some suspicious stuff in the file I thought.

lukaszsamson commented 10 months ago

I did, all look OK

CharlesIrvineKC commented 10 months ago

I got out the big hammer. I deleted VS code and my settings, preferences, extensions etc, then reloaded ElixirLS and now completions are working. Who knows what the problem was exactly. Anyway, problem solved. Thanks for the help.