mason-deno-fix
pegasust 2022-12-03 06:43:44 +00:00
parent 660a2f24f3
commit 37363d4581
2 changed files with 44 additions and 30 deletions

View File

@ -540,7 +540,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
local servers = { local servers = {
'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals', 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals',
'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "pylsp", 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "pylsp",
"jsonls", "jsonls", "denols"
} }
require("mason").setup({ require("mason").setup({
ui = { ui = {
@ -608,15 +608,25 @@ require('mason-lspconfig').setup_handlers({
require('lspconfig').tsserver.setup { require('lspconfig').tsserver.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
-- TODO: Have to figure out an alternative config for monorepo to prevent
-- Deno from injecting TS projects.
-- Monorepo support: spawn one instance of lsp within the git -- Monorepo support: spawn one instance of lsp within the git
-- repos. -- repos.
root_dir = require('lspconfig.util').root_pattern('.git'), -- root_dir = require('lspconfig.util').root_pattern('.git'),
root_dir = require('lspconfig.util').root_pattern('package.json'),
settings = { settings = {
javascript = inlay_hint_tsjs, javascript = inlay_hint_tsjs,
typescript = inlay_hint_tsjs, typescript = inlay_hint_tsjs,
} }
} }
end, end,
["denols"] = function()
require('lspconfig').denols.setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = require('lspconfig.util').root_pattern("deno.json", "deno.jsonc"),
}
end,
-- ["rust_analyzer"] = function() -- ["rust_analyzer"] = function()
-- require('lspconfig').rust_analyzer.setup { -- require('lspconfig').rust_analyzer.setup {
-- on_attach = on_attach, -- on_attach = on_attach,

View File

@ -4,28 +4,32 @@
, myHome , myHome
, ... , ...
}: }:
let nvim_pkgs = [ let
# Yes, I desperately want neovim to work out-of-the-box without flake.nix for now nvim_pkgs = [
# I want at least python LSP to work everywhere because it's basically # Yes, I desperately want neovim to work out-of-the-box without flake.nix for now
# an alternative to bash script when I move to OpenColo # I want at least python LSP to work everywhere because it's basically
pkgs.gccStdenv # an alternative to bash script when I move to OpenColo
pkgs.gcc pkgs.gccStdenv
pkgs.tree-sitter pkgs.gcc
pkgs.ripgrep pkgs.tree-sitter
pkgs.fzf pkgs.ripgrep
# pkgs.sumneko-lua-language-server pkgs.fzf
pkgs.ripgrep # pkgs.sumneko-lua-language-server
pkgs.zk pkgs.ripgrep
pkgs.fd pkgs.zk
pkgs.stdenv.cc.cc.lib pkgs.fd
# Python3 as alternative to bash scripts :^) pkgs.stdenv.cc.cc.lib
# (pkgs.python310Full.withPackages (pypkgs: [ # Python3 as alternative to bash scripts :^)
# # python-lsp-server's dependencies is absolutely astronomous # (pkgs.python310Full.withPackages (pypkgs: [
# # pypkgs.python-lsp-server # python-lsp. Now we'll have to tell mason to look for this # # python-lsp-server's dependencies is absolutely astronomous
# pypkgs.pynvim # nvim provider # # pypkgs.python-lsp-server # python-lsp. Now we'll have to tell mason to look for this
# # pypkgs.ujson # pylsp seems to rely on this. satisfy it lol # pypkgs.pynvim # nvim provider
# ])) # # pypkgs.ujson # pylsp seems to rely on this. satisfy it lol
]; in # ]))
];
proj_root = builtins.toString ./../..;
in
{ {
home = { home = {
username = myHome.username; username = myHome.username;
@ -59,8 +63,8 @@ let nvim_pkgs = [
] ++ (myHome.packages or [ ]) ++ nvim_pkgs); ] ++ (myHome.packages or [ ]) ++ nvim_pkgs);
## Configs ## ## Configs ##
xdg.configFile."nvim/init.lua".text = builtins.readFile ../neovim/init.lua; xdg.configFile."nvim/init.lua".text = builtins.readFile "${proj_root}//neovim/init.lua";
xdg.configFile."starship.toml".text = builtins.readFile ../starship/starship.toml; xdg.configFile."starship.toml".text = builtins.readFile "${proj_root}//starship/starship.toml";
## Programs ## ## Programs ##
programs.jq = { programs.jq = {
@ -68,7 +72,7 @@ let nvim_pkgs = [
}; };
programs.alacritty = myHome.programs.alacritty or { programs.alacritty = myHome.programs.alacritty or {
enable = true; enable = true;
# settings = myLib.fromYaml (builtins.readFile ../alacritty/alacritty.yml); # settings = myLib.fromYaml (builtins.readFile "${proj_root}/alacritty/alacritty.yml");
}; };
# nix: Propagates the environment with packages and vars when enter (children of) # nix: Propagates the environment with packages and vars when enter (children of)
# a directory with shell.nix-compatible and .envrc # a directory with shell.nix-compatible and .envrc
@ -84,7 +88,7 @@ let nvim_pkgs = [
}; };
programs.tmux = { programs.tmux = {
enable = true; enable = true;
extraConfig = builtins.readFile ../tmux/tmux.conf; extraConfig = builtins.readFile "${proj_root}/tmux/tmux.conf";
}; };
programs.exa = { programs.exa = {
enable = true; enable = true;
@ -110,7 +114,7 @@ let nvim_pkgs = [
# I use vim-plug, so I probably don't require packaging # I use vim-plug, so I probably don't require packaging
# extraConfig actually writes to init-home-manager.vim (not lua) # extraConfig actually writes to init-home-manager.vim (not lua)
# https://github.com/nix-community/home-manager/pull/3287 # https://github.com/nix-community/home-manager/pull/3287
# extraConfig = builtins.readFile ../neovim/init.lua; # extraConfig = builtins.readFile "${proj_root}/neovim/init.lua";
}; };
programs.bash = { programs.bash = {
enable = true; enable = true;
@ -172,6 +176,6 @@ let nvim_pkgs = [
programs.ssh = { programs.ssh = {
enable = true; enable = true;
forwardAgent = true; forwardAgent = true;
extraConfig = builtins.readFile ../ssh/config; extraConfig = builtins.readFile "${proj_root}/ssh/config";
}; };
} }