mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-12 03:26:17 +00:00
76 lines
2.3 KiB
Nix
76 lines
2.3 KiB
Nix
{
|
|
lib,
|
|
pkgs,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.presets.languages.js;
|
|
in
|
|
{
|
|
options.presets.languages.js = {
|
|
enable = lib.mkEnableOption "JS";
|
|
eslint = lib.mkEnableOption "ESLint";
|
|
npm = lib.mkEnableOption "NPM package completion";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
extraConfigLua =
|
|
lib.mkIf cfg.npm # lua
|
|
''
|
|
require("cmp-npm").setup({})
|
|
'';
|
|
plugins = {
|
|
lspkind = lib.mkIf cfg.npm {
|
|
cmp.after = # lua
|
|
''
|
|
function(entry, vim_item, kind)
|
|
if entry.source.name == "npm" then
|
|
kind.kind = ""
|
|
kind.kind_hl_group = "CmpItemKindNpm"
|
|
end
|
|
kind.kind = kind.kind .. " "
|
|
return kind
|
|
end
|
|
'';
|
|
};
|
|
cmp.settings.sources = lib.mkIf cfg.npm [
|
|
{
|
|
name = "npm";
|
|
keywordLength = 4;
|
|
priority = 10;
|
|
}
|
|
];
|
|
lsp.servers = {
|
|
ts_ls = {
|
|
enable = true;
|
|
settings = {
|
|
typescript.inlayHints = {
|
|
includeInlayParameterNameHints = "all";
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
|
|
includeInlayFunctionParameterTypeHints = true;
|
|
includeInlayVariableTypeHints = true;
|
|
includeInlayVariableTypeHintsWhenTypeMatchesName = true;
|
|
includeInlayPropertyDeclarationTypeHints = true;
|
|
includeInlayFunctionLikeReturnTypeHints = true;
|
|
includeInlayEnumMemberValueHints = true;
|
|
};
|
|
javascript.inlayHints = {
|
|
includeInlayParameterNameHints = "all";
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
|
|
includeInlayFunctionParameterTypeHints = true;
|
|
includeInlayVariableTypeHints = true;
|
|
includeInlayVariableTypeHintsWhenTypeMatchesName = true;
|
|
includeInlayPropertyDeclarationTypeHints = true;
|
|
includeInlayFunctionLikeReturnTypeHints = true;
|
|
includeInlayEnumMemberValueHints = true;
|
|
};
|
|
};
|
|
};
|
|
eslint.enable = lib.mkIf cfg.eslint true;
|
|
};
|
|
};
|
|
extraPackages = [ pkgs.nodePackages.typescript-language-server ];
|
|
};
|
|
}
|