-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add additional languages LSP support plugins
Langs: - dart - nix - rust - typescript
- Loading branch information
Zoey de Souza Pessanha
committed
May 28, 2023
1 parent
7474e07
commit 5cef4ac
Showing
9 changed files
with
180 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ lib, pkgs, config, ... }: | ||
|
||
let | ||
inherit (lib) mkEnableOption mkIf writeIf; | ||
cfg = config.lvim.lsp; | ||
dart = cfg.enable && cfg.dart.enable; | ||
completion = config.lvim.completion.enable && cfg.enable; | ||
in | ||
{ | ||
options.lvim.lsp.dart.enable = mkEnableOption "Enables Dart support plugins"; | ||
|
||
config.lvim = mkIf dart { | ||
rawConfig = '' | ||
-- DART LSP CONFIG | ||
require('lspconfig').dartls.setup({ | ||
${writeIf completion '' | ||
capabilities = require("cmp_nvim_lsp").default_capabilities(), | ||
''} | ||
cmd = {"${pkgs.dart}/bin/dart", "language-server", "--protocol=lsp"} | ||
}) | ||
-- END DART LSP CONFIG | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ lib, pkgs, config, ... }: | ||
|
||
let | ||
inherit (lib) mkEnableOption mkIf writeIf; | ||
cfg = config.lvim.lsp; | ||
nix = cfg.enable && cfg.nix.enable; | ||
completion = config.lvim.completion.enable && cfg.enable; | ||
in | ||
{ | ||
options.lvim.lsp.nix.enable = mkEnableOption "Enables Nix support plugins"; | ||
|
||
config.lvim = mkIf nix { | ||
rawConfig = '' | ||
-- NIX LSP CONFIG | ||
require('lspconfig').nil_ls.setup({ | ||
${writeIf completion '' | ||
capabilities = require("cmp_nvim_lsp").default_capabilities(), | ||
''} | ||
cmd = {"${pkgs.nil}/bin/nil"} | ||
}) | ||
-- END NIX LSP CONFIG | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ lib, pkgs, config, ... }: | ||
|
||
let | ||
inherit (lib) mkEnableOption mkIf writeIf; | ||
cfg = config.lvim.lsp; | ||
rust = cfg.enable && cfg.rust.enable; | ||
completion = config.lvim.completion.enable && cfg.enable; | ||
in | ||
{ | ||
options.lvim.lsp.rust.enable = mkEnableOption "Enables Rust support plugins"; | ||
|
||
config.lvim = mkIf rust { | ||
startPlugins = with pkgs.neovimPlugins; [ rust-tools ]; | ||
nnoremap = { | ||
"<silent><leader>ri" = "<cmd>lua require('rust-tools.inlay_hints').toggle_inlay_hints()<CR>"; | ||
"<silent><leader>rr" = "<cmd>lua require('rust-tools.runnables').runnables()<CR>"; | ||
"<silent><leader>re" = "<cmd>lua require('rust-tools.expand_macro').expand_macro()<CR>"; | ||
"<silent><leader>rc" = "<cmd>lua require('rust-tools.open_cargo_toml').open_cargo_toml()<CR>"; | ||
"<silent><leader>rg" = "<cmd>lua require('rust-tools.crate_graph').view_crate_graph('x11', nil)<CR>"; | ||
}; | ||
rawConfig = '' | ||
-- NIX LSP CONFIG | ||
local rustopts = { | ||
tools = { | ||
autoSetHints = true, | ||
hover_with_actions = false, | ||
inlay_hints = { | ||
only_current_line = false, | ||
} | ||
}, | ||
server = { | ||
${writeIf completion '' | ||
capabilities = require("cmp_nvim_lsp").default_capabilities(),, | ||
''} | ||
cmd = {"${pkgs.rust-analyzer}/bin/rust-analyzer"}, | ||
} | ||
} | ||
require('rust-tools').setup(rustopts) | ||
-- END RUST LSP CONFIG | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ lib, pkgs, config, ... }: | ||
|
||
let | ||
inherit (lib) mkEnableOption mkIf writeIf; | ||
cfg = config.lvim.lsp; | ||
ts = cfg.enable && cfg.typescript.enable; | ||
completion = config.lvim.completion.enable && cfg.enable; | ||
in | ||
{ | ||
options.lvim.lsp.typescript.enable = mkEnableOption "Enables Typescript support plugins"; | ||
|
||
config.lvim = mkIf ts { | ||
startPlugins = with pkgs.neovimPlugins; [ typescript-nvim ]; | ||
rawConfig = '' | ||
-- NIX LSP CONFIG | ||
require("typescript").setup({ | ||
server = { | ||
${writeIf completion '' | ||
capabilities = require("cmp_nvim_lsp").default_capabilities(),, | ||
''} | ||
cmd = { "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server", "--stdio" } | ||
} | ||
}) | ||
-- END NIX LSP CONFIG | ||
''; | ||
}; | ||
} |