HTML CSS and Eglot

When I switched from Emacs 28.x to Emacs 29.x a few months ago I thought I would give Eglot a try instead LSP mode which I had been using for the past several years. So far Eglot has just worked and simplified things for me. For Python I use Pyright for LSP. I should switch that over to Python language server because it’s said to be more performant due to the fact that it’s written in Python where Pyright is Typescript but so far I haven’t run into any issues.

I don’t care for web mode so I have just worked on html and css without any accompanying modes. Today, I decided to look and see if there was a language server project for HTML and/or CSS and found the Vscode Langservers Extracted project on GitHub.

Installation

Install via npm so that it’s available on the Path.

npm i -g vscode-langservers-extracted

Individual language servers can be installed from this project but I chose to just install all with them (extracted).

  • vscode-html-language-server
  • vscode-css-language-server
  • vscode-json-language-server
  • vscode-eslint-language-server

Starting Eglot (M-x eglot) for HTML and/or CSS buffer modes gives me pretty good syntax highlighting and completion as well as documentation. A bonus that I have noticed is it also shows me RGB and hexadecimal colors in the buffer. I have been using rainbow mode for hexadecimal but I think with Eglot and this new LSP addition I can remove that from my config since that’s all I was using it for.

Tailwind

There is a project by Tailwind Labs which I will work in next. As of the date of this post there does not seem to be a way to have Eglot run multiple langservers for a given major mode.