mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 22:55:58 +01:00
Compare commits
2 commits
20c2ef7fa1
...
3e4e92ec9f
Author | SHA1 | Date | |
---|---|---|---|
|
3e4e92ec9f | ||
41830a79b8 |
1 changed files with 22 additions and 17 deletions
|
@ -26,10 +26,10 @@
|
||||||
ccls = {
|
ccls = {
|
||||||
package = pkgs.ccls;
|
package = pkgs.ccls;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.ccls.setup{
|
lspconfig.ccls.setup {
|
||||||
capabilities = capabilities;
|
capabilities = capabilities,
|
||||||
on_attach=default_on_attach;
|
on_attach=default_on_attach,
|
||||||
cmd = ${packageToCmd cfg.lsp.package "ccls"};
|
cmd = ${packageToCmd cfg.lsp.package "ccls"},
|
||||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
|
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
@ -40,10 +40,10 @@
|
||||||
local clangd_cap = capabilities
|
local clangd_cap = capabilities
|
||||||
-- use same offsetEncoding as null-ls
|
-- use same offsetEncoding as null-ls
|
||||||
clangd_cap.offsetEncoding = {"utf-16"}
|
clangd_cap.offsetEncoding = {"utf-16"}
|
||||||
lspconfig.clangd.setup{
|
lspconfig.clangd.setup {
|
||||||
capabilities = clangd_cap;
|
capabilities = clangd_cap,
|
||||||
on_attach=default_on_attach;
|
on_attach=default_on_attach,
|
||||||
cmd = ${packageToCmd cfg.lsp.package "clangd"};
|
cmd = ${packageToCmd cfg.lsp.package "clangd"},
|
||||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
|
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
@ -83,12 +83,16 @@ in {
|
||||||
enable = mkEnableOption "C/C++ language support";
|
enable = mkEnableOption "C/C++ language support";
|
||||||
|
|
||||||
cHeader = mkOption {
|
cHeader = mkOption {
|
||||||
description = ''
|
|
||||||
C syntax for headers. Can fix treesitter errors, see:
|
|
||||||
https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/
|
|
||||||
'';
|
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Enable C syntax for headers.
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
This can potentially fix Treesitter errors for headers. See [this reddit
|
||||||
|
post] https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/
|
||||||
|
:::
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
|
@ -107,16 +111,16 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "clang LSP server package, or the command to run as a list of strings";
|
|
||||||
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
|
||||||
type = either package (listOf str);
|
type = either package (listOf str);
|
||||||
default = servers.${cfg.lsp.server}.package;
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
||||||
|
description = "clang LSP server package, or the command to run as a list of strings";
|
||||||
};
|
};
|
||||||
|
|
||||||
opts = mkOption {
|
opts = mkOption {
|
||||||
description = "Options to pass to clang LSP server";
|
default = "--offset-encoding=utf-16";
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
description = "Options to pass to clang LSP server";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,11 +130,13 @@ in {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = config.vim.languages.enableDAP;
|
default = config.vim.languages.enableDAP;
|
||||||
};
|
};
|
||||||
|
|
||||||
debugger = mkOption {
|
debugger = mkOption {
|
||||||
description = "clang debugger to use";
|
description = "clang debugger to use";
|
||||||
type = enum (attrNames debuggers);
|
type = enum (attrNames debuggers);
|
||||||
default = defaultDebugger;
|
default = defaultDebugger;
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "clang debugger package.";
|
description = "clang debugger package.";
|
||||||
type = package;
|
type = package;
|
||||||
|
@ -151,7 +157,6 @@ in {
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.lspconfig.enable = true;
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
|
||||||
vim.lsp.lspconfig.sources.clang-lsp = servers.${cfg.lsp.server}.lspConfig;
|
vim.lsp.lspconfig.sources.clang-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue