add dockerfile and dockercompose LSPs + optional local enforcement
This commit is contained in:
parent
6f49fd38ba
commit
e8eeff8fd6
|
@ -208,7 +208,6 @@ return {
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
|
||||||
pyright = {
|
pyright = {
|
||||||
settings = {
|
settings = {
|
||||||
python = {
|
python = {
|
||||||
|
@ -267,6 +266,12 @@ return {
|
||||||
bashls = {
|
bashls = {
|
||||||
alias = 'bash-language-server',
|
alias = 'bash-language-server',
|
||||||
},
|
},
|
||||||
|
dockerls = {
|
||||||
|
alias = 'docker-langserver',
|
||||||
|
},
|
||||||
|
docker_compose_language_service = {
|
||||||
|
alias = 'docker-compose-langserver',
|
||||||
|
},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = {...},
|
-- cmd = {...},
|
||||||
-- filetypes = { ...},
|
-- filetypes = { ...},
|
||||||
|
@ -312,7 +317,7 @@ return {
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
table.insert(installed, 'stylua')
|
table.insert(installed, 'stylua')
|
||||||
require('utils.mason').install(installed)
|
require('utils.mason').install(installed, true)
|
||||||
-- require('utils.mason').install {
|
-- require('utils.mason').install {
|
||||||
-- -- "python-lsp-server",
|
-- -- "python-lsp-server",
|
||||||
-- 'pyright',
|
-- 'pyright',
|
||||||
|
|
|
@ -7,12 +7,17 @@ local name_to_bin = {
|
||||||
['docker-compose-language-service'] = 'docker-compose-langserver',
|
['docker-compose-language-service'] = 'docker-compose-langserver',
|
||||||
}
|
}
|
||||||
|
|
||||||
M.install = function(ensure_installed)
|
-- We guarantee 'ensure_installed' package is installed locally
|
||||||
|
-- If enforce_local is false then we install it via mason-registry
|
||||||
|
-- By default we install LSPs via mason
|
||||||
|
M.install = function(ensure_installed, enforce_local)
|
||||||
-- Allow for passing in a single string
|
-- Allow for passing in a single string
|
||||||
if type(ensure_installed) == 'string' then
|
if type(ensure_installed) == 'string' then
|
||||||
ensure_installed = { ensure_installed }
|
ensure_installed = { ensure_installed }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
enforce_local = enforce_local == nil and false or enforce_local
|
||||||
|
|
||||||
-- Function to check if the executable exists in the PATH
|
-- Function to check if the executable exists in the PATH
|
||||||
local function executable_exists(name)
|
local function executable_exists(name)
|
||||||
if name_to_bin[name] then
|
if name_to_bin[name] then
|
||||||
|
@ -24,7 +29,7 @@ M.install = function(ensure_installed)
|
||||||
local registry = require 'mason-registry'
|
local registry = require 'mason-registry'
|
||||||
registry.refresh(function()
|
registry.refresh(function()
|
||||||
for _, pkg_name in ipairs(ensure_installed) do
|
for _, pkg_name in ipairs(ensure_installed) do
|
||||||
if not executable_exists(pkg_name) then
|
if (not executable_exists(pkg_name)) and not enforce_local then
|
||||||
local pkg = registry.get_package(pkg_name)
|
local pkg = registry.get_package(pkg_name)
|
||||||
if not pkg:is_installed() then
|
if not pkg:is_installed() then
|
||||||
pkg:install()
|
pkg:install()
|
||||||
|
|
Loading…
Reference in New Issue