Language Server Protocol

https://langserver.org/

language server protocol

Language Server Protocol Specification - 3.17

Now let’s look at the ‘textDocument/definition’ request in more detail. Below are the payloads that go between the development tool and the language server for the “Go to Definition” request in a C++ document.

This is the request:

{
    "jsonrpc": "2.0",
    "id" : 1,
    "method": "textDocument/definition",
    "params": {
        "textDocument": {
            "uri": "file:///p%3A/mseng/VSCode/Playgrounds/cpp/use.cpp"
        },
        "position": {
            "line": 3,
            "character": 12
        }
    }
}

This is the response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "uri": "file:///p%3A/mseng/VSCode/Playgrounds/cpp/provide.cpp",
        "range": {
            "start": {
                "line": 0,
                "character": 4
            },
            "end": {
                "line": 0,
                "character": 11
            }
        }
    }
}

plugin

Sourcegraph

code search

Cody AI

programming assistant

golang