mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-28 04:15:21 +00:00
languages/fsharp: refactor lsp.servers to use lsp/presets/<name>
This commit is contained in:
parent
56b62f79ea
commit
dcf3288ede
1 changed files with 10 additions and 45 deletions
|
|
@ -6,50 +6,15 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.types) enum;
|
inherit (lib.types) enum listOf;
|
||||||
|
inherit (lib) genAttrs;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.generators) mkLuaInline;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
defaultServer = ["fsautocomplete"];
|
defaultServer = ["fsautocomplete"];
|
||||||
servers = {
|
servers = ["fsautocomplete"];
|
||||||
fsautocomplete = {
|
|
||||||
cmd = [(getExe pkgs.fsautocomplete) "--adaptive-lsp-server-enabled"];
|
|
||||||
filetypes = ["fsharp"];
|
|
||||||
root_dir = mkLuaInline ''
|
|
||||||
function(bufnr, on_dir)
|
|
||||||
on_dir(vim.fs.root(bufnr, function(name, path)
|
|
||||||
return name == ".git" or name:match("%.sln$") or name:match("%.fsproj$")
|
|
||||||
end))
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
init_options = {
|
|
||||||
AutomaticWorkspaceInit = true;
|
|
||||||
};
|
|
||||||
settings = {
|
|
||||||
FSharp = {
|
|
||||||
keywordsAutocomplete = true;
|
|
||||||
ExternalAutocomplete = false;
|
|
||||||
Linter = true;
|
|
||||||
UnionCaseStubGeneration = true;
|
|
||||||
UnionCaseStubGenerationBody = ''failwith "Not Implemented"'';
|
|
||||||
RecordStubGeneration = true;
|
|
||||||
RecordStubGenerationBody = ''failwith "Not Implemented"'';
|
|
||||||
InterfaceStubGeneration = true;
|
|
||||||
InterfaceStubGenerationObjectIdentifier = "this";
|
|
||||||
InterfaceStubGenerationMethodBody = ''failwith "Not Implemented"'';
|
|
||||||
UnusedOpensAnalyzer = true;
|
|
||||||
UnusedDeclarationsAnalyzer = true;
|
|
||||||
UseSdkScripts = true;
|
|
||||||
SimplifyNameAnalyzer = true;
|
|
||||||
ResolveNamespaces = true;
|
|
||||||
EnableReferenceCodeLens = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultFormat = ["fantomas"];
|
defaultFormat = ["fantomas"];
|
||||||
formats = {
|
formats = {
|
||||||
|
|
@ -82,7 +47,7 @@ in {
|
||||||
defaultText = literalExpression "config.vim.lsp.enable";
|
defaultText = literalExpression "config.vim.lsp.enable";
|
||||||
};
|
};
|
||||||
servers = mkOption {
|
servers = mkOption {
|
||||||
type = deprecatedSingleOrListOf "vim.language.fsharp.lsp.servers" (enum (attrNames servers));
|
type = listOf (enum servers);
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
description = "F# LSP server to use";
|
description = "F# LSP server to use";
|
||||||
};
|
};
|
||||||
|
|
@ -106,12 +71,12 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.servers =
|
vim.lsp = {
|
||||||
mapListToAttrs (name: {
|
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
|
||||||
inherit name;
|
servers = genAttrs cfg.lsp.servers (_: {
|
||||||
value = servers.${name};
|
filetypes = ["fsharp"];
|
||||||
})
|
});
|
||||||
cfg.lsp.servers;
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue