From 78a49d94a53f39c9a0f0b95b8ed8b7e25509e99c Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 27 Jun 2022 10:19:52 -0500 Subject: [PATCH 1/4] update Ionide.LanguageServerProtocol --- global.json | 2 +- paket.lock | 2 +- .../CodeFixes/ConvertPositionalDUToNamed.fs | 2 - .../CodeFixes/ExternalSystemDiagnostics.fs | 9 +- src/FsAutoComplete/FsAutoComplete.Lsp.fs | 7 +- .../CompletionTests.fs | 4 +- .../ExtensionsTests.fs | 4 +- test/FsAutoComplete.Tests.Lsp/Helpers.fs | 12 ++- .../InlayHintTests.fs | 92 +++++++++---------- .../Utils/CursorbasedTests.fs | 8 +- 10 files changed, 77 insertions(+), 65 deletions(-) diff --git a/global.json b/global.json index 1c46a9dbc..e67ba0d03 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.200", + "version": "6.0.301", "rollForward": "major" } } diff --git a/paket.lock b/paket.lock index e3a10cd71..ebb3eaa1a 100644 --- a/paket.lock +++ b/paket.lock @@ -99,7 +99,7 @@ NUGET System.Collections.Immutable (>= 5.0) System.Reflection.Metadata (>= 5.0) Ionide.KeepAChangelog.Tasks (0.1.8) - copy_local: true - Ionide.LanguageServerProtocol (0.4.3) + Ionide.LanguageServerProtocol (0.4.4) FSharp.Core (>= 6.0) Newtonsoft.Json (>= 13.0.1) StreamJsonRpc (>= 2.10.44) diff --git a/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs b/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs index 43fcc0a99..1a8f5aeb4 100644 --- a/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs +++ b/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs @@ -41,8 +41,6 @@ type ParseAndCheckResults with Some(ident, [ singleDUFieldPattern ], parenRange) | SynPat.Paren(pat = UnionNameAndPatterns (ident, duFieldPatterns, parenRange)) -> Some(ident, duFieldPatterns, parenRange) - | SynPat.Paren(pat = UnionNameAndPatterns (ident, duFieldPatterns, parenRange)) -> - Some(ident, duFieldPatterns, parenRange) | _ -> None let visitor = diff --git a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs index 2e08a1cb3..8b0433cde 100644 --- a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs +++ b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs @@ -5,6 +5,13 @@ open FsAutoComplete.CodeFix open FsAutoComplete.CodeFix.Types open Ionide.LanguageServerProtocol.Types open FsAutoComplete +open Newtonsoft.Json.Linq + +let private (|Payload|_|) (tok: JToken): 't option = + try + Some(Ionide.LanguageServerProtocol.Server.deserialize tok : 't) + with + | e -> None let private mapExternalDiagnostic diagnosticType = Run.ifDiagnosticByType diagnosticType (fun diagnostic codeActionParams -> @@ -12,7 +19,7 @@ let private mapExternalDiagnostic diagnosticType = | None -> AsyncResult.retn [] | Some fixes -> match fixes with - | :? list as fixes -> + | Payload(fixes: list) -> AsyncResult.retn [ { SourceDiagnostic = Some diagnostic File = codeActionParams.TextDocument diff --git a/src/FsAutoComplete/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/FsAutoComplete.Lsp.fs index 2cce3c763..5cea010c5 100644 --- a/src/FsAutoComplete/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/FsAutoComplete.Lsp.fs @@ -495,7 +495,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = |> List.map (fun fix -> { Range = fcsRangeToLsp fix.FromRange NewText = fix.ToText }) - |> box + |> Ionide.LanguageServerProtocol.Server.serialize |> Some { Range = range @@ -991,7 +991,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = Some { Legend = createTokenLegend - Range = Some(U2.First true) + Range = Some true Full = Some(U2.First true) } InlayHintProvider = Some { ResolveProvider = Some false } } } |> success @@ -1719,9 +1719,8 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = | actions -> return actions - |> List.map (CodeAction.OfFix commands.TryGetFileVersion clientCapabilities.Value) + |> List.map (CodeAction.OfFix commands.TryGetFileVersion clientCapabilities.Value >> U2.Second) |> List.toArray - |> TextDocumentCodeActionResult.CodeActions |> Some } diff --git a/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs b/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs index 61580def4..171bf0c44 100644 --- a/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs @@ -147,7 +147,7 @@ let tests state = | Ok None -> failtest "Should have gotten some completion items" | Error e -> failtestf "Got an error while retrieving completions: %A" e }) - + testCaseAsync "completion before first character of expression" (async { let! server, path = server let completionParams : CompletionParams = @@ -423,7 +423,7 @@ let autoOpenTests state = match! server.TextDocumentCodeAction p with | Error e -> return failtestf "Quick fix Request failed: %A" e | Ok None -> return failtest "Quick fix Request none" - | Ok (Some (TextDocumentCodeActionResult.CodeActions (ContainsOpenAction quickfix))) -> + | Ok (Some (CodeActions (ContainsOpenAction quickfix))) -> let ns = quickfix.Title.Substring("open ".Length) let edit = diff --git a/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs b/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs index 1b5c5cc63..c5aeefb39 100644 --- a/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs @@ -222,7 +222,7 @@ let linterTests state = |> Array.map (fun (diag, text) -> { diag with CodeDescription = urlFor diag.Code - Data = Some(box [ { Range = diag.Range; NewText = text } ]) }) + Data = Some(Ionide.LanguageServerProtocol.Server.serialize [ { Range = diag.Range; NewText = text } ]) }) testList "Linter Test" @@ -278,7 +278,7 @@ let formattingTests state = match! server.TextDocumentFormatting { TextDocument = { Uri = Path.FilePathToUri sourceFile } - Options = FormattingOptions(TabSize = 4, InsertSpaces = true) } + Options = {TabSize = 4; InsertSpaces = true; TrimTrailingWhitespace = None; InsertFinalNewline = None; TrimFinalNewlines = None; AdditionalData = System.Collections.Generic.Dictionary<_,_>() } } with | Ok (Some [| edit |]) -> let normalized = { edit with NewText = normalizeLineEndings edit.NewText } diff --git a/test/FsAutoComplete.Tests.Lsp/Helpers.fs b/test/FsAutoComplete.Tests.Lsp/Helpers.fs index 3e143c221..eb400f297 100644 --- a/test/FsAutoComplete.Tests.Lsp/Helpers.fs +++ b/test/FsAutoComplete.Tests.Lsp/Helpers.fs @@ -244,7 +244,7 @@ let clientCaps: ClientCapabilities = WillSaveWaitUntil = Some true DidSave = Some true } - let diagCaps: PublishDiagnosticsCapabilites = + let diagCaps: PublishDiagnosticsCapabilities = let diagnosticTags: DiagnosticTagSupport = { ValueSet = [||] } { RelatedInformation = Some true @@ -289,7 +289,7 @@ let clientCaps: ClientCapabilities = let semanticTokensCaps: SemanticTokensClientCapabilities = { DynamicRegistration = Some true Requests = - { Range = Some(U2.First true) + { Range = Some true Full = Some(U2.First true) } TokenTypes = [||] TokenModifiers = [||] @@ -624,3 +624,11 @@ let (|As|_|) (m: PlainNotification) : 't option = match trySerialize m.Content with | Some (r: FsAutoComplete.CommandResponse.ResponseMsg<'t>) -> Some r.Data | None -> None + +let (|CodeActions|_|) (t: TextDocumentCodeActionResult) = + let actions = + t + |> Array.choose (function U2.Second action -> Some action | _ -> None) + match actions with + | [||] -> None + | actions -> Some actions diff --git a/test/FsAutoComplete.Tests.Lsp/InlayHintTests.fs b/test/FsAutoComplete.Tests.Lsp/InlayHintTests.fs index 7d7f88e08..8b81e3728 100644 --- a/test/FsAutoComplete.Tests.Lsp/InlayHintTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/InlayHintTests.fs @@ -28,11 +28,11 @@ module private FSharpInlayHints = | InlayHintKind.Parameter -> None Pos = pos Kind = kind } - let private from (text, (line, char), kind) = + let private from (text, (line, char), kind) = at (text, { Line=line; Character=char}, kind) - let private check' + let private check' (server: CachedServer) (text: string) (range: Range) @@ -69,7 +69,7 @@ module private FSharpInlayHints = poss[1..(count-2)] (text, range, poss) - + let checkRange (server: CachedServer) (documentText: string) (expectedHints: _ list) = async { let (text, range, poss) = documentText |> extractCursorsInsideRange Expect.equal (poss |> List.length) (expectedHints |> List.length) $"Expected Hints & position cursors to match, but there were {expectedHints |> List.length} expected hints and {poss |> List.length} position cursors" @@ -126,8 +126,8 @@ module private LspInlayHints = use doc = doc Expect.hasLength diags 0 "Should not have had check errors" - let! hints = - doc + let! hints = + doc |> Document.inlayHintsAt range let hints = hints @@ -174,8 +174,8 @@ module private LspInlayHints = |> Text.trimTripleQuotation |> Cursors.extractGroupedWith [| rangeMarker; Cursor.Marker |] let range = - let poss = - cursors + let poss = + cursors |> Map.tryFind rangeMarker |> Flip.Expect.wantSome "There should be range markers" Expect.hasLength poss 2 "There should be two range markers" @@ -237,16 +237,16 @@ module private LspInlayHints = |> Text.trimTripleQuotation (hint, Some expectedAfterEdits) let truncated (hint: InlayHint, edits) = - let label = + let label = match hint.Label with | InlayHintLabel.String label -> label | _ -> failtestf "invalid label: %A" hint.Label - let (name, kind) = + let (name, kind) = match hint.Kind with - | Some InlayHintKind.Parameter -> + | Some InlayHintKind.Parameter -> let name = label.Substring(0, label.Length-2) name, InlayHintKind.Parameter - | Some InlayHintKind.Type -> + | Some InlayHintKind.Type -> let name = label.Substring(2) name, InlayHintKind.Type | _ -> failtestf "invalid kind: %A" hint.Kind @@ -254,7 +254,7 @@ module private LspInlayHints = Expect.notEqual truncatedName name "Truncated name should be different from untruncated one" let hint = { hint with - Label = + Label = match kind with | InlayHintKind.Parameter -> truncatedName + " =" @@ -262,7 +262,7 @@ module private LspInlayHints = ": " + truncatedName | _ -> failwith "unreachable" |> InlayHintLabel.String - Tooltip = + Tooltip = InlayHintTooltip.String name |> Some } @@ -511,7 +511,7 @@ let private paramHintTests state = $|f $0(1 |> alpha)$| """ [ paramHint "alpha" ] - + //ENHANCEMENT: detect some common expressions like: // * receiving end of pipe: `1 |> alpha`, `alpha <| 1`, `1 |> toAlpha` // * last function: `1.ToAlpha()` @@ -1135,7 +1135,7 @@ let private typeHintTests state = let t: unit option option option option option option option option option option option option option option option = Some (Some (Some (Some (Some (Some (Some (Some (Some (Some (Some (Some (Some (Some (Some ())))))))))))))) """ ] - + testCaseAsync "can show type for generic actual type" <| checkAllInMarkedRange server @@ -1176,7 +1176,7 @@ let private mixedHintTests state = checkAllInMarkedRange server """ $|open System - let f alpha$0 beta$0 = + let f alpha$0 beta$0 = let beta$0 = Int32.Parse beta let value$0 = alpha + beta + 2 value * 2 @@ -1186,7 +1186,7 @@ let private mixedHintTests state = typeHint "int" """ open System - let f (alpha: int) beta = + let f (alpha: int) beta = let beta = Int32.Parse beta let value = alpha + beta + 2 value * 2 @@ -1195,7 +1195,7 @@ let private mixedHintTests state = typeHint "string" """ open System - let f alpha (beta: string) = + let f alpha (beta: string) = let beta = Int32.Parse beta let value = alpha + beta + 2 value * 2 @@ -1204,7 +1204,7 @@ let private mixedHintTests state = typeHint "int" """ open System - let f alpha beta = + let f alpha beta = let beta: int = Int32.Parse beta let value = alpha + beta + 2 value * 2 @@ -1213,7 +1213,7 @@ let private mixedHintTests state = typeHint "int" """ open System - let f alpha beta = + let f alpha beta = let beta = Int32.Parse beta let value: int = alpha + beta + 2 value * 2 @@ -1222,7 +1222,7 @@ let private mixedHintTests state = typeHint "int" """ open System - let f alpha beta = + let f alpha beta = let beta = Int32.Parse beta let value = alpha + beta + 2 value * 2 @@ -1249,7 +1249,7 @@ module InlayHintAndExplicitType = let tryGetInlayHintAt pos doc = async { let allRange = { Start = { Line = 0; Character = 0 }; End = { Line = 1234; Character = 1234 }} - let! hints = + let! hints = doc |> Document.inlayHintsAt allRange |> Async.map (Option.defaultValue [||]) @@ -1264,10 +1264,10 @@ module InlayHintAndExplicitType = return match codeFixes with | None -> None - | Some (TextDocumentCodeActionResult.Commands _) -> None - | Some (TextDocumentCodeActionResult.CodeActions codeActions) -> + | Some (CodeActions codeActions) -> codeActions |> Array.tryFind (fun ca -> ca.Title = CodeFix.AddExplicitTypeAnnotation.title) + | Some _ -> None } let private checkInlayHintAndCodeFix (server: CachedServer) @@ -1304,7 +1304,7 @@ module InlayHintAndExplicitType = /// but no InlayHint | JustCodeFix of textAfterEdits: string /// Just display of InlayHint, but no Edits or CodeFix - /// + /// /// Label must not contain leading `:` (& following space) | JustInlayHint of label: string /// Neither InlayHint nor CodeFix @@ -1325,7 +1325,7 @@ module InlayHintAndExplicitType = let! codeFix = doc |> tryGetCodeFixAt pos Expect.isNone codeFix "There shouldn't be a code fix after inserting code fix text edit" } - + let rec validateInlayHint (doc, text, pos) (inlayHint: InlayHint option) = async { match expected with | JustCodeFix _ @@ -1339,7 +1339,7 @@ module InlayHintAndExplicitType = parts |> Array.map (fun part -> part.Value) |> String.concat "" - let actual = + let actual = let actual = actual.TrimStart() if actual.StartsWith ':' then actual.Substring(1).TrimStart() @@ -1397,9 +1397,9 @@ open InlayHintAndExplicitType /// * At most locations Type Hint & Code Fix should be valid at same location and contain same TextEdit -> checked together /// * Checked by applying TextEdits /// * Additional test: After applying TextEdit (-> add type annotation), neither Type Hint nor Code Fix are available any more -/// +/// /// vs. `explicitTypeInfoTests`: -/// * `explicitTypeInfoTests`: +/// * `explicitTypeInfoTests`: /// * Does Type Annotation exists /// * Is Type Annotation valid /// * Are parens required @@ -1411,7 +1411,7 @@ open InlayHintAndExplicitType /// * Produce both correct Text Edits /// * Are both not triggered any more after Text Edit /// * high-level: LSP Server with `textDocument/inlayHint` & `textDocument/codeAction` commands -/// +/// /// vs. `typeHintTests`: /// * `typeHintTests`: /// * Tests all properties of InlayHint like label, location @@ -1420,8 +1420,8 @@ open InlayHintAndExplicitType /// * InlayHint at single location /// * Tests just TextEdits /// * Additional checks "Add Explicit Type" Code Fix -/// -/// +/// +/// /// -> /// * `explicitTypeInfoTests`: test type annotation /// * `inlayTypeHintAndAddExplicitTypeTests`: test type annotation edit and Inlay Hint existence (vs. "Add Explicit Type") @@ -1462,7 +1462,7 @@ let private inlayTypeHintAndAddExplicitTypeTests state = ] ]) -let tests state = +let tests state = testList (nameof InlayHint) [ FSharpInlayHints.tests state inlayHintTests state @@ -1485,7 +1485,7 @@ let explicitTypeInfoTests = let getAst input = async { let checker = checker.Value // Get compiler options for the 'project' implied by a single script file - let! projOptions, diagnostics = + let! projOptions, diagnostics = checker.GetProjectOptionsFromScript(file, input, assumeDotNetFramework=false) // Expect.isEmpty diagnostics "There should be no diagnostics" Expect.hasLength diagnostics 0 "There should be no diagnostics" @@ -1495,8 +1495,8 @@ let explicitTypeInfoTests = Expect.hasLength errors 0 "There should be no errors" // Run the first phase (untyped parsing) of the compiler - let! parseFileResults = - checker.ParseFile(file, input, parsingOptions) + let! parseFileResults = + checker.ParseFile(file, input, parsingOptions) // Expect.isEmpty parseFileResults.Diagnostics "There should be no parse diagnostics" Expect.hasLength parseFileResults.Diagnostics 0 "There should be no parse diagnostics" @@ -1508,7 +1508,7 @@ let explicitTypeInfoTests = let! ast = getAst text let pos = protocolPosToPos pos - + let explTy = InlayHints.tryGetExplicitTypeInfo (text, ast) pos return explTy } @@ -1605,7 +1605,7 @@ let explicitTypeInfoTests = } let updated = ExplicitType.Missing data updated, cursors - + Expect.hasLength cursors 0 "There are unused cursors!" expected let expected = expected |> Option.map (updateExpected cursors) @@ -1709,7 +1709,7 @@ let explicitTypeInfoTests = """ let private $0value: int = 1 """ - (ExplicitType.Exists) + (ExplicitType.Exists) ] testList "let with multiple vars" [ testCaseAsync "let value1, value2, value3 = (1,2,3)" <| @@ -1729,7 +1729,7 @@ let explicitTypeInfoTests = """ let (value1, $0value: int, value3) = (1,2,3) """ - (ExplicitType.Exists) + (ExplicitType.Exists) ] testList "use" [ @@ -1757,7 +1757,7 @@ let explicitTypeInfoTests = """ (ExplicitType.Exists) ] - + testList "let!" [ testCaseAsync "let! value = ..." <| testExplicitType @@ -2098,7 +2098,7 @@ let explicitTypeInfoTests = member _.DoStuff(v) = v + a + 1 """ (ExplicitType.Missing { Ident=fromCursorAndInsert; InsertAt=fromCursor; Parens=Parens.Optional fromCursors; SpecialRules = [] }) - + ] ] testList "pattern match" [ @@ -2134,15 +2134,15 @@ let explicitTypeInfoTests = // * `| value: int as _ -> ...` -> ok // * `static member F (value: int as _) = ...` -> ok - // -> + // -> // trailing type anno: // * in `let`: trailing type anno part of `let` binding, NOT pattern -> ok // * similar when with parens: `(pat: type)` with `pat=_ as _` // * in `case`: just pattern -> no trailing type annotation part of case definition - // + // // type anno in first binding position: don't know // Probably eager type annotation matching of let binding? -> `as` is now in pos of parameter - // Other Patterns require parens too: + // Other Patterns require parens too: // * `let Some value = Some 42` -> function named `Some` with argument `value: 'a` returning `Some 42` // * `let (Some value) = Some 42` -> destructure of `Some 42` to `value: int = 42` @@ -2348,7 +2348,7 @@ let explicitTypeInfoTests = testExplicitType """ type Attr() = - inherit System.Attribute() + inherit System.Attribute() type A([]$0a$I) = member _.F(b) = a + b + 1 """ diff --git a/test/FsAutoComplete.Tests.Lsp/Utils/CursorbasedTests.fs b/test/FsAutoComplete.Tests.Lsp/Utils/CursorbasedTests.fs index f23dbf8c7..4343aac8f 100644 --- a/test/FsAutoComplete.Tests.Lsp/Utils/CursorbasedTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/Utils/CursorbasedTests.fs @@ -51,10 +51,10 @@ module CodeFix = failwith "unreachable" | None, NotApplicable -> [||] - | Some res, _ -> - match res with - | TextDocumentCodeActionResult.Commands cs -> failtestf "Expected CodeActions, but got commands: %A" cs - | TextDocumentCodeActionResult.CodeActions cas -> cas + | Some (Helpers.CodeActions actions), _ -> actions + | Some _, _ -> failwith "Expected some code actions from the server" + + // select code action to use let codeActions = chooseFix allCodeActions From 862aef6d6d037cf608d6bf7276a38a2101f3929b Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 27 Jun 2022 10:20:38 -0500 Subject: [PATCH 2/4] use newer setup-dotnet that uses global.json --- .github/workflows/build.yml | 5 +---- .github/workflows/release.yml | 8 +------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4408de896..532da503a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,6 @@ jobs: strategy: matrix: os: [windows-2022, macos-11, ubuntu-20.04] - dotnet: [6.0.200] fail-fast: false # we have timing issues on some OS, so we want them all to run runs-on: ${{ matrix.os }} @@ -21,9 +20,7 @@ jobs: uses: al-cheb/configure-pagefile-action@v1.2 if: ${{ matrix.os == 'windows-2019' }} - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ matrix.dotnet }} + uses: actions/setup-dotnet@v2 - name: Restore tools run: dotnet tool restore - name: Run Build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 330f6ed48..df4286f61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,19 +7,13 @@ on: jobs: release: - strategy: - matrix: - dotnet: [6.0.200] - runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ matrix.dotnet }} + uses: actions/setup-dotnet@v2 - name: Restore tools run: dotnet tool restore From ca84f908534938976b72a9491288ce502842af6b Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 27 Jun 2022 10:25:43 -0500 Subject: [PATCH 3/4] formatting --- .../CodeFixes/ExternalSystemDiagnostics.fs | 10 +++++----- src/FsAutoComplete/FsAutoComplete.Lsp.fs | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs index 8b0433cde..d607505b6 100644 --- a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs +++ b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs @@ -7,11 +7,11 @@ open Ionide.LanguageServerProtocol.Types open FsAutoComplete open Newtonsoft.Json.Linq -let private (|Payload|_|) (tok: JToken): 't option = +let private (|Payload|_|) (tok: JToken) : 't option = try - Some(Ionide.LanguageServerProtocol.Server.deserialize tok : 't) - with - | e -> None + Some(Ionide.LanguageServerProtocol.Server.deserialize tok: 't) + with e -> + None let private mapExternalDiagnostic diagnosticType = Run.ifDiagnosticByType diagnosticType (fun diagnostic codeActionParams -> @@ -19,7 +19,7 @@ let private mapExternalDiagnostic diagnosticType = | None -> AsyncResult.retn [] | Some fixes -> match fixes with - | Payload(fixes: list) -> + | Payload (fixes: list) -> AsyncResult.retn [ { SourceDiagnostic = Some diagnostic File = codeActionParams.TextDocument diff --git a/src/FsAutoComplete/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/FsAutoComplete.Lsp.fs index 5cea010c5..a0f8c44f1 100644 --- a/src/FsAutoComplete/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/FsAutoComplete.Lsp.fs @@ -1719,7 +1719,10 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = | actions -> return actions - |> List.map (CodeAction.OfFix commands.TryGetFileVersion clientCapabilities.Value >> U2.Second) + |> List.map ( + CodeAction.OfFix commands.TryGetFileVersion clientCapabilities.Value + >> U2.Second + ) |> List.toArray |> Some } From c570564c8e2c6766ca0fd4ac346cb8652d723220 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Sun, 10 Jul 2022 15:10:12 -0500 Subject: [PATCH 4/4] bump dependencies to align with 6.0.30x --- paket.lock | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/paket.lock b/paket.lock index ebb3eaa1a..43c87f106 100644 --- a/paket.lock +++ b/paket.lock @@ -2,7 +2,7 @@ STORAGE: NONE RESTRICTION: || (== net6.0) (== netstandard2.0) NUGET remote: https://api.nuget.org/v3/index.json - altcover (8.2.837) + altcover (8.3.838) CliWrap (3.4.4) Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) @@ -26,7 +26,7 @@ NUGET DiffPlex (>= 1.6.3) Expecto (>= 9.0.4) FSharp.Core (>= 4.6) - Fantomas.Client (0.5.4) + Fantomas.Client (0.6) FSharp.Core (>= 5.0.1) SemanticVersioning (>= 2.0.2) StreamJsonRpc (>= 2.8.28) @@ -36,8 +36,8 @@ NUGET FSharp.Compiler.Service (>= 41.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net5.0)) FSharp.Core (>= 6.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net5.0)) McMaster.NETCore.Plugins (>= 1.4) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net5.0)) - FSharp.Compiler.Service (41.0.4) - FSharp.Core (6.0.4) + FSharp.Compiler.Service (41.0.5) + FSharp.Core (6.0.5) Microsoft.Build.Framework (>= 17.0) Microsoft.Build.Tasks.Core (>= 17.0) Microsoft.Build.Utilities.Core (>= 17.0) @@ -69,7 +69,7 @@ NUGET FSharp.Control.Reactive (5.0.5) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net6.0)) FSharp.Core (>= 4.7.2) System.Reactive (>= 5.0 < 6.0) - FSharp.Core (6.0.4) - content: none + FSharp.Core (6.0.5) - content: none FSharp.Formatting (14.0.1) FSharp.Compiler.Service (>= 40.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netstandard2.1)) FSharp.UMX (1.1) @@ -92,7 +92,7 @@ NUGET FSharp.Core (>= 4.6.2) FsToolkit.ErrorHandling (2.13) FSharp.Core (>= 4.7.2) - GitHubActionsTestLogger (2.0) + GitHubActionsTestLogger (2.0.1) Microsoft.TestPlatform.ObjectModel (>= 17.2) ICSharpCode.Decompiler (7.2.1.6856) Microsoft.Win32.Registry (>= 5.0) @@ -125,16 +125,15 @@ NUGET McMaster.NETCore.Plugins (1.4) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net5.0)) Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp2.1)) Microsoft.Extensions.DependencyModel (>= 5.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp2.1)) - MessagePack (2.3.85) - MessagePack.Annotations (>= 2.3.85) - Microsoft.Bcl.AsyncInterfaces (>= 1.0) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Collections.Immutable (>= 1.5) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Memory (>= 4.5.3) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Reflection.Emit (>= 4.6) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Reflection.Emit.Lightweight (>= 4.6) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 4.5.2) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.3) - restriction: || (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - MessagePack.Annotations (2.3.85) + MessagePack (2.4.35) + MessagePack.Annotations (>= 2.4.35) + Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) + Microsoft.NET.StringTools (>= 1.0) + System.Collections.Immutable (>= 1.7.1) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) + System.Reflection.Emit (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) + System.Reflection.Emit.Lightweight (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) + System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) + MessagePack.Annotations (2.4.35) Microsoft.Bcl.AsyncInterfaces (6.0) System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) Microsoft.Build (17.2) - copy_local: false @@ -193,7 +192,7 @@ NUGET Microsoft.NET.Test.Sdk (17.2) Microsoft.CodeCoverage (>= 17.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.TestPlatform.TestHost (>= 17.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.NETCore.Platforms (6.0.3) + Microsoft.NETCore.Platforms (6.0.4) Microsoft.NETCore.Targets (5.0) Microsoft.NETFramework.ReferenceAssemblies (1.0.2) Microsoft.SourceLink.AzureRepos.Git (1.1.1) - copy_local: true @@ -234,7 +233,7 @@ NUGET System.Security.Principal.Windows (>= 5.0) Microsoft.Win32.SystemEvents (6.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) Mono.Cecil (0.11.4) - Nerdbank.Streams (2.8.57) + Nerdbank.Streams (2.8.61) Microsoft.Bcl.AsyncInterfaces (>= 5.0) Microsoft.VisualStudio.Threading (>= 16.10.56) Microsoft.VisualStudio.Validation (>= 16.10.26) @@ -243,7 +242,7 @@ NUGET NETStandard.Library (2.0.3) Microsoft.NETCore.Platforms (>= 1.1) Newtonsoft.Json (13.0.1) - NuGet.Frameworks (6.2) + NuGet.Frameworks (6.2.1) runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) @@ -732,7 +731,7 @@ NUGET System.Text.Encoding (>= 4.3) System.Text.Encodings.Web (6.0) - copy_local: false, restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Json (6.0.4) - copy_local: false, restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) + System.Text.Json (6.0.5) - copy_local: false, restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) System.Runtime.CompilerServices.Unsafe (>= 6.0) System.Text.Encodings.Web (>= 6.0) System.Threading (4.3)