I’ve spent much more time than I could afford trying to make Kate autocomplete PHP/HTML/JS/CSS code. I want tag-closing and indentation to be automatic, like in many other text editors.
Here is proof that I have successfully installed the appropriate language servers:
As you can see, I’m sticking to PHP and HTML for now, and I’ll deal with pure CSS and JS files after. Right now I’m just trying to make it work when I open files ending in HTML and PHP extensions. (Does the PHP language server also take care of HTML files, though? That would be nice.)
My LSP plugin is enabled in Kate, I ran “restart all LSP servers” from the “LSP server” menu, but it still doesn’t work, even after restarting Kate.
Any suggestions on what I’m doing wrong? I honestly don’t remember much from the tens of different things I tried to fix the issue.
Whatever I do, there is no information in the “diagnostics” tab.
The output tab should always show something, if the LSP client is running. For example - on my setup when I open a PHP file I get this:
[18:25:11  LSP Client Log] Started server php@/home/odeda/Documents/Projects/isrp/isrp-api: /home/odeda/.local/bin/phpactor language-server
[18:25:11  LSP Server Log] php@/home/odeda/Documents/Projects/isrp/isrp-api
Starting language server, use -vvv for verbose output
[18:26:01  LSP Server Info] Indexing workspace Done indexing (48.84s, 120/∞ mb), watching with pattern matching find (BSD/GNU)
if you have no output, then it means that the LSP client didn’t understand that your current file needs a language server.
You can also see that problem by opening the “LSP Client” menu - if the option to “Restart LSP Server” is grayed out (as opposed to “Restart All LSP Servers”, that is always available) - that means that Kate did not understand that this file should use an LSP.
How do I make Kate understand that I want the respective server to be launched when I open a file? Because this issue happens with all the file types I’ve tried, including PHP, HTML, CSS and JS.
Do you have different result when launching Kate from terminal? Sometimes Kate doesn’t find the correct path, but if those language servers can be found when using the terminal, then it should find them.
Seems the highlightingModeRegex for php is "highlightingModeRegex": "^PHP \\(HTML\\)$" by default, you could try that.
html part seems to be correct. Make sure you have also the server listed in “Allowed and blocked servers” tab and enabled.
Correcting the highlightingModeRegex did the trick, and apparently fixed the issue for all my language servers. Not sure how that works, but my problem is now solved. Many thanks to you and everyone who contributed their help.