Add clojure support to editor

This commit is contained in:
Riley Apeldoorn 2022-06-22 16:51:02 +02:00
parent 3bdb545681
commit afc03fe0cf
3 changed files with 29 additions and 3 deletions

View file

@ -2,6 +2,7 @@
# Feature flags # Feature flags
typescript ? false, typescript ? false,
haskell ? false, haskell ? false,
clojure ? false,
python ? false, python ? false,
rust ? false, rust ? false,
nix ? true, nix ? true,
@ -53,7 +54,7 @@ let semantic-tokens =
}); });
kak-lsp-config-text = concatStringsSep "\n" ( kak-lsp-config-text = concatStringsSep "\n" (
(optional (rust || haskell) semantic-tokens) (optional (rust || haskell || clojure) semantic-tokens)
++ (optional rust '' ++ (optional rust ''
[language.rust] [language.rust]
filetypes = [ "rust" ] filetypes = [ "rust" ]
@ -78,6 +79,12 @@ let semantic-tokens =
command = "haskell-language-server-wrapper" command = "haskell-language-server-wrapper"
args = [ "--lsp" ] args = [ "--lsp" ]
'') '')
++ (optional clojure ''
[language.clojure]
filetypes = ["clojure"]
roots = ["project.clj", "deps.edn", ".lsp/config.edn", ".git/"]
command = "clojure-lsp"
'')
++ (optional python '' ++ (optional python ''
[language.python] [language.python]
filetypes = [ "python" ] filetypes = [ "python" ]
@ -113,6 +120,7 @@ in (symlinkJoin {
] ++ (optional nix rnix-lsp) ] ++ (optional nix rnix-lsp)
++ (optional typescript rslint) ++ (optional typescript rslint)
++ (optional haskell haskell-language-server) ++ (optional haskell haskell-language-server)
++ (optional clojure clojure-lsp)
++ (optional python python39Packages.python-lsp-server) ++ (optional python python39Packages.python-lsp-server)
++ (optional rust rust-analyzer); ++ (optional rust rust-analyzer);

View file

@ -2,8 +2,10 @@
{ {
# Feature flags # Feature flags
clipboard ? false,
typescript ? false, typescript ? false,
haskell ? false, haskell ? false,
clojure ? false,
python ? false, python ? false,
rust ? false, rust ? false,
nix ? true, nix ? true,
@ -24,8 +26,10 @@
}: }:
let kakrc = (import ./kakrc.nix { let kakrc = (import ./kakrc.nix {
inherit typescript inherit clipboard
typescript
haskell haskell
clojure
python python
rust rust
nix nix
@ -43,6 +47,7 @@ let kakrc = (import ./kakrc.nix {
kak-lsp = (import ./kak-lsp.nix { kak-lsp = (import ./kak-lsp.nix {
inherit typescript inherit typescript
haskell haskell
clojure
python python
rust rust
nix nix

View file

@ -2,8 +2,10 @@
{ {
# Feature flags # Feature flags
clipboard ? false,
typescript ? false, typescript ? false,
haskell ? false, haskell ? false,
clojure ? false,
python ? false, python ? false,
rust ? false, rust ? false,
nix ? true, nix ? true,
@ -20,7 +22,10 @@
let keybinds = '' let keybinds = ''
map global insert <a-tab> <esc>:buffer-next<ret> map global insert <a-tab> <esc>:buffer-next<ret>
map global normal <a-tab> :buffer-next<ret> map global normal <a-tab> :buffer-next<ret>
''; '' + (lib.optionalString clipboard ''
map global user y <a-|>c<ret>
map global user p !p<ret>
'');
# Initialization code for IDE mode needed for every supported # Initialization code for IDE mode needed for every supported
# language, and inlay diagnostics. # language, and inlay diagnostics.
@ -94,6 +99,13 @@ let nix-config = (lib.optionalString nix ''
} }
''); '');
# Clojure-lsp has all the IDE features I use.
clojure-config = (lib.optionalString clojure ''
hook global WinSetOption filetype=clojure %{
${ide-full}
}
'');
# Haskell development. Haskell has a language server with # Haskell development. Haskell has a language server with
# the features in `ide-full`. # the features in `ide-full`.
haskell-config = (lib.optionalString haskell '' haskell-config = (lib.optionalString haskell ''
@ -159,6 +171,7 @@ in pkgs.writeTextFile (rec {
${typescript-config} ${typescript-config}
${haskell-config} ${haskell-config}
${clojure-config}
${python-config} ${python-config}
${rust-config} ${rust-config}
${nix-config} ${nix-config}