Split the lsp into a new directory and also added linters, stole straight from akari's config

This commit is contained in:
Barna Máté 2024-12-12 20:52:04 +01:00
parent 4961629dd5
commit 13fda9ebf6
13 changed files with 325 additions and 33 deletions

View file

@ -1,7 +1,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
colorschemes.oxocarbon.enable = true; colorschemes.oxocarbon.enable = true;
colorscheme = "shades_of_purple"; colorscheme = "oxocarbon";
opts = { opts = {
number = true; number = true;
@ -11,5 +11,4 @@
# Set <Space> as leader # Set <Space> as leader
globals.mapleader = " "; globals.mapleader = " ";
} }

View file

@ -4,6 +4,7 @@
./telescope ./telescope
./ui ./ui
./aw ./aw
./lang
]; ];
# Persistence # Persistence

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
plugins = {
# TODO lint
lsp.servers.csharp_ls.enable = true;
};
}

View file

@ -0,0 +1,34 @@
{ pkgs, lib, ... }:
{
plugins = {
conform-nvim.settings = {
formatters_by_ft.css = [
"prettierd"
"prettier"
];
formatters = {
prettierd.command = "${pkgs.prettierd}/bin/prettierd";
prettier.command = "${pkgs.nodePackages.prettier}/bin/prettier";
};
};
lsp.servers = {
cssls = {
enable = true;
cmd = [
"${pkgs.vscode-langservers-extracted}/bin/vscode-css-language-server"
"--stdio"
];
};
tailwindcss = {
enable = true;
cmd = [
(lib.getExe pkgs.tailwindcss-language-server)
"--stdio"
];
};
};
};
}

View file

@ -0,0 +1,16 @@
{ pkgs, ... }: {
imports = [
./css.nix
./docker.nix
./html.nix
./json.nix
./nix.nix
./rust.nix
./ts.nix
./yaml.nix
./csharp.nix
# TODO elixir
# TODO java
];
}

View file

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
plugins = {
lsp.servers = {
dockerls.enable = true;
docker_compose_language_service.enable = true;
};
lint = {
lintersByFt = {
docker = [ "hadolint" ];
};
linters = {
hadolint = {
cmd = "${pkgs.hadolint}/bin/hadolint";
};
};
};
};
}

View file

@ -0,0 +1,44 @@
{ pkgs, lib, ... }:
{
plugins = {
conform-nvim.settings = {
formatters_by_ft.html = [
"prettierd"
"prettier"
];
formatters = {
prettierd.command = "${pkgs.prettierd}/bin/prettierd";
prettier.command = "${pkgs.nodePackages.prettier}/bin/prettier";
};
};
lsp = {
servers = {
html = {
enable = true;
cmd = [
"${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server"
"--stdio"
];
};
# TODO fix
# error: The option `plugins.lsp.servers.vuels.package' was accessed but has no value defined. Try setting the option.
#vuels.enable = true; # Vue
};
enabledServers = [
{
name = "emmet_language_server";
extraOptions = {
cmd = [
(lib.getExe pkgs.emmet-language-server)
"--stdio"
];
filetypes = [ "html" ];
};
}
];
};
};
}

View file

@ -0,0 +1,32 @@
{ pkgs, ... }:
{
plugins = {
conform-nvim.settings = {
formatters_by_ft = {
json = [ "jq" ];
};
formatters = {
jq = {
command = "${pkgs.jq}/bin/jq";
};
};
};
lint = {
lintersByFt = {
json = [ "jsonlint" ];
};
linters = {
jsonlint = {
cmd = "${pkgs.nodePackages_latest.jsonlint}/bin/jsonlint";
};
};
};
lsp.servers.jsonls = {
enable = true;
};
};
}

View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
plugins = {
nix.enable = true;
hmts.enable = true;
nix-develop.enable = true;
conform-nvim.settings = {
formatters_by_ft = {
nix = [ "nixfmt-rfc-style" ];
};
formatters = {
nixfmt-rfc-style = {
command = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
};
};
};
lint = {
lintersByFt = {
nix = [ "statix" ];
};
linters = {
statix = {
cmd = "${pkgs.statix}/bin/statix";
};
};
};
};
extraConfigVim = ''
au BufRead,BufNewFile flake.lock setf json
'';
}

View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
plugins = {
lsp.servers.rust-analyzer = {
enable = true;
# Flip these in case rust is installed systemvise
installRustc = false;
installCargo = false;
settings.completion.callable.snippets = "add_parentheses";
};
lint = {
lintersByFt = {
rust = [ "cargo" ];
};
linters = {
cargo = {
cmd = "${pkgs.rustfmt}/bin/cargo-fmt";
};
};
};
};
}

View file

@ -0,0 +1,92 @@
{ pkgs, ... }:
{
plugins = {
conform-nvim.settings = {
formatters_by_ft = {
javascript = [ "eslint_d" ];
javascriptreact = [ "eslint_d" ];
typescript = [ "eslint_d" ];
typescriptreact = [ "eslint_d" ];
svelte = [ "eslint_d" ];
};
formatters.eslint_d = {
command = "${pkgs.eslint_d}/bin/eslint_d";
};
};
lsp.servers = {
svelte.enable = true;
eslint = {
enable = true;
filetypes = [
"javascript"
"javascriptreact"
"javascript.jsx"
"typescript"
"typescriptreact"
"typescript.tsx"
"vue"
"html"
"markdown"
"json"
"jsonc"
"yaml"
"toml"
"xml"
"gql"
"graphql"
"svelte"
"css"
"less"
"scss"
"pcss"
"postcss"
];
};
ts_ls = {
enable = true;
filetypes = [
"javascript"
"javascriptreact"
"typescript"
"typescriptreact"
"svelte"
];
settings = {
complete_function_calls = true;
vtsls = {
autoUseWorkspaceTsdk = true;
experimental = {
completion = {
enableServerSideFuzzyMatch = true;
};
};
};
typescript = {
updateImportsOnFileMove.enabled = "always";
suggest = {
completeFunctionCalls = true;
};
inlayHints = {
enumMemberValues.enabled = true;
functionLikeReturnTypes.enabled = true;
parameterNames.enabled = "literals";
parameterTypes.enabled = true;
propertyDeclarationTypes.enabled = true;
variableType.enabled = false;
};
};
};
};
};
ts-autotag.enable = true;
};
}

View file

@ -0,0 +1,15 @@
{
plugins.lsp.servers.yamlls = {
enable = true;
extraOptions = {
capabilities = {
textDocument = {
foldingRange = {
dynamicRegistration = false;
lineFoldingOnly = true;
};
};
};
};
};
}

View file

@ -66,37 +66,6 @@
plugins.lsp = plugins.lsp =
{ {
enable = true; enable = true;
servers = {
ts_ls.enable = true; # TS/JS
cssls.enable = true; # CSS
tailwindcss.enable = true; # TailwindCSS
html.enable = true; # HTML
astro.enable = true; # AstroJS
phpactor.enable = true; # PHP
svelte.enable = false; # Svelte
vuels.enable = false; # Vue
pyright.enable = true; # Python
marksman.enable = true; # Markdown
nil_ls.enable = true; # Nix
dockerls.enable = true; # Docker
bashls.enable = true; # Bash
clangd.enable = true; # C/C++
csharp_ls.enable = true; # C#
yamlls.enable = true; # YAML
lua_ls = {
enable = true;
settings.telemetry.enable = false;
};
#Rust
rust-analyzer = {
enable = true;
# Flip these in case rust is installed systemvise
installRustc = false;
installCargo = false;
settings.completion.callable.snippets = "add_parentheses";
};
};
}; };
plugins.none-ls = { plugins.none-ls = {