Create: 2025-07-11, Update: 2025-07-11
This is meant to be a short post. I figured out how to use Eglot with multiple LSP.
Just as I said in my previous post, the current solution for Eglot to interact with multiple LSP is by using an external server multiplexer.
And in the same discussion thread, people from months ago are using a tool name lspx. I tried and I did not succeed.
But early in the morning, I realized that I still have to configure tailwindcss LSP to realize templ file is html file. This change alone allow me to use tailwindcss LSP with templ lsp in templ-ts-mode.
The only installation is lspx. But you need deno for that.
git clone https://github.com/thefrontside/lspx
mv lspx
deno task compile
The lspx executable is now in the dist folder, move it to your path, e.g.
mv dist/lspx ~/.local/bin/
The config for this is extremely simple.
(add-to-list 'eglot-server-programs
'(templ-ts-mode . ("lspx" "--lsp" "templ lsp" "--lsp" "tailwindcss-language-server --stdio")))
(setq-default eglot-workspace-configuration
(list (cons :tailwindCSS
(list :includeLanguages (list :templ "html")
))))
That is it. Now I have tailwindcss completion in Eglot, and it does not have the same weird bug that lsp-bridge has, (for the bug, see my last post).
The reason I am using list and cons in the config is to not bother with flipping single quote. That always fuck up json conversion if you are not careful with that.