Can't get code autocompletion to work for HTML in Kate text editor

In VS Code, when editing an HTML file, I can just start typing a tag’s name and it’ll suggest a list of matching tags. Selecting one prints it to the file, including opening and closing brackets - so I don’t have to type out the brackets.

Can Kate do that too? I have the LSP plugin enabled and the vscode-html-languageserver package installed from the Manjaro repos, which I hope is compiled from this source: vscode/extensions/html at main · microsoft/vscode · GitHub

but I’m still not getting autocomplete (and inserting the brackets for me).

I believe what you are describing is “code completion”. And yes.

But check

  • Settings > Configure Kate > Editing > Auto Completion - Review options on this page.

  • Settings > Configure Kate > Open/Save - In the Filetype dropdown look for your source type. This will show you the file type extensions. If in doubt, stop/start kate. If still having issues, stop/start kate from the command line and review the messages. The mode, can be overridden:

    • Tools > Mode

    • or a modeline, which is the last line in a file

      kate: syntax <FILE TYPE NAME>; indent 2;

  • kate will highlight variables in the file/project and ctrl-space to get keywords.

  • you may need to save the file, with the correct extension or modeline, for kate to recognize the filetype.

Doc

I now realize I may not have answered your specific question about the LSP Client Plugin. Perhaps someone else has move experience with this specific plugin. There is this help regarding the menu item.

Interesting site on Language Server Protocol implementations, and Kate is listed :slight_smile:

1 Like

I played around with Kate and the language server protocol (lsp). It worked for bash and css, but not html.

I installed:

vscode-html-languageserver
vscode-css-languageserver
bash-language-server
shellcheck

I could see in the Output Tab the error, “LSP Client Warning Failed to find server…” when the above were not installed and “Started server html@…” when I did the above installs, even for html.

For css and bash, there was output on the LSP tab and highlighting, etc in the document.

In Settings > Configure Kate > LSP Client > Allowed & Blocked Servers I could see all 3 checked.

I did searches in the repos for:

pacman -Ss language-server
pacman -Ss languagserver

And reviewed Settings > Configure Kate > LSP Client > Default Server Settings.

There was no command line output that indicated a problem.

This has been an interesting adventure, sorry I didn’t get a solution for you. Perhaps someone has more experience with Kate using LSP on a HTML document.

1 Like

Check it out, I got something from a KDE contributor:

It seems like this may actually be missing functionality for some reason, but not clear yet why.
It’s definitely strange, with this LSP being maintained by Microsoft… VSCode uses it too, and it works there (on my system).