From a4e4c067c584e0d7a93f8c440d54bda8d4ee6794 Mon Sep 17 00:00:00 2001 From: Krzysztof Cieslak Date: Tue, 16 Aug 2022 18:22:06 +0200 Subject: [PATCH 1/2] Nicer UX in case of error case in CodeLensResolve --- src/FsAutoComplete/FsAutoComplete.Lsp.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FsAutoComplete/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/FsAutoComplete.Lsp.fs index 7e87c2889..0315debd5 100644 --- a/src/FsAutoComplete/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/FsAutoComplete.Lsp.fs @@ -1805,8 +1805,8 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = Log.setMessage "CodeLensResolve - Cached typecheck results now available for {file}." >> Log.addContextDestructured "file" file ) - - let! r = Async.Catch(f arg pos tyRes lines lineStr data.[1] file) + let typ = data.[1] + let! r = Async.Catch(f arg pos tyRes lines lineStr typ file) match r with | Choice1Of2 (r: LspResult) -> @@ -1819,8 +1819,8 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = >> Log.addContextDestructured "file" file >> Log.addExn e ) - - return { p with Command = None } |> success + let title = if typ = "signature" then "" else "0 References" + return { p with Command = Some { Title = title; Command = ""; Arguments = None } } |> success } with e -> logger.error ( From 098b0039caff8cb4fef96edcf56f645f41675960 Mon Sep 17 00:00:00 2001 From: Krzysztof Cieslak Date: Tue, 16 Aug 2022 18:24:08 +0200 Subject: [PATCH 2/2] Format --- src/FsAutoComplete/FsAutoComplete.Lsp.fs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/FsAutoComplete/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/FsAutoComplete.Lsp.fs index 0315debd5..3e685a543 100644 --- a/src/FsAutoComplete/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/FsAutoComplete.Lsp.fs @@ -1805,6 +1805,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = Log.setMessage "CodeLensResolve - Cached typecheck results now available for {file}." >> Log.addContextDestructured "file" file ) + let typ = data.[1] let! r = Async.Catch(f arg pos tyRes lines lineStr typ file) @@ -1819,8 +1820,17 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = >> Log.addContextDestructured "file" file >> Log.addExn e ) + let title = if typ = "signature" then "" else "0 References" - return { p with Command = Some { Title = title; Command = ""; Arguments = None } } |> success + + return + { p with + Command = + Some + { Title = title + Command = "" + Arguments = None } } + |> success } with e -> logger.error (