nvim: Add mason env utility function
Should return the mason environment for lsp servers to be able to set it in the 'core/languages.lua' list. However, currently it is initialized too early (I think), before mason.nvim, and thus never gets the initialized env var.
This commit is contained in:
parent
9900750e81
commit
1f05e0775d
1 changed files with 14 additions and 4 deletions
|
|
@ -1,8 +1,8 @@
|
|||
-- A list of all languages for which I have support for any of:
|
||||
-- an LSP
|
||||
-- Treesitter
|
||||
-- linting
|
||||
-- formatting
|
||||
-- an LSP (lsp)
|
||||
-- Treesitter (ts)
|
||||
-- linting (lint)
|
||||
-- formatting (format)
|
||||
--
|
||||
-- with their respective names used by lspconfig, nvim-treesitter, nvim-lint and conform.
|
||||
--
|
||||
|
|
@ -12,6 +12,16 @@ if vim.fn.executable("nufmt") == 1 then
|
|||
nushell.format = { nu = { "nufmt" } }
|
||||
end
|
||||
|
||||
-- FIXME: This does not work for populating LSP config,
|
||||
-- never gets set MASON env var. Executing too early?
|
||||
local function mason_dir()
|
||||
local dir = vim.fn.getenv("MASON")
|
||||
if dir ~= vim.NIL then
|
||||
return dir
|
||||
end
|
||||
return vim.fn.getenv("HOME") .. "/.local/share/nvim/mason"
|
||||
end
|
||||
|
||||
local languages = {
|
||||
arduino = { lsp = { arduino_language_server = {} }, ts = { "arduino" } },
|
||||
awk = { ts = { "awk" }, format = { awk = { "gawk" } } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue