Set a new set of semantic tokens
This commit is contained in:
parent
9fb22cb082
commit
b8ea7dd266
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,2 @@
|
||||||
home.nix
|
home.nix
|
||||||
/result
|
result
|
||||||
|
|
|
@ -5,6 +5,26 @@ face global BufferPadding rgb:A0A0A0,default
|
||||||
face global MenuForeground blue,white+bF
|
face global MenuForeground blue,white+bF
|
||||||
face global MenuBackground bright-blue,white+F
|
face global MenuBackground bright-blue,white+F
|
||||||
face global Information bright-blue,white
|
face global Information bright-blue,white
|
||||||
|
# Markdown help color scheme
|
||||||
|
face global InfoDefault Information
|
||||||
|
face global InfoBlock @block
|
||||||
|
face global InfoBlockQuote +i@block
|
||||||
|
face global InfoBullet @bullet
|
||||||
|
face global InfoHeader @header
|
||||||
|
face global InfoLink @link
|
||||||
|
face global InfoLinkMono +b@mono
|
||||||
|
face global InfoMono @mono
|
||||||
|
face global InfoRule +b@Information
|
||||||
|
face global InfoDiagnosticError @DiagnosticError
|
||||||
|
face global InfoDiagnosticHint @DiagnosticHint
|
||||||
|
face global InfoDiagnosticInformation @Information
|
||||||
|
face global InfoDiagnosticWarning @DiagnosticWarning
|
||||||
|
# Extra faces
|
||||||
|
face global macro +b@function
|
||||||
|
face global method +i@function
|
||||||
|
face global format_specifier +i@string
|
||||||
|
face global mutable_variable +u@variable
|
||||||
|
face global class +b@variable
|
||||||
|
|
||||||
# Enable line numbers
|
# Enable line numbers
|
||||||
addhl global/ number-lines
|
addhl global/ number-lines
|
||||||
|
@ -101,13 +121,16 @@ hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c
|
||||||
lsp-auto-hover-enable
|
lsp-auto-hover-enable
|
||||||
# lsp-auto-hover-insert-mode-enable
|
# lsp-auto-hover-insert-mode-enable
|
||||||
set buffer lsp_hover_anchor true
|
set buffer lsp_hover_anchor true
|
||||||
|
lsp-inlay-diagnostics-enable buffer
|
||||||
}
|
}
|
||||||
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|haskell|nix) %{
|
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|haskell|nix) %{
|
||||||
|
# Note that fsharp is not here
|
||||||
|
lsp-inlay-hints-enable buffer
|
||||||
# Format the document if possible
|
# Format the document if possible
|
||||||
hook window BufWritePre .* %{ lsp-formatting-sync }
|
hook window BufWritePre .* %{ lsp-formatting-sync }
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global WinSetOption filetype=(rust|go) %{
|
hook global WinSetOption filetype=(rust|go|fsharp) %{
|
||||||
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
|
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
|
||||||
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
|
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
|
||||||
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
|
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
|
||||||
|
@ -116,15 +139,6 @@ hook global WinSetOption filetype=(rust|go) %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global WinSetOption filetype=rust %{
|
|
||||||
hook window -group rust-inlay-hints BufReload .* rust-analyzer-inlay-hints
|
|
||||||
hook window -group rust-inlay-hints NormalIdle .* rust-analyzer-inlay-hints
|
|
||||||
hook window -group rust-inlay-hints InsertIdle .* rust-analyzer-inlay-hints
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{
|
|
||||||
remove-hooks window rust-inlay-hints
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# <a-a> in Insert mode moves to end of line.
|
# <a-a> in Insert mode moves to end of line.
|
||||||
map global insert <a-a> '<esc>A'
|
map global insert <a-a> '<esc>A'
|
||||||
|
|
||||||
|
|
|
@ -152,13 +152,35 @@ let
|
||||||
roots = [ "Cargo.toml" ];
|
roots = [ "Cargo.toml" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
semantic_scopes = {
|
semantic_tokens.faces = [
|
||||||
entity_name_function = "function";
|
## Items
|
||||||
entity_name_namespace = "module";
|
# (Rust) Macros
|
||||||
entity_name_type = "type";
|
{ face = "attribute"; token = "attribute"; }
|
||||||
variable = "variable";
|
{ face = "attribute"; token = "derive"; }
|
||||||
variable_other_enummember = "variable";
|
{ face = "macro"; token = "macro"; } # Function-like Macro
|
||||||
};
|
# Keyword and Fixed Tokens
|
||||||
|
{ face = "keyword"; token = "keyword"; }
|
||||||
|
{ face = "operator"; token = "operator"; }
|
||||||
|
# Functions and Methods
|
||||||
|
{ face = "function"; token = "function"; }
|
||||||
|
{ face = "method"; token = "method"; }
|
||||||
|
# Constants
|
||||||
|
{ face = "string"; token = "string"; }
|
||||||
|
{ face = "format_specifier"; token = "formatSpecifier"; }
|
||||||
|
# Variables
|
||||||
|
{ face = "mutable_variable"; token = "variable"; modifiers = [ "mutable" ]; }
|
||||||
|
{ face = "variable"; token = "variable"; }
|
||||||
|
{ face = "module"; token = "namespace"; }
|
||||||
|
{ face = "variable"; token = "type_parameter"; }
|
||||||
|
{ face = "class"; token = "enum"; }
|
||||||
|
{ face = "class"; token = "struct"; }
|
||||||
|
{ face = "class"; token = "trait"; }
|
||||||
|
{ face = "class"; token = "union"; }
|
||||||
|
|
||||||
|
## Comments
|
||||||
|
{ face = "documentation"; token = "comment"; modifiers = [ "documentation" ]; }
|
||||||
|
{ face = "comment"; token = "comment"; }
|
||||||
|
];
|
||||||
server = { timeout = 1800; };
|
server = { timeout = 1800; };
|
||||||
snippet_support = false;
|
snippet_support = false;
|
||||||
verbosity = 255;
|
verbosity = 255;
|
||||||
|
@ -218,10 +240,10 @@ in
|
||||||
description = "Enable snippet support";
|
description = "Enable snippet support";
|
||||||
};
|
};
|
||||||
|
|
||||||
semanticScopes = mkOption {
|
semanticTokens.faces = mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.listOf types.anything;
|
||||||
default = lspConfig.semantic_scopes;
|
default = lspConfig.semantic_tokens.faces;
|
||||||
description = "The semantic scopes mapping given to kak";
|
description = "The semantic tokens faces mapping given to kak";
|
||||||
};
|
};
|
||||||
|
|
||||||
serverTimeout = mkOption {
|
serverTimeout = mkOption {
|
||||||
|
@ -250,7 +272,7 @@ in
|
||||||
yj -jt -i \
|
yj -jt -i \
|
||||||
< ${
|
< ${
|
||||||
pkgs.writeText "config.json" (builtins.toJSON {
|
pkgs.writeText "config.json" (builtins.toJSON {
|
||||||
semantic_scopes = cfg.semanticScopes;
|
semantic_tokens.faces = cfg.semanticTokens.faces;
|
||||||
server.timeout = cfg.serverTimeout;
|
server.timeout = cfg.serverTimeout;
|
||||||
snippet_support = cfg.enableSnippets;
|
snippet_support = cfg.enableSnippets;
|
||||||
verbosity = 255;
|
verbosity = 255;
|
||||||
|
|
Loading…
Reference in a new issue