aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig
diff options
context:
space:
mode:
authorDavid Bernheisel <dbernheisel@users.noreply.github.com>2025-05-09 20:44:12 -0400
committerGitHub <noreply@github.com>2025-05-09 17:44:12 -0700
commitaf4a9f5ce58763365999bfc558ddecd20d41f2b7 (patch)
treeeb001885979974b249f943163b778a833ebd87be /lua/lspconfig
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.tar
nvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.tar.gz
nvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.tar.bz2
nvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.tar.lz
nvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.tar.xz
nvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.tar.zst
nvim-lspconfig-af4a9f5ce58763365999bfc558ddecd20d41f2b7.zip
feat(tailwindcss): add detection for Phoenix projects #3831
Enhance root directory detection for the latest versions of TailwindCSS v4, which no longer require tailwind.config.* or postcss.config.*. For Phoenix projects, they are typically generated or add Tailwind installed via https://github.com/phoenixframework/tailwind which will now be detected by scanning the mix.lock file for the included package. Phoenix projects that install tailwindcss via package.json should still work.
Diffstat (limited to 'lua/lspconfig')
-rw-r--r--lua/lspconfig/util.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index 5d9c213c..979766ae 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -68,6 +68,27 @@ function M.insert_package_json(config_files, field, fname)
return config_files
end
+--- Appends mix.exs files to the `config_files` list if `field`
+--- is found in any such file in any ancestor of `fname`.
+---
+--- NOTE: this does a "breadth-first" search, so is broken for multi-project workspaces:
+--- https://github.com/neovim/nvim-lspconfig/issues/3818#issuecomment-2848836794
+function M.insert_mix_exs(config_files, field, fname)
+ local path = vim.fn.fnamemodify(fname, ':h')
+ local root_with_mix = vim.fs.find({ 'mix.lock' }, { path = path, upward = true })[1]
+
+ if root_with_mix then
+ -- only add package.json if it contains field parameter
+ for line in io.lines(root_with_mix) do
+ if line:find(field) then
+ config_files[#config_files + 1] = vim.fs.basename(root_with_mix)
+ break
+ end
+ end
+ end
+ return config_files
+end
+
-- For zipfile: or tarfile: virtual paths, returns the path to the archive.
-- Other paths are returned unaltered.
function M.strip_archive_subpath(path)