Tailwind intellisense in neovim

How I got Tailwind intellisense working in neovim

I recently started using Tailwind CSS in a project and wanted to get intellisense working in neovim. Fortunately, the tailwindcss language server is available through the Mason neovim plugin.

After the language server was installed and set up in my neovim init, I opened an html file I was writing tailwind inside of using the tailwind CDN, but I wasn’t getting any intellisense. In the screenshot below, the only intellisense I got when typing text was a textarea snippet. This was a little confusing, as I clearly had the language server installed properly.

I decided to run :LspInfo to see if the language server was running properly, and I saw that it was available, but not attached to the current buffer and running.

I started thinking that perhaps the language server wasn’t being triggered on a plain html file. I decided to add a blank tailwind config file (tailwind.config.js) to the root directory where the html lived.

I restarted neovim, re-opened the html file, typed :LspInfo, and saw some more promising results. The tailwind language server was now connected to the html file buffer!

Once again I started typing text, and this time I got the intellisense I was looking for!

Conclusion

Make sure your language server is installed properly, and make sure you have a tailwind config file in the root directory of the file you’re working in. This should get you up and running with Tailwind intellisense in neovim.


Downgrading to a specific version using homebrew

After upgrading to the most recent version of a homebrew formula, I noticed a bug that wasn’t present in the previous version. I wanted to downgrade to the previous version, but there was no real easy way of doing so. After doing a little research I found a way that is pretty simple.

  1. First, you need to note the version number of the formula you want to downgrade to.
  2. Uninstall the current formula.
  3. Make a fork of the homebrew-core repository. I noticed a TON of forks of this repository when I first navigated there, so that was how I knew I was on the right track.
  4. Find the version of the formula you want to downgrade to, and copy the contents of the corresponding .rb file.
  5. Switch back to the main branch of the forked repository, and find the latest .rb file for the formula you want to downgrade.
  6. Replace the contents of the latest .rb file with the copied contents from step 4.
  7. Commit and push the changes. You can do all of this through the github gui.
  8. Ensure the formula is uninstalled so we don’t get any conflicts with the following steps.
  9. Install the formula using the following command: brew install {github_username}/homebrew-core/{formula_name}
  10. You should now have the formula installed at the version you wanted to downgrade to.

More Info: How to create and maintain a tap