diff --git a/modules/plugins/lsp/presets/default.nix b/modules/plugins/lsp/presets/default.nix index 9381c80a..23dd7525 100644 --- a/modules/plugins/lsp/presets/default.nix +++ b/modules/plugins/lsp/presets/default.nix @@ -7,6 +7,7 @@ ./bash-language-server.nix ./deno.nix ./emmet-ls.nix + ./fsautocomplete.nix ./gleam.nix ./glsl_analyzer.nix ./gopls.nix diff --git a/modules/plugins/lsp/presets/fsautocomplete.nix b/modules/plugins/lsp/presets/fsautocomplete.nix new file mode 100644 index 00000000..8fcd5e39 --- /dev/null +++ b/modules/plugins/lsp/presets/fsautocomplete.nix @@ -0,0 +1,54 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf; + inherit (lib.options) mkEnableOption; + inherit (lib.generators) mkLuaInline; + + cfg = config.vim.lsp.presets.fsautocomplete; +in { + options.vim.lsp.presets.fsautocomplete = { + enable = mkEnableOption "the F# Autocomplete Language Server"; + }; + + config = mkIf cfg.enable { + vim.lsp.servers.fsautocomplete = { + enable = true; + cmd = [(getExe pkgs.fsautocomplete) "--adaptive-lsp-server-enabled"]; + 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; + }; + }; + }; + }; +}