Skip to content

Don't try to go to type definition if the language server does not support it #3802

Closed
@Seelengrab

Description

@Seelengrab

Summary

Ref. julia-vscode/LanguageServer.jl#1155 (comment)

gy should not try to actually request the type location if the server does not support it.

Reproduction Steps

I tried this:

  1. Create a julia source file with this content:
struct Example
    a::Int
end

function foo(bar::Example)
    bar.a
end
  1. Open the file in helix, with the julia LS installed
  2. Move the cursor over the Example in the function signature of bar
  3. Enter gy (nothing happens)
  4. Check the log for the error message of the LS

I expected this to happen:

Ideally, just a log message that the method is not supported by the server.

Instead, this happened:

The language server crashed due to not supporting that method. See the linked github issue for the reasoning why the LS crashes, which is intentional.

Helix log

~/.cache/helix/helix.log

Relevant log section, showing the error message of the LS.

2022-09-11T16:59:49.163 helix_lsp::transport [ERROR] err <- "ERROR: Unknown method textDocument/typeDefinition.\n"
2022-09-11T16:59:49.163 helix_lsp::transport [ERROR] err <- "Stacktrace:\n"
2022-09-11T16:59:49.192 helix_lsp::transport [ERROR] err <- " [1] error(s::String)\n"
2022-09-11T16:59:49.192 helix_lsp::transport [ERROR] err <- "   @ Base ./error.jl:35\n"
2022-09-11T16:59:49.193 helix_lsp::transport [ERROR] err <- " [2] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any})\n"
2022-09-11T16:59:49.193 helix_lsp::transport [ERROR] err <- "   @ JSONRPC ~/.julia/packages/JSONRPC/P0G1p/src/typed.jl:81\n"
2022-09-11T16:59:49.193 helix_lsp::transport [ERROR] err <- " [3] run(server::LanguageServerInstance)\n"
2022-09-11T16:59:49.193 helix_lsp::transport [ERROR] err <- "   @ LanguageServer ~/.julia/packages/LanguageServer/0vsx2/src/languageserverinstance.jl:382\n"
2022-09-11T16:59:49.194 helix_lsp::transport [ERROR] err <- " [4] runserver(pipe_in::Base.PipeEndpoint, pipe_out::Base.PipeEndpoint, env_path::String, depot_path::String, err_handler::Nothing, symserver_store_path::Nothing)\n"
2022-09-11T16:59:49.194 helix_lsp::transport [ERROR] err <- "   @ LanguageServer ~/.julia/packages/LanguageServer/0vsx2/src/runserver.jl:41\n"
2022-09-11T16:59:49.194 helix_lsp::transport [ERROR] err <- " [5] runserver()\n"
2022-09-11T16:59:49.194 helix_lsp::transport [ERROR] err <- "   @ LanguageServer ~/.julia/packages/LanguageServer/0vsx2/src/runserver.jl:39\n"
2022-09-11T16:59:49.194 helix_lsp::transport [ERROR] err <- " [6] top-level scope\n"
2022-09-11T16:59:49.194 helix_lsp::transport [ERROR] err <- "   @ none:1\n"

Platform

Linux 5.19.7-arch1-1

Terminal Emulator

footy

Helix Version

helix 22.08.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-language-serverArea: Language server clientC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions