mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 14:45:58 +01:00
languages/clang: set default clang LSP encoding as utf-16
This commit is contained in:
parent
e0790f2bdb
commit
41830a79b8
1 changed files with 22 additions and 17 deletions
|
@ -26,10 +26,10 @@
|
|||
ccls = {
|
||||
package = pkgs.ccls;
|
||||
lspConfig = ''
|
||||
lspconfig.ccls.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach=default_on_attach;
|
||||
cmd = ${packageToCmd cfg.lsp.package "ccls"};
|
||||
lspconfig.ccls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach=default_on_attach,
|
||||
cmd = ${packageToCmd cfg.lsp.package "ccls"},
|
||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
|
||||
}
|
||||
'';
|
||||
|
@ -40,10 +40,10 @@
|
|||
local clangd_cap = capabilities
|
||||
-- use same offsetEncoding as null-ls
|
||||
clangd_cap.offsetEncoding = {"utf-16"}
|
||||
lspconfig.clangd.setup{
|
||||
capabilities = clangd_cap;
|
||||
on_attach=default_on_attach;
|
||||
cmd = ${packageToCmd cfg.lsp.package "clangd"};
|
||||
lspconfig.clangd.setup {
|
||||
capabilities = clangd_cap,
|
||||
on_attach=default_on_attach,
|
||||
cmd = ${packageToCmd cfg.lsp.package "clangd"},
|
||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
|
||||
}
|
||||
'';
|
||||
|
@ -83,12 +83,16 @@ in {
|
|||
enable = mkEnableOption "C/C++ language support";
|
||||
|
||||
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;
|
||||
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 = {
|
||||
|
@ -107,16 +111,16 @@ in {
|
|||
};
|
||||
|
||||
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);
|
||||
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 {
|
||||
description = "Options to pass to clang LSP server";
|
||||
default = "--offset-encoding=utf-16";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Options to pass to clang LSP server";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -126,11 +130,13 @@ in {
|
|||
type = bool;
|
||||
default = config.vim.languages.enableDAP;
|
||||
};
|
||||
|
||||
debugger = mkOption {
|
||||
description = "clang debugger to use";
|
||||
type = enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "clang debugger package.";
|
||||
type = package;
|
||||
|
@ -151,7 +157,6 @@ in {
|
|||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
|
||||
vim.lsp.lspconfig.sources.clang-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue