mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-08 03:45:22 +02:00
Merge branch 'main' into add-package-option
This commit is contained in:
commit
b381c38113
74 changed files with 2083 additions and 713 deletions
|
@ -1,7 +1,13 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ./helpers.nix args;
|
||||
servers = [
|
||||
{
|
||||
name = "bashls";
|
||||
description = "Enable bashls, for bash.";
|
||||
packages = [ pkgs.nodePackages.bash-language-server ];
|
||||
}
|
||||
{
|
||||
name = "clangd";
|
||||
description = "Enable clangd LSP, for C/C++.";
|
||||
|
@ -12,6 +18,102 @@ let
|
|||
description = "Enable cssls, for CSS";
|
||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||
}
|
||||
{
|
||||
name = "dartls";
|
||||
description = "Enable dart language-server, for dart";
|
||||
packages = [ pkgs.dart ];
|
||||
extraOptions = {
|
||||
analysisExcludedFolders = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = ''
|
||||
An array of paths (absolute or relative to each workspace folder) that should be
|
||||
excluded from analysis.
|
||||
'';
|
||||
};
|
||||
enableSdkFormatter = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
When set to false, prevents registration (or unregisters) the SDK formatter. When set
|
||||
to true or not supplied, will register/reregister the SDK formatter
|
||||
'';
|
||||
};
|
||||
lineLength = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
The number of characters the formatter should wrap code at. If unspecified, code will
|
||||
be wrapped at 80 characters.
|
||||
'';
|
||||
};
|
||||
completeFunctionCalls = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
When set to true, completes functions/methods with their required parameters.
|
||||
'';
|
||||
};
|
||||
showTodos = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to generate diagnostics for TODO comments. If unspecified, diagnostics will not
|
||||
be generated.
|
||||
'';
|
||||
};
|
||||
renameFilesWithClasses = mkOption {
|
||||
type = types.nullOr (types.enum [ "always" "prompt" ]);
|
||||
default = null;
|
||||
description = ''
|
||||
When set to "always", will include edits to rename files when classes are renamed if the
|
||||
filename matches the class name (but in snake_form). When set to "prompt", a prompt will
|
||||
be shown on each class rename asking to confirm the file rename. Otherwise, files will
|
||||
not be renamed. Renames are performed using LSP's ResourceOperation edits - that means
|
||||
the rename is simply included in the resulting WorkspaceEdit and must be handled by the
|
||||
client.
|
||||
'';
|
||||
};
|
||||
enableSnippets = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to include code snippets (such as class, stful, switch) in code completion. When
|
||||
unspecified, snippets will be included.
|
||||
'';
|
||||
};
|
||||
updateImportsOnRename = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to update imports and other directives when files are renamed. When unspecified,
|
||||
imports will be updated if the client supports willRenameFiles requests
|
||||
'';
|
||||
};
|
||||
documentation = mkOption {
|
||||
type = types.nullOr (types.enum [ "none" "summary" "full" ]);
|
||||
default = null;
|
||||
description = ''
|
||||
The typekind of dartdocs to include in Hovers, Code Completion, Signature Help and other
|
||||
similar requests. If not set, defaults to full
|
||||
'';
|
||||
};
|
||||
includeDependenciesInWorkspaceSymbols = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to include symbols from dependencies and Dart/Flutter SDKs in Workspace Symbol
|
||||
results. If not set, defaults to true.
|
||||
'';
|
||||
};
|
||||
};
|
||||
settings = cfg: { dart = cfg; };
|
||||
}
|
||||
{
|
||||
name = "denols";
|
||||
description = "Enable denols, for Deno";
|
||||
packages = [ pkgs.deno ];
|
||||
}
|
||||
{
|
||||
name = "eslint";
|
||||
description = "Enable eslint";
|
||||
|
@ -42,6 +144,42 @@ let
|
|||
description = "Enable jsonls, for JSON";
|
||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||
}
|
||||
{
|
||||
name = "nil_ls";
|
||||
description = "Enable nil, for Nix";
|
||||
packages = [ pkgs.nil ];
|
||||
extraOptions = {
|
||||
formatting.command = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = ''
|
||||
External formatter command (with arguments).
|
||||
It should accepts file content in stdin and print the formatted code into stdout.
|
||||
'';
|
||||
};
|
||||
diagnostics = {
|
||||
ignored = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Ignored diagnostic kinds.
|
||||
The kind identifier is a snake_cased_string usually shown together
|
||||
with the diagnostic message.
|
||||
'';
|
||||
};
|
||||
excludedFiles = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Files to exclude from showing diagnostics. Useful for generated files.
|
||||
It accepts an array of paths. Relative paths are joint to the workspace root.
|
||||
Glob patterns are currently not supported.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
settings = cfg: { nil = { inherit (cfg) formatting diagnostics; }; };
|
||||
}
|
||||
{
|
||||
name = "pyright";
|
||||
description = "Enable pyright, for Python.";
|
||||
|
@ -56,6 +194,16 @@ let
|
|||
description = "Enable rust-analyzer, for Rust.";
|
||||
serverName = "rust_analyzer";
|
||||
}
|
||||
{
|
||||
name = "tailwindcss";
|
||||
description = "Enable tailwindcss language server, for tailwindcss";
|
||||
packages = [ pkgs.nodePackages."@tailwindcss/language-server" ];
|
||||
}
|
||||
{
|
||||
name = "texlab";
|
||||
description = "Enable texlab language server, for LaTeX";
|
||||
packages = [ pkgs.texlab ];
|
||||
}
|
||||
{
|
||||
name = "tsserver";
|
||||
description = "Enable tsserver for typescript";
|
||||
|
@ -73,6 +221,12 @@ let
|
|||
name = "zls";
|
||||
description = "Enable zls, for Zig.";
|
||||
}
|
||||
{
|
||||
name = "hls";
|
||||
description = "Enable haskell language server";
|
||||
packages = [ pkgs.haskell-language-server ];
|
||||
cmd = [ "haskell-language-server-wrapper" ];
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ in
|
|||
|
||||
onAttach = mkOption {
|
||||
type = types.lines;
|
||||
description = "A lua function to be run when a new LSP buffer is attached. The argument `client` is provided.";
|
||||
description = "A lua function to be run when a new LSP buffer is attached. The argument `client` and `bufnr` is provided.";
|
||||
default = "";
|
||||
};
|
||||
|
||||
|
@ -69,7 +69,7 @@ in
|
|||
do
|
||||
${cfg.preConfig}
|
||||
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
||||
local __lspOnAttach = function(client)
|
||||
local __lspOnAttach = function(client, bufnr)
|
||||
${cfg.onAttach}
|
||||
end
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
, package ? pkgs.${name}
|
||||
, extraPackages ? { }
|
||||
, cmd ? null
|
||||
, settings ? null
|
||||
, extraOptions ? { }
|
||||
, ...
|
||||
}:
|
||||
# returns a module
|
||||
|
@ -49,6 +51,7 @@
|
|||
name = serverName;
|
||||
extraOptions = {
|
||||
inherit cmd;
|
||||
settings = if settings != null then settings cfg else { };
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
|
|
@ -8,10 +8,24 @@ in
|
|||
options = {
|
||||
plugins.lsp-lines = {
|
||||
enable = mkEnableOption "lsp_lines.nvim";
|
||||
currentLine = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Show diagnostics only on current line";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
diagnosticConfig = {
|
||||
virtual_text = false;
|
||||
virtual_lines =
|
||||
if cfg.currentLine then {
|
||||
only_current_line = true;
|
||||
} else true;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ pkgs.vimPlugins.lsp_lines-nvim ];
|
||||
|
||||
|
@ -19,9 +33,7 @@ in
|
|||
do
|
||||
require("lsp_lines").setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false
|
||||
})
|
||||
vim.diagnostic.config(${ helpers.toLuaObject diagnosticConfig })
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
|
24
plugins/nvim-lsp/trouble.nix
Normal file
24
plugins/nvim-lsp/trouble.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.plugins.trouble;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
with lib;
|
||||
# with helpers;
|
||||
{
|
||||
options.plugins.trouble = {
|
||||
enable = mkEnableOption "trouble.nvim";
|
||||
|
||||
position = helpers.mkNullOrOption (types.enum [ "top" "left" "right" "bottom" ]) "Position of the list";
|
||||
height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom";
|
||||
width = helpers.mkNullOrOption types.int "Width of the trouble list when position is left or right";
|
||||
icons = helpers.mkNullOrOption types.bool "Use devicons for filenames";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
trouble-nvim
|
||||
nvim-web-devicons
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue