-
Notifications
You must be signed in to change notification settings - Fork 315
Added documentation how to set up deno lsp in kickstart.nvim #1480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Seems to be out of date https://github.com/mason-org/mason-lspconfig.nvim/releases/tag/v2.0.0. If I figure out a solution I might post an edit. |
Oh also see nvim-lua/kickstart.nvim#1595 |
The current nvim-lspconfig setup section of kickstart does not allow overrides to pass through to override LSP server configuration. {
-- Main LSP Configuration
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
-- Mason must be loaded before its dependents so we need to set it up here.
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
{ 'mason-org/mason.nvim', opts = {} },
'mason-org/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by blink.cmp
'saghen/blink.cmp',
},
config = function()
-- In general, you have a "server" which is some tool built to understand a particular
-- ------------------------------
-- SKIIPING TO CHANGES
-- ------------------------------
-- Language servers can broadly be installed in the following ways:
-- 1) via the mason package manager; or
-- 2) via your system's package manager; or
-- 3) via a release binary from a language server's repo that's accessible somewhere on your system.
-- The servers table comprises of the following sub-tables:
-- 1. mason
-- 2. others
-- Both these tables have an identical structure of language server names as keys and
-- a table of language server configuration as values.
---@class LspServersConfig
---@field mason table<string, vim.lsp.Config>
---@field others table<string, vim.lsp.Config>
local servers = {
mason = {
-- Add any additional override configuration in any of the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
-- - filetypes (table): Override the default list of associated filetypes for the server
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
--
-- Feel free to add/remove any LSPs here that you want to install via Mason. They will automatically be installed and setup.
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
denols = {
workspace_required = true,
},
lua_ls = {
-- cmd = { ... },
-- filetypes = { ... },
-- capabilities = {},
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
},
},
-- intelephense = {},
},
-- This table contains config for all language servers that are *not* installed via Mason.
-- Structure is identical to the mason table from above.
others = {
-- dartls
},
}
-- Ensure the servers and tools above are installed
--
-- To check the current status of installed tools and/or manually install
-- other tools, you can run
-- :Mason
--
-- You can press `g?` for help in this menu.
--
-- `mason` had to be setup earlier: to configure its options see the
-- `dependencies` table for `nvim-lspconfig` above.
--
-- You can add other tools here that you want Mason to install
-- for you, so that they are available from within Neovim.
local ensure_installed = vim.tbl_keys(servers.mason or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
-- Either merge all additional server configs from the `servers.mason` and `servers.others` tables
-- to the default language server configs as provided by nvim-lspconfig or
-- define a custom server config that's unavailable on nvim-lspconfig.
for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do
if not vim.tbl_isempty(config) then
vim.lsp.config(server, config)
end
end
require('mason-lspconfig').setup {
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via masontool-installer)
automatic_enable = true, -- automatically run vim.lsp.enable() for all servers that are installed via Mason
}
if not vim.tbl_isempty(servers.others) then
vim.lsp.enable(vim.tbl_keys(servers.others))
end
end,
} So the |
So for ts and deno non-conflicting support, configuration would then look like this ts_ls = {
workspace_required = true,
root_markers = { 'package.json' },
},
denols = {
workspace_required = true,
root_markers = { 'deno.json', 'deno.jsonc' },
} |
Documentation added how to set up deno lsp when using the kickstart.nvim neovim configuration template and Mason LSP.