Skip to content

Commit

Permalink
Merge pull request #12 from Nipsuli/add-deno-to-nvim
Browse files Browse the repository at this point in the history
add deno to nvim lsp
  • Loading branch information
Nipsuli authored Feb 21, 2024
2 parents 340fdaf + 2ed0292 commit a56dd26
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions dotfiles/cosmic/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local config = {
-- lsp servers that should be installed
ensure_installed = {
'rust_analyzer',
'denols',
},

-- lsp servers that should be enabled
Expand All @@ -29,9 +30,32 @@ local config = {
tailwindcss = false,
-- Enable rust_analyzer
rust_analyzer = true,

denols = {
opts = {
single_file_support = false,
root_dir = function(filename, bufnr)
local lspconfig = require('lspconfig')
return lspconfig.util.root_pattern('deno.json', 'deno.jsonc')(filename)
end,
},
},
-- Enable tsserver w/custom settings
tsserver = {},
tsserver = {
opts = {
single_file_support = false,
root_dir = function(filename, bufnr)
local lspconfig = require('lspconfig')
local denoRootDir = lspconfig.util.root_pattern('deno.json', 'deno.json')(filename)
if denoRootDir then
-- print('this seems to be a deno project; returning nil so that tsserver does not attach')
return nil
-- else
-- print('this seems to be a ts project; return root dir based on package.json')
end
return lspconfig.util.root_pattern('package.json')(filename)
end,
},
},
-- See Cosmic defaults lsp/providers/null_ls.lua and https://github.com/jose-elias-alvarez/null-ls.nvim/
-- If adding additional sources, be sure to also copy the defaults that you would like to preserve from lsp/providers/null_ls.lua
null_ls = {
Expand Down

0 comments on commit a56dd26

Please sign in to comment.