Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Cancel a Work Done Progress #1274

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<NoWarn>$(NoWarn);3186,0042</NoWarn><!-- circumvent an error with the fake dependencymanager for
paket: https://github.com/dotnet/fsharp/issues/8678 -->
<NoWarn>$(NoWarn);NU1902</NoWarn><!-- NU1902 - package vulnerability detected -->
<WarnOn>$(WarnOn);1182</WarnOn> <!-- Unused
variables,https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#opt-in-warnings -->
<WarnOn>$(WarnOn);1182</WarnOn> <!-- Unused variables,https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#opt-in-warnings -->
<NoWarn>$(NoWarn);FS0044</NoWarn> <!-- Ignore deprecations -->
baronfel marked this conversation as resolved.
Show resolved Hide resolved
<WarnOn>$(WarnOn);3390</WarnOn><!-- Malformed XML doc comments -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ChangelogFile>$(MSBuildThisFileDirectory)CHANGELOG.md</ChangelogFile>
Expand Down
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ nuget Expecto.Diff
nuget YoloDev.Expecto.TestSdk
nuget AltCover
nuget GitHubActionsTestLogger
nuget Ionide.LanguageServerProtocol >= 0.4.20
nuget Ionide.LanguageServerProtocol >= 0.4.23
baronfel marked this conversation as resolved.
Show resolved Hide resolved
nuget Microsoft.Extensions.Caching.Memory
nuget OpenTelemetry.Api >= 1.3.2
nuget OpenTelemetry.Exporter.OpenTelemetryProtocol >= 1.3.2 # 1.4 bumps to 7.0 versions of System.Diagnostics libs, so can't use it
Expand Down
2 changes: 1 addition & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ NUGET
System.Reflection.Metadata (>= 5.0)
Ionide.Analyzers (0.10)
Ionide.KeepAChangelog.Tasks (0.1.8) - copy_local: true
Ionide.LanguageServerProtocol (0.4.20)
Ionide.LanguageServerProtocol (0.4.23)
FSharp.Core (>= 6.0)
Newtonsoft.Json (>= 13.0.1)
StreamJsonRpc (>= 2.16.36)
Expand Down
14 changes: 8 additions & 6 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ type AdaptiveFSharpLspServer
// Otherwise we'll fail here and our retry logic will come into place
do!
match p.Context with
| Some({ triggerKind = CompletionTriggerKind.TriggerCharacter } as context) ->
volatileFile.Source.TryGetChar pos = context.triggerCharacter
| Some({ TriggerKind = CompletionTriggerKind.TriggerCharacter } as context) ->
baronfel marked this conversation as resolved.
Show resolved Hide resolved
volatileFile.Source.TryGetChar pos = context.TriggerCharacter
| _ -> true
|> Result.requireTrue $"TextDocumentCompletion was sent before TextDocumentDidChange"

Expand Down Expand Up @@ -2960,25 +2960,27 @@ type AdaptiveFSharpLspServer

override x.Dispose() = disposables.Dispose()

member this.WorkDoneProgressCancel(token: ProgressToken) : Async<unit> =
member this.WorkDoneProgressCancel(param: WorkDoneProgressCancelParams) : Async<unit> =
baronfel marked this conversation as resolved.
Show resolved Hide resolved
async {

let tags = [ "ProgressToken", box token ]
let tags = [ "WorkDoneProgressCancelParams", box param ]
baronfel marked this conversation as resolved.
Show resolved Hide resolved
use trace = fsacActivitySource.StartActivityForType(thisType, tags = tags)

try
logger.info (
Log.setMessage "WorkDoneProgressCancel Request: {params}"
>> Log.addContextDestructured "params" token
>> Log.addContextDestructured "params" param.token
)

state.CancelServerProgress param.token

with e ->
trace |> Tracing.recordException e

logException
e
(Log.setMessage "WorkDoneProgressCancel Request Errored {p}"
>> Log.addContextDestructured "token" token)
>> Log.addContextDestructured "token" param.token)

return ()
}
Expand Down
Loading
Loading