feat/pack (#1)
Reviewed-on: #1 Co-authored-by: Tomas Mirchev <contact@tomastm.com> Co-committed-by: Tomas Mirchev <contact@tomastm.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
local utils = {}
|
||||
|
||||
function utils.root_markers_with_field(root_files, new_names, field, fname)
|
||||
local path = vim.fn.fnamemodify(fname, ':h')
|
||||
local found = vim.fs.find(new_names, { path = path, upward = true })
|
||||
|
||||
for _, f in ipairs(found or {}) do
|
||||
-- Match the given `field`.
|
||||
for line in io.lines(f) do
|
||||
if line:find(field) then
|
||||
root_files[#root_files + 1] = vim.fs.basename(f)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return root_files
|
||||
end
|
||||
|
||||
function utils.insert_package_json(root_files, field, fname)
|
||||
return utils.root_markers_with_field(
|
||||
root_files,
|
||||
{ 'package.json', 'package.json5' },
|
||||
field,
|
||||
fname
|
||||
)
|
||||
end
|
||||
|
||||
--- @brief
|
||||
---
|
||||
--- https://github.com/hrsh7th/vscode-langservers-extracted
|
||||
@@ -39,7 +67,6 @@
|
||||
---
|
||||
--- /!\ When using flat config files, you need to use them across all your packages in your monorepo, as it's a global setting for the server.
|
||||
|
||||
local utils = require('utils')
|
||||
local lsp = vim.lsp
|
||||
|
||||
local eslint_config_files = {
|
||||
|
||||
@@ -1,10 +1,37 @@
|
||||
local utils = {}
|
||||
|
||||
function utils.root_markers_with_field(root_files, new_names, field, fname)
|
||||
local path = vim.fn.fnamemodify(fname, ':h')
|
||||
local found = vim.fs.find(new_names, { path = path, upward = true })
|
||||
|
||||
for _, f in ipairs(found or {}) do
|
||||
-- Match the given `field`.
|
||||
for line in io.lines(f) do
|
||||
if line:find(field) then
|
||||
root_files[#root_files + 1] = vim.fs.basename(f)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return root_files
|
||||
end
|
||||
|
||||
function utils.insert_package_json(root_files, field, fname)
|
||||
return utils.root_markers_with_field(
|
||||
root_files,
|
||||
{ 'package.json', 'package.json5' },
|
||||
field,
|
||||
fname
|
||||
)
|
||||
end
|
||||
|
||||
---@brief
|
||||
--- https://github.com/tailwindlabs/tailwindcss-intellisense
|
||||
---
|
||||
--- Tailwind CSS Language Server can be installed via npm:
|
||||
---
|
||||
--- npm install -g @tailwindcss/language-server
|
||||
local utils = require('utils')
|
||||
|
||||
---@type vim.lsp.Config
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user