mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 11:01:15 +00:00
POC: formatted Lua configuration
This commit is contained in:
parent
72a5e6c684
commit
8d716135af
3 changed files with 30 additions and 9 deletions
|
@ -39,7 +39,6 @@ in {
|
|||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
|
||||
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
|
@ -52,12 +51,12 @@ in {
|
|||
vim.luaConfigRC.flutter-tools = entryAnywhere ''
|
||||
require('flutter-tools').setup {
|
||||
lsp = {
|
||||
color = { -- show the derived colours for dart variables
|
||||
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
|
||||
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
|
||||
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
|
||||
virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight
|
||||
color = {
|
||||
enabled = ${boolToString ftcfg.color.enable},
|
||||
background = ${boolToString ftcfg.color.highlightBackground},
|
||||
foreground = ${boolToString ftcfg.color.highlightForeground},
|
||||
virtual_text = ${boolToString ftcfg.color.virtualText.enable},
|
||||
virtual_text_str = ${toString ftcfg.color.virtualText.character}
|
||||
},
|
||||
|
||||
capabilities = capabilities,
|
||||
|
|
|
@ -105,7 +105,7 @@ in {
|
|||
|
||||
character = mkOption {
|
||||
type = str;
|
||||
default = "■";
|
||||
default = "...";
|
||||
description = "Virtual text character to highlight";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
|
@ -128,6 +129,24 @@ in {
|
|||
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
||||
in
|
||||
result;
|
||||
|
||||
formatLua = {
|
||||
name,
|
||||
contents,
|
||||
...
|
||||
}:
|
||||
pkgs.runCommand name {inherit contents;} ''
|
||||
touch $out
|
||||
echo -n "$text" > "$out"
|
||||
|
||||
${pkgs.stylua}/bin/stylua \
|
||||
--column-width 80 \
|
||||
--no-editorconfig \
|
||||
--indent-type Spaces \
|
||||
--indent-width 4 \
|
||||
--collapse-simple-statement Never \
|
||||
"$out"
|
||||
'';
|
||||
in {
|
||||
vim = {
|
||||
configRC = {
|
||||
|
@ -138,8 +157,11 @@ in {
|
|||
luaScript = let
|
||||
mapResult = result: (wrapLuaConfig {
|
||||
luaBefore = "${cfg.luaConfigPre}";
|
||||
luaConfig = concatStringsSep "\n" (map mkLuarcSection result);
|
||||
luaAfter = "${cfg.luaConfigPost}";
|
||||
luaConfig = formatLua {
|
||||
name = "lua";
|
||||
contents = concatStringsSep "\n" (map mkLuarcSection result);
|
||||
};
|
||||
});
|
||||
|
||||
luaConfig = resolveDag {
|
||||
|
|
Loading…
Reference in a new issue