mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-23 20:09:47 +01: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 {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.lspconfig.enable = true;
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
|
||||||
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -52,12 +51,12 @@ in {
|
||||||
vim.luaConfigRC.flutter-tools = entryAnywhere ''
|
vim.luaConfigRC.flutter-tools = entryAnywhere ''
|
||||||
require('flutter-tools').setup {
|
require('flutter-tools').setup {
|
||||||
lsp = {
|
lsp = {
|
||||||
color = { -- show the derived colours for dart variables
|
color = {
|
||||||
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
enabled = ${boolToString ftcfg.color.enable},
|
||||||
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
|
background = ${boolToString ftcfg.color.highlightBackground},
|
||||||
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
|
foreground = ${boolToString ftcfg.color.highlightForeground},
|
||||||
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
|
virtual_text = ${boolToString ftcfg.color.virtualText.enable},
|
||||||
virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight
|
virtual_text_str = ${toString ftcfg.color.virtualText.character}
|
||||||
},
|
},
|
||||||
|
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
|
|
@ -105,7 +105,7 @@ in {
|
||||||
|
|
||||||
character = mkOption {
|
character = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "■";
|
default = "...";
|
||||||
description = "Virtual text character to highlight";
|
description = "Virtual text character to highlight";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
@ -128,6 +129,24 @@ in {
|
||||||
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
||||||
in
|
in
|
||||||
result;
|
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 {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
configRC = {
|
configRC = {
|
||||||
|
@ -138,8 +157,11 @@ in {
|
||||||
luaScript = let
|
luaScript = let
|
||||||
mapResult = result: (wrapLuaConfig {
|
mapResult = result: (wrapLuaConfig {
|
||||||
luaBefore = "${cfg.luaConfigPre}";
|
luaBefore = "${cfg.luaConfigPre}";
|
||||||
luaConfig = concatStringsSep "\n" (map mkLuarcSection result);
|
|
||||||
luaAfter = "${cfg.luaConfigPost}";
|
luaAfter = "${cfg.luaConfigPost}";
|
||||||
|
luaConfig = formatLua {
|
||||||
|
name = "lua";
|
||||||
|
contents = concatStringsSep "\n" (map mkLuarcSection result);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
luaConfig = resolveDag {
|
luaConfig = resolveDag {
|
||||||
|
|
Loading…
Reference in a new issue