redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.08k stars 264 forks source link

How to enable yaml language server in Kate editor #733

Closed xhujerr closed 2 years ago

xhujerr commented 2 years ago

Summary

I would like to use the yaml language server in the Kate Editor. After configuring YLS I receive an error:

LSP Client Warning Server terminated unexpectedly ...

Relevant information

The Kate documentation for the language server plugin suggest configuration examples like:

{
    "servers": {
        ...
        "python": {
            "command": ["python3", "-m", "pyls", "--check-parent-process"],
            "url": "https://github.com/palantir/python-language-server",
            "highlightingModeRegex": "^Python$"
        }
        ...
    }
}

The python language server works for me out of the box (confirming there's no problem with the KATE LSP plugin in general).

I'm using the YLS packed in docker

docker run -it quay.io/redhat-developer/yaml-language-server:latest

When I run this from bash I see the docker is up:

CONTAINER ID   IMAGE                                                  COMMAND                  CREATED          STATUS          PORTS     NAMES
fac9a04e2bf0   quay.io/redhat-developer/yaml-language-server:latest   "node ./out/server/s…"   12 seconds ago   Up 11 seconds             practical_euclid

(I added my user to a docker group so I can run docker in a non-root mode. Kate also runs under my user. So I assume the LSP does as well and runs its commands under my user too.)

I created Kate LSP plugin configuration:

        ...
        "yaml": {
            "command": ["docker", "run", "-it", "quay.io/redhat-developer/yaml-language-server:latest"],
            "url": "https://github.com/redhat-developer/yaml-language-server",
            "highlightingModeRegex": "^YAML$"
        },
        ...

The Kate configuration editor reports it is a valid JSON.

When I open yaml file in Kate I receive messages:

10:24:14 LSP Client Log Started server yaml@/home/obfuscated: /usr/bin/docker run -it quay.io/redhat-developer/yaml-language-server:latest
10:24:14 LSP Client Warning Server terminated unexpectedly ... NOT Restarting [/usr/bin/docker run -it quay.io/redhat-developer/yaml-language-server:latest] [homepage: https://github.com/redhat-developer/yaml-language-server]

Indeed the docker terminates immediately, so I don't know how to use docker log, because docker ps doesn't show it.

The Kate documentation for the language server plugin suggest enabling further debug in the language server.

Can you please suggest how can I debug this further?

In the issue #314 you suggest to intercept the connection. You mean by tcpdump? Can you please share some more info?

Kate editor version information:

||/ Name                 Version                             Architecture Description
+++-====================-===================================-============-============================================
ii  kate                 4:22.04.2-0ubuntu1~ubuntu22.04~ppa1 amd64        powerful text editor
ii  kate5-data           4:22.04.2-0ubuntu1~ubuntu22.04~ppa1 all          shared data files for Kate text editor
ii  ktexteditor-katepart 5.94.0-0ubuntu1~ubuntu22.04~ppa1    amd64        provide advanced plain text editing services
xhujerr commented 2 years ago

From some reason the docker did not work, but when I installed via

sudo snap install yaml-language-server

the language server works in Kate.