From 8571f00c1cabc846a464543b69089102c97ea43a Mon Sep 17 00:00:00 2001 From: Will Ehrendreich Date: Tue, 7 Nov 2023 15:15:29 -0600 Subject: [PATCH] fix(notify): stopped notifying about hovers --- README.mkd | 276 +++++++++++++++++++++++++++++++++----------- lua/ionide/init.lua | 27 ++--- 2 files changed, 220 insertions(+), 83 deletions(-) diff --git a/README.mkd b/README.mkd index 006e76c..50c116d 100644 --- a/README.mkd +++ b/README.mkd @@ -363,77 +363,213 @@ ionide ={ --- you're going to have to call the IonideUpdateServerConfiguration user command to to do that. --- in all likelihood, it's going to be easier to just make the setting change in your setup to ionide, and reload Neovim. settings = { - FSharp = { - abstractClassStubGeneration = true, - abstractClassStubGenerationMethodBody = 'failwith "Not Implemented"', - abstractClassStubGenerationObjectIdentifier = "this", - analyzersPath = { "packages/Analyzers", "analyzers" }, - codeLenses = { - references = { - enabled = true - }, - signature = { - enabled = true - } - }, - debug = { - checkFileDebouncerTimeout = 250, - dontCheckRelatedFiles = false, - logCheckFileDuration = false, - logDurationBetweenCheckFiles = false - }, - dotnetRoot = "", - enableAdaptiveLspServer = true, - enableAnalyzers = true, - enableMSBuildProjectGraph = true, - excludeProjectDirectories = { "paket-files", ".fable", "packages", "node_modules" }, - --Includes external (from unopened modules and namespaces) symbols in autocomplete - externalAutocomplete = false, - - fsac = { - attachDebugger = false, - conserveMemory = true, - dotnetArgs = {}, - parallelReferenceResolution = true, - silencedLogs = {}, - ---"EXPERIMENTAL. Enables the use of a new source text implementation. This may have better memory characteristics. Requires restart." - sourceTextImplementation = "RoslynSourceText" - }, - fsiCompilerToolLocations = {}, - fsiExtraParameters = { "" }, - generateBinlog = false, - indentationSize = 2, - inlayHints = { - disableLongTooltip = false, - enabled = true, - parameterNames = true, - typeAnnotations = true - }, - interfaceStubGeneration = true, - interfaceStubGenerationMethodBody = 'failwith "Not Implemented"', - interfaceStubGenerationObjectIdentifier = "this", - keywordsAutocomplete = true, - -- this seems to do nothing.. - lineLens = { - enabled = "always", - prefix = "//" - }, + FSharp = +{ - linter = true, - recordStubGeneration = true, - recordStubGenerationBody = 'failwith "Not Implemented"', - resolveNamespaces = true, - simplifyNameAnalyzer = true, - suggestSdkScripts = true, - tooltipMode = "full", - unionCaseStubGeneration = true, - unionCaseStubGenerationBody = 'failwith "Not Implemented"', - unusedDeclarationsAnalyzer = true, - unusedOpensAnalyzer = true, - useSdkScripts = true, - workspaceModePeekDeepLevel = 4 - } - } + -- `addFsiWatcher`, + addFsiWatcher = false, + -- `addPrivateAccessModifier`, + addPrivateAccessModifier = false, + -- `autoRevealInExplorer`, + autoRevealInExplorer = "sameAsFileExplorer", + -- `disableFailedProjectNotifications`, + disableFailedProjectNotifications = false, + -- `enableMSBuildProjectGraph`, + enableMSBuildProjectGraph = true, + -- `enableReferenceCodeLens`, + enableReferenceCodeLens = true, + -- `enableTouchBar`, + enableTouchBar = true, + -- `enableTreeView`, + enableTreeView = true, + -- `fsiSdkFilePath`, + fsiSdkFilePath = "", + -- `infoPanelReplaceHover`, + -- Not relevant to Neovim, currently + -- if there's a big demand I'll consider making one. + infoPanelReplaceHover = false, + -- `infoPanelShowOnStartup`, + infoPanelShowOnStartup = false, + -- `infoPanelStartLocked`, + infoPanelStartLocked = false, + -- `infoPanelUpdate`, + infoPanelUpdate = "onCursorMove", + -- `inlineValues`, + inlineValues = { enabled = true, prefix = " // " }, + -- `msbuildAutoshow`, + -- Not relevant to Neovim, currently + msbuildAutoshow = false, + -- `notifications`, + notifications = { trace = true, traceNamespaces = { "BoundModel.TypeCheck", "BackgroundCompiler." } }, + -- `openTelemetry`, + openTelemetry = { enabled = false }, + -- `pipelineHints`, + pipelineHints = { enabled = true, prefix = " // " }, + -- `saveOnSendLastSelection`, + saveOnSendLastSelection = false, + -- `showExplorerOnStartup`, + -- Not relevant to Neovim, currently + showExplorerOnStartup = false, + -- `showProjectExplorerIn`, + -- Not relevant to Neovim, currently + showProjectExplorerIn = "fsharp", + -- `simplifyNameAnalyzerExclusions`, + -- Not relevant to Neovim, currently + simplifyNameAnalyzerExclusions = { ".*\\.g\\.fs", ".*\\.cg\\.fs" }, + -- `smartIndent`, + -- Not relevant to Neovim, currently + smartIndent = true, + -- `suggestGitignore`, + suggestGitignore = true, + -- `trace`, + trace = { server = "off" }, + -- `unusedDeclarationsAnalyzerExclusions`, + unusedDeclarationsAnalyzerExclusions = { ".*\\.g\\.fs", ".*\\.cg\\.fs" }, + -- `unusedOpensAnalyzerExclusions`, + unusedOpensAnalyzerExclusions = { ".*\\.g\\.fs", ".*\\.cg\\.fs" }, + -- `verboseLogging`, + verboseLogging = false, + -- `workspacePath` + workspacePath = "", + -- `TestExplorer` = "", + -- Not relevant to Neovim, currently + TestExplorer = { AutoDiscoverTestsOnLoad = true }, + + -- { AutomaticWorkspaceInit: bool option AutomaticWorkspaceInit = false + -- WorkspaceModePeekDeepLevel: int option WorkspaceModePeekDeepLevel = 2 + workspaceModePeekDeepLevel = 4, + + fsac = { + attachDebugger = false, + cachedTypeCheckCount = 200, + conserveMemory = true, + silencedLogs = {}, + parallelReferenceResolution = true, + -- "FSharp.fsac.sourceTextImplementation": { + -- "default": "NamedText", + -- "description": "EXPERIMENTAL. Enables the use of a new source text implementation. This may have better memory characteristics. Requires restart.", + -- "enum": [ + -- "NamedText", + -- "RoslynSourceText" + -- ] + -- }, + sourceTextImplementation = "RoslynSourceText", + dotnetArgs = {}, + netCoreDllPath = "", + gc = { + conserveMemory = 0, + heapCount = 2, + noAffinitize = true, + server = true, + }, + }, + + enableAdaptiveLspServer = true, + -- ExcludeProjectDirectories: string[] option = [||] + excludeProjectDirectories = { "paket-files", ".fable", "packages", "node_modules" }, + -- KeywordsAutocomplete: bool option false + keywordsAutocomplete = true, + -- ExternalAutocomplete: bool option false + externalAutocomplete = false, + -- Linter: bool option false + linter = true, + -- IndentationSize: int option 4 + indentationSize = 2, + -- UnionCaseStubGeneration: bool option false + unionCaseStubGeneration = true, + -- UnionCaseStubGenerationBody: string option """failwith "Not Implemented" """ + unionCaseStubGenerationBody = 'failwith "Not Implemented"', + -- RecordStubGeneration: bool option false + recordStubGeneration = true, + -- RecordStubGenerationBody: string option "failwith \"Not Implemented\"" + recordStubGenerationBody = 'failwith "Not Implemented"', + -- InterfaceStubGeneration: bool option false + interfaceStubGeneration = true, + -- InterfaceStubGenerationObjectIdentifier: string option "this" + interfaceStubGenerationObjectIdentifier = "this", + -- InterfaceStubGenerationMethodBody: string option "failwith \"Not Implemented\"" + interfaceStubGenerationMethodBody = 'failwith "Not Implemented"', + -- UnusedOpensAnalyzer: bool option false + unusedOpensAnalyzer = true, + -- UnusedDeclarationsAnalyzer: bool option false + unusedDeclarationsAnalyzer = true, + -- SimplifyNameAnalyzer: bool option false + simplifyNameAnalyzer = true, + -- ResolveNamespaces: bool option false + resolveNamespaces = true, + -- EnableAnalyzers: bool option false + enableAnalyzers = true, + -- AnalyzersPath: string[] option + analyzersPath = { "packages/Analyzers", "analyzers" }, + -- DisableInMemoryProjectReferences: bool option false| + -- disableInMemoryProjectReferences = false, + + -- LineLens: LineLensConfig option + lineLens = { enabled = "always", prefix = "ll//" }, + + -- enables the use of .Net Core SDKs for script file type-checking and evaluation, + -- otherwise the .Net Framework reference lists will be used. + -- Recommended default value: `true`. + -- + useSdkScripts = true, + + suggestSdkScripts = true, + -- DotNetRoot - the path to the dotnet sdk. usually best left alone, the compiler searches for this on it's own, + dotnetRoot = "", + + -- FSIExtraParameters: string[] + -- an array of additional runtime arguments that are passed to FSI. + -- These are used when typechecking scripts to ensure that typechecking has the same context as your FSI instances. + -- An example would be to set the following parameters to enable Preview features (like opening static classes) for typechecking. + -- defaults to {} + fsiExtraParameters = {}, + + -- FSICompilerToolLocations: string[]|nil + -- passes along this list of locations to compiler tools for FSI to the FSharpCompilerServiceChecker + -- to this function in fsautocomplete + -- https://github.com/fsharp/FsAutoComplete/blob/main/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs#L99 + -- which effectively just prepends "--compilertool:" to each entry and tells the FSharpCompilerServiceChecker about it and the fsiExtraParameters + fsiCompilerToolLocations = {}, + + -- TooltipMode: string option + -- TooltipMode can be one of the following: + -- "full" -> this provides the most verbose output + -- "summary" -> this is a slimmed down version of the tooltip + -- "" or nil -> this is the old or default way, and calls TipFormatter.FormatCommentStyle.Legacy on the lsp server... *shrug* + tooltipMode = "full", + + -- GenerateBinlog + -- if true, binary logs will be generated and placed in the directory specified. They will have names of the form `{directory}/{project_name}.binlog` + -- defaults to false + generateBinlog = false, + abstractClassStubGeneration = true, + abstractClassStubGenerationObjectIdentifier = "this", + abstractClassStubGenerationMethodBody = 'failwith "Not Implemented"', + + -- configures which parts of the CodeLens are enabled, if any + -- defaults to both signature and references being true + codeLenses = { + signature = { enabled = true }, + references = { enabled = true }, + }, + + + inlayHints = { + --do these really annoy anyone? why not have em on? + enabled = true, + typeAnnotations = true, + -- Defaults to false, the more info the better, right? + disableLongTooltip = false, + parameterNames = true, + }, + + debug = { + dontCheckRelatedFiles = false, + checkFileDebouncerTimeout = 250, + logDurationBetweenCheckFiles = false, + logCheckFileDuration = false, + }, +} } ~~~ diff --git a/lua/ionide/init.lua b/lua/ionide/init.lua index f0b365c..1f886f8 100644 --- a/lua/ionide/init.lua +++ b/lua/ionide/init.lua @@ -1,4 +1,3 @@ - local validate = vim.validate local api = vim.api local uc = vim.api.nvim_create_user_command @@ -241,7 +240,7 @@ M.DefaultServerSettings = { -- Not relevant to Neovim, currently msbuildAutoshow = false, -- `notifications`, - notifications = { trace = true, traceNamespaces = { "BoundModel.TypeCheck", "BackgroundCompiler." } }, + notifications = { trace = false, traceNamespaces = { "BoundModel.TypeCheck", "BackgroundCompiler." } }, -- `openTelemetry`, openTelemetry = { enabled = false }, -- `pipelineHints`, @@ -579,7 +578,7 @@ end ---Resets the project folders and Projects tables to empty function M.ClearLocalIonideProjectsCollection() M.Projects = {} - M.projectFolders ={} + M.projectFolders = {} end function M.ParseAndReformatShowDocumentationFromHoverResponseContentLines(input, contents) @@ -610,7 +609,7 @@ function M.ParseAndReformatShowDocumentationFromHoverResponseContentLines(input, vim.schedule_wrap(function() vim.lsp.buf_request(0, parsedOrFunctionName, decodedJsonTable, function(e, r) result = vim.inspect(e) .. vim.inspect(r) - M.notify("results from request " .. vim.inspect(parsedOrFunctionName) .. ":" .. result) + -- M.notify("results from request " .. vim.inspect(parsedOrFunctionName) .. ":" .. result) table.insert(contents, result) end) end) @@ -784,11 +783,11 @@ end M["fsharp/workspacePeek"] = function(error, result, context, config) if result then local resultContent = result.content - -- M.notify( - -- "handling workspacePeek response\n" - -- .. "result is: \n" - -- .. vim.inspect(resultContent or "result.content could not be read correctly") - -- ) + M.notify( + "handling workspacePeek response\n" + .. "result is: \n" + .. vim.inspect(resultContent or "result.content could not be read correctly") + ) ---@type Solution [] local solutions = {} local directory @@ -1199,6 +1198,12 @@ end --- - Function which can be used to cancel all the requests. You could instead --- iterate all clients and call their `cancel_request()` methods. function M.CallFSharpWorkspacePeek(directoryPath, depth, excludedDirs, handler) + ---@type LspClient + -- local i= vim.lsp.get_client_by_id( + local i = vim.lsp.get_client_by_id(0) + vim.notify("Lsp peek client" .. vim.inspect(i)) + -- i. + return M.Call("fsharp/workspacePeek", M.CreateFSharpWorkspacePeekRequest(directoryPath, depth, excludedDirs), handler) end @@ -1277,10 +1282,6 @@ end ---Loads the given projects list. ---@param projects string[] -- projects only ----@return table, fun() 2-tuple: ---- - Map of client-id:request-id pairs for all successful requests. ---- - Function which can be used to cancel all the requests. You could instead ---- iterate all clients and call their `cancel_request()` methods. function M.LoadProjects(projects) if projects then for _, proj in ipairs(projects) do