<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Lsp on Haseeb Majid</title>
    <link>https://haseebmajid.dev/tags/lsp/</link>
    <description>Recent content in Lsp on Haseeb Majid</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Tue, 06 May 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://haseebmajid.dev/tags/lsp/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How I Setup Tailwindcss LSP With Neovim &amp; Nix (With DaisyUI)</title>
      <link>https://haseebmajid.dev/posts/2025-05-06-how-i-setup-tailwindcss-lsp-with-neovim-nix-with-daisyui-/</link>
      <pubDate>Tue, 06 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://haseebmajid.dev/posts/2025-05-06-how-i-setup-tailwindcss-lsp-with-neovim-nix-with-daisyui-/</guid>
      <description>&lt;p&gt;Recently, I have been building an app (&lt;a href=&#34;https://voxicle.app&#34;&gt;https://voxicle.app&lt;/a&gt; #ShamelessPlug), with tailwind and DaisyUI. I have been
having issues getting the tailwind LSP to work nicely in Neovim, and only recently managed to make it work.
So in this article, I will go over how I set up, assuming you are using Nix as a package manager.&lt;/p&gt;
&lt;h2 id=&#34;why-nix&#34;&gt;Why Nix?&lt;/h2&gt;
&lt;p&gt;In my project, it is a go web app, so all the dependencies in the project are managed as go modules by my &lt;code&gt;go.mod&lt;/code&gt; file.
Then everything else the developer needs is set up as a dev shell. Things like the standalone tailwind CLI,
I am using a nix flake which already has DaisyUI built in so it can also generate those types i.e. &lt;code&gt;btn&lt;/code&gt; in the final
styles.css (or whatever you called it). The flake is here: &lt;a href=&#34;https://github.com/aabccd021/tailwindcss-daisyui-nix&#34;&gt;https://github.com/aabccd021/tailwindcss-daisyui-nix&lt;/a&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Recently, I have been building an app (<a href="https://voxicle.app">https://voxicle.app</a> #ShamelessPlug), with tailwind and DaisyUI. I have been
having issues getting the tailwind LSP to work nicely in Neovim, and only recently managed to make it work.
So in this article, I will go over how I set up, assuming you are using Nix as a package manager.</p>
<h2 id="why-nix">Why Nix?</h2>
<p>In my project, it is a go web app, so all the dependencies in the project are managed as go modules by my <code>go.mod</code> file.
Then everything else the developer needs is set up as a dev shell. Things like the standalone tailwind CLI,
I am using a nix flake which already has DaisyUI built in so it can also generate those types i.e. <code>btn</code> in the final
styles.css (or whatever you called it). The flake is here: <a href="https://github.com/aabccd021/tailwindcss-daisyui-nix">https://github.com/aabccd021/tailwindcss-daisyui-nix</a></p>
<p>I didn&rsquo;t want to have multiple package managers, using <code>npm</code> or something else.</p>
<p>You can learn more about this here: <a href="https://www.youtube.com/watch?v=bdGfn_ihHOk">https://www.youtube.com/watch?v=bdGfn_ihHOk</a></p>
<h2 id="setup">Setup</h2>
<p>Assuming we have enabled the tailwind LSP in our Neovim config, I am using NixCats, and it looks it like this (using nvim-lspconfig):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-lua" data-lang="lua"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;tailwindcss&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">lsp</span> <span class="o">=</span> <span class="p">{},</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span></code></pre></div><p>You can find my full config here:</p>
<ul>
<li><a href="https://gitlab.com/hmajid2301/nixicle/-/blob/8c959ca5bd6436595592d0cedf932787ba86e359/modules/home/cli/editors/neovim/lua/myLuaConf/LSPs/init.lua#L199">https://gitlab.com/hmajid2301/nixicle/-/blob/8c959ca5bd6436595592d0cedf932787ba86e359/modules/home/cli/editors/neovim/lua/myLuaConf/LSPs/init.lua#L199</a></li>
<li><a href="https://gitlab.com/hmajid2301/nixicle/-/blob/MAJ-311/modules/home/cli/editors/neovim/default.nix#L48">https://gitlab.com/hmajid2301/nixicle/-/blob/MAJ-311/modules/home/cli/editors/neovim/default.nix#L48</a></li>
</ul>
<p>So first I added this flake as an input</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-nix" data-lang="nix"><span class="line"><span class="cl"><span class="n">tailwindcss_daisy</span><span class="o">.</span><span class="n">url</span> <span class="err">=</span> <span class="s2">&#34;github:aabccd021/tailwindcss-daisyui-nix/lsp&#34;</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="n">tailwindcss_daisy</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">nixpkgs</span><span class="o">.</span><span class="n">follows</span> <span class="err">=</span> <span class="s2">&#34;nixpkgs&#34;</span><span class="p">;</span>
</span></span></code></pre></div><p>Then install the following packages:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-nix" data-lang="nix"><span class="line"><span class="cl"><span class="n">tailwindcss-language-server</span>
</span></span><span class="line"><span class="cl"><span class="n">tailwindcss_daisy</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="si">${</span><span class="n">system</span><span class="si">}</span><span class="o">.</span><span class="n">default</span>
</span></span></code></pre></div><p>The <code>tailwindcss-language-server</code> being the LSP server for tailwind. Normally, this is installed in my dot files repo.
(I linked above). But this one is an overlay from the flake. So this one also has DaisyUI in its NODE_PATH.
Then it also auto-complete classes from DaisyUI.</p>
<p>Read this issue: <a href="https://github.com/aabccd021/tailwindcss-daisyui-nix/issues/1">https://github.com/aabccd021/tailwindcss-daisyui-nix/issues/1</a></p>
<p>Finally, to get the tailwind LSP to work, we need to create an empty <code>tailwind.config.js</code>. Else, the tailwind LSP does
not seem to start correctly. Even though the project is configured using the CSS file (probably will be fixed)</p>
<p>That&rsquo;s it! It took me a while to figure it out, but this seems to work pretty nicely.</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
