diff --git a/kakoune/kak-lsp.nix b/kakoune/kak-lsp.nix new file mode 100644 index 0000000..de350ec --- /dev/null +++ b/kakoune/kak-lsp.nix @@ -0,0 +1,32 @@ +{ config, pkgs, lib, ... }: + +let + rev = "5bcb2a5fad27bc2871cc3fb0d15e5c7c1074d8b9"; + version = "r${builtins.substring 0 6 rev}"; + + kak-lsp = pkgs.kak-lsp.overrideAttrs (drv: rec { + inherit rev version; + buildInputs = drv.buildInputs ++ + (with pkgs; lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.SystemConfiguration); + src = pkgs.fetchFromGitHub { + owner = "kak-lsp"; + repo = "kak-lsp"; + rev = rev; + sha256 = "1j6mdcg6zrbirmy5n1zbin5h8jn1m2xxy8chsdwgmaw7mj8d527z"; + }; + + cargoDeps = drv.cargoDeps.overrideAttrs (lib.const { + inherit src; + outputHash = "1risazihwy6v3rc1lxram0z2my29b3w52d827963b7zfahgmsaq5"; + }); + }); +in +{ + home.packages = [ kak-lsp ]; + + # Configurations + home.file."kakoune/kak-lsp.toml" = { + source = ./. + "/kak-lsp.toml"; + target = ".config/kak-lsp/kak-lsp.toml"; + }; +} diff --git a/kakoune/kak-lsp.toml b/kakoune/kak-lsp.toml new file mode 100644 index 0000000..244d42f --- /dev/null +++ b/kakoune/kak-lsp.toml @@ -0,0 +1,162 @@ +snippet_support = false +verbosity = 255 + +[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" + +[server] +# exit session if no requests were received during given period in seconds +# works only in unix sockets mode (-s/--session) +# set to 0 to disable +timeout = 1800 # seconds = 30 minutes + +[language.rust] +filetypes = ["rust"] +roots = ["Cargo.toml"] +command = "rust-analyzer" +args = [] + +[language.crystal] +filetypes = ["crystal"] +roots = ["shard.yml"] +command = "scry" + +[language.javascript] +filetypes = ["javascript"] +roots = [".flowconfig"] +command = "flow" +args = ["lsp"] + +[language.json] +filetypes = ["json"] +roots = ["package.json"] +command = "json-languageserver" +args = ["--stdio"] + +[language.css] +filetypes = ["css"] +roots = ["package.json"] +command = "css-languageserver" +args = ["--stdio"] + +[language.html] +filetypes = ["html"] +roots = ["package.json"] +command = "html-languageserver" +args = ["--stdio"] + +[language.ocaml] +filetypes = ["ocaml"] +roots = ["Makefile", "opam", "*.opam", "dune", ".merlin", ".ocamlformat"] +command = "ocamllsp" +args = [] + +[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.python] +filetypes = ["python"] +roots = ["requirements.txt", "setup.py", ".git", ".hg"] +command = "pyls" +offset_encoding = "utf-8" + +[language.c_cpp] +filetypes = ["c", "cpp"] +roots = ["compile_commands.json", ".cquery", ".git"] +command = "ccls" +args = ["-v=2", "-log-file=/tmp/ccls.log"] + +[language.haskell] +filetypes = ["haskell"] +roots = ["Setup.hs", "stack.yaml", "*.cabal"] +command = "haskell-language-server-wrapper" +args = ["--lsp"] + +[language.go] +filetypes = ["go"] +roots = ["Gopkg.toml", "go.mod", ".git", ".hg"] +command = "gopls" +offset_encoding = "utf-8" +settings_section = "gopls" + +[language.go.settings.gopls] +semanticTokens = true +hoverKind = "SynopsisDocumentation" + +[language.bash] +filetypes = ["sh"] +roots = [".git", ".hg"] +command = "bash-language-server" +args = ["start"] + +[language.dart] +filetypes = ["dart"] +roots = ["pubspec.yaml", ".git"] +command = "dart_language_server" + +[language.d] +filetypes = ["d", "di"] +roots = [".git", "dub.sdl", "dub.json"] +command = "dls" + +[language.php] +filetypes = ["php"] +roots = [".htaccess", "composer.json"] +command = "intelephense" +args = ["--stdio"] + +[language.nim] +filetypes = ["nim"] +roots = ["*.nimble", ".git"] +command = "nimlsp" + +[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.latex] +filetypes = ["latex"] +roots = [".git"] +command = "texlab" + +[language.racket] +filetypes = ["racket"] +roots = [".git"] +command = "racket" +args = ["-l", "racket-langserver"] + +[language.fsharp] +filetypes = ["fsharp"] +roots = [".git", "*.fsx"] +command = "FSharpLanguageServer" +# command = "dotnet" +# args = ["/home/natsukagami/Projects/FsAutoComplete/bin/release_netcore/fsautocomplete.dll", "--background-service-enabled"] + + diff --git a/kakoune/kak.nix b/kakoune/kak.nix index cae1075..4bff56e 100644 --- a/kakoune/kak.nix +++ b/kakoune/kak.nix @@ -35,6 +35,8 @@ let }; in { + imports = [ ./kak-lsp.nix ]; + # Enable the kakoune package. home.packages = [ kakounePkg ];