From f9d95745ef4e511bea097614d03afb89e01e84bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 16 Feb 2024 01:17:58 -0300 Subject: [PATCH] kak-lsp: update config to new format --- user/kakoune/kak-lsp.toml | 263 +++++++++----------------------------- 1 file changed, 57 insertions(+), 206 deletions(-) diff --git a/user/kakoune/kak-lsp.toml b/user/kakoune/kak-lsp.toml index 413de9e..ef96bc4 100644 --- a/user/kakoune/kak-lsp.toml +++ b/user/kakoune/kak-lsp.toml @@ -7,7 +7,7 @@ verbosity = 2 # set to 0 to disable timeout = 1800 # seconds = 30 minutes -[language.angular] +[language_server.angular] filetypes = ["angular"] roots = [".angular", ".git"] command = "node" @@ -20,134 +20,80 @@ args = [ "--stdio", ] -[language.bash] +[language_server.bash-language-server] filetypes = ["sh"] roots = [".git", ".hg"] command = "bash-language-server" args = ["start"] -[language.c_cpp] +[language_server.clangd] filetypes = ["c", "cpp"] -roots = [ "compile_commands.json", ".clangd", ".git" ] +roots = ["compile_commands.json", ".clangd", ".git", ".hg"] command = "clangd" -[language.crystal] -filetypes = ["crystal"] -roots = ["shard.yml"] -command = "scry" - -[language.css] +[language_server.css-language-server] filetypes = ["css"] -roots = ["package.json"] +roots = ["package.json", ".git", ".hg"] command = "vscode-css-languageserver" args = ["--stdio"] -[language.less] +[language_server.less-language-server] filetypes = ["less"] -roots = ["package.json", ".git"] +roots = ["package.json", ".git", ".hg"] command = "vscode-css-languageserver" args = ["--stdio"] -[language.d] -filetypes = ["d", "di"] -roots = [".git", "dub.sdl", "dub.json"] -command = "dls" - -[language.dart] -# start shell to find path to dart analysis server source -filetypes = ["dart"] -roots = ["pubspec.yaml", ".git"] -command = "sh" -args = ["-c", "dart $(dirname $(which dart))/snapshots/analysis_server.dart.snapshot --lsp"] - -[language.elm] -filetypes = ["elm"] -roots = ["elm.json"] -command = "elm-language-server" -args = ["--stdio"] - -# [language.elm.initialization_options] -# runtime = "node" -# elmPath = "elm" -# elmFormatPath = "elm-format" -# elmTestPath = "elm-test" - -[language.go] -filetypes = ["go"] -roots = ["Gopkg.toml", "go.mod", ".git", ".hg"] -command = "gopls" -offset_encoding = "utf-8" - -[language.haskell] -filetypes = ["haskell"] -roots = ["Setup.hs", "stack.yaml", "*.cabal"] -command = "haskell-language-server-wrapper" -args = ["--lsp"] - -[language.html] +[language_server.html-language-server] filetypes = ["html"] roots = ["package.json"] command = "vscode-html-languageserver" args = ["--stdio"] +settings_section = "_" +[language_server.html-language-server.settings._] +# quotePreference = "single" +# javascript.format.semicolons = "insert" -[language.javascript] -filetypes = ["javascript"] -roots = [".flowconfig"] -command = "flow" -args = ["lsp"] - -[language.typescript] -filetypes = ["typescript"] -roots = ["package.json"] +[language_server.typescript-language-server] +filetypes = ["javascript", "typescript"] +roots = ["package.json", "tsconfig.json", "jsconfig.json", ".git", ".hg"] command = "typescript-language-server" args = ["--stdio"] +settings_section = "_" +[language_server.typescript-language-server.settings._] +# quotePreference = "double" +# typescript.format.semicolons = "insert" -[language.json] +[language_server.json-language-server] filetypes = ["json"] roots = ["package.json"] command = "vscode-json-languageserver" args = ["--stdio"] -[language.latex] -filetypes = ["latex"] -roots = [".git"] -command = "texlab" - -[language.nim] -filetypes = ["nim"] -roots = ["*.nimble", ".git"] -command = "nimlsp" - -[language.nix] +[language_server.rnix-lsp] filetypes = ["nix"] command = "nil" roots = ["flake.nix", "shell.nix", ".git"] [language.nix.settings.nil] formatting.command = [ "nixpkgs-fmt" ] -[language.ocaml] -filetypes = ["ocaml"] -roots = ["Makefile", "opam", "*.opam", "dune"] -command = "ocaml-language-server" -args = ["--stdio"] - -[language.php] +[language_server.intelephense] filetypes = ["php"] roots = [".htaccess", "composer.json"] command = "intelephense" args = ["--stdio"] settings_section = "intelephense" -[language.php.settings] -intelephense.format.braces = "k&r" -intelephense.storagePath = "/tmp/intelephense" -intelephense.environment.includePaths = [ +[language_server.intelephense.settings.intelephense] +storagePath = "/tmp/intelephense" + +format.braces = "k&r" +environment.includePaths = [ "./vendor", "./vendor/autoload", "./vendor/laravel/framework/", "./vendor/laravel/framework/src/", "./vendor/laravel/framework/src/Illuminate/" ] -intelephense.files.exclude = [ +files.exclude = [ "**/.git/**", "**/.svn/**", "**/.hg/**", @@ -159,42 +105,9 @@ intelephense.files.exclude = [ "**/resources/views/**" ] -[language.python] -filetypes = ["python"] -roots = ["requirements.txt", "setup.py", ".git", ".hg"] -command = "pyls" -offset_encoding = "utf-8" - -[language.reason] -filetypes = ["reason"] -roots = ["package.json", "Makefile", ".git", ".hg"] -command = "ocaml-language-server" -args = ["--stdio"] - -[language.ruby] -filetypes = ["ruby"] -roots = ["Gemfile"] -command = "solargraph" -args = ["stdio"] - -# [language.rust] -# filetypes = ["rust"] -# roots = ["Cargo.toml"] -# command = "sh" -# args = [ -# "-c", -# """ -# if path=$(rustup which rls 2>/dev/null); then -# "$path" -# else -# rls -# fi -# """, -# ] - -[language.rust] +[language_server.rust-analyzer] filetypes = ["rust"] -roots = ["rust-toolchain.toml", "rust-toolchain", "Cargo.toml"] +roots = ["Cargo.toml"] command = "sh" args = [ "-c", @@ -206,99 +119,37 @@ args = [ fi """, ] -[language.rust.settings.rust-analyzer] -## this can use too much space and processing power -# checkOnSave.extraArgs = ["--target-dir", "./target/check"] +[language_server.rust-analyzer.settings.rust-analyzer] +# See https://rust-analyzer.github.io/manual.html#configuration +# cargo.features = [] checkOnSave.command = "clippy" hoverActions.enable = false # kak-lsp doesn't support this at the moment -# procMacro.enable = true -# cargo.loadOutDirsFromCheck = true -# rustfmt.rangeFormatting.enable = true -# rustfmt.extraArgs = ["+nightly"] -[language.terraform] -filetypes = ["terraform"] -roots = ["*.tf"] -command = "terraform-ls" -args = ["serve"] - -[language.godot] +[language_server.godot] filetypes = ["gd", "gdscript", "gdscript3"] roots = ["project.godot", ".git/"] command = "nc" args = [ "localhost", "6008"] -[language.clojure] -filetypes = ["clojure"] -roots = ["project.clj", ".git/"] -command = "clojure-lsp" -args = [] - - - - -[semantic_scopes] -# Map textmate scopes to kakoune faces for semantic highlighting -# the underscores are translated to dots, and indicate nesting. -# That is, if variable_other_field is omitted, it will try the face for -# variable_other and then variable -# -# To see a list of available scopes in the debug buffer, run lsp-semantic-available-scopes -variable = "variable" -entity_name_function = "function" -entity_name_type = "type" -variable_other_enummember = "variable" -entity_name_namespace = "module" - -[semantic_modifiers] -documentation = "documentation" -readonly = "default+d" - - - -[[semantic_tokens]] -token = "comment" -face = "documentation" -modifiers = ["documentation"] - -[[semantic_tokens]] -token = "comment" -face = "comment" - -[[semantic_tokens]] -token = "function" -face = "function" - -[[semantic_tokens]] -token = "keyword" -face = "keyword" - -[[semantic_tokens]] -token = "namespace" -face = "module" - -[[semantic_tokens]] -token = "operator" -face = "operator" - -[[semantic_tokens]] -token = "string" -face = "string" - -[[semantic_tokens]] -token = "type" -face = "type" - -[[semantic_tokens]] -token = "variable" -face = "default+d" -modifiers = ["readonly"] - -[[semantic_tokens]] -token = "variable" -face = "default+d" -modifiers = ["constant"] - -[[semantic_tokens]] -token = "variable" -face = "variable" +# Semantic tokens support +# See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens +# for the default list of tokens and modifiers. +# However, many language servers implement their own values. +# Make sure to check the output of `lsp-capabilities` and each server's documentation and source code as well. +# Examples: +# - TypeScript: https://github.com/microsoft/vscode-languageserver-node/blob/main/client/src/common/semanticTokens.ts +# - Rust Analyzer: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/syntax_highlighting.rs +[semantic_tokens] +faces = [ + {face="documentation", token="comment", modifiers=["documentation"]}, + {face="comment", token="comment"}, + {face="function", token="function"}, + {face="keyword", token="keyword"}, + {face="module", token="namespace"}, + {face="operator", token="operator"}, + {face="string", token="string"}, + {face="type", token="type"}, + {face="default+d", token="variable", modifiers=["readonly"]}, + {face="default+d", token="variable", modifiers=["constant"]}, + {face="variable", token="variable"}, +]