diff --git a/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs index 8699e6fd42f..69015b9c7b9 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs @@ -32,7 +32,7 @@ type BraceMatchingServiceTests() = |> Async.RunImmediateExceptOnUI with | None -> () - | Some (left, right) -> failwith $"Found match for brace '{marker}'" + | Some _ -> failwith $"Found match for brace '{marker}'" member private this.VerifyBraceMatch(fileContents: string, startMarker: string, endMarker: string, ?langVersion: string) = let sourceText = SourceText.From(fileContents) diff --git a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs index 0041a7dd4bb..e94a5f69436 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs @@ -29,7 +29,7 @@ module CompletionProviderTests = let caretPosition = fileContents.IndexOf(marker) + marker.Length let document = - RoslynTestHelpers.CreateSolution(fileContents) + RoslynTestHelpers.CreateSolution(fileContents, extraFSharpProjectOtherOptions = Array.ofSeq opts) |> RoslynTestHelpers.GetSingleDocument let results = @@ -77,7 +77,7 @@ module CompletionProviderTests = let caretPosition = fileContents.IndexOf(marker) + marker.Length let document = - RoslynTestHelpers.CreateSolution(fileContents) + RoslynTestHelpers.CreateSolution(fileContents, extraFSharpProjectOtherOptions = Array.ofSeq opts) |> RoslynTestHelpers.GetSingleDocument let actual = @@ -1990,3 +1990,20 @@ match { A = 1; B = 2 } with """ VerifyCompletionList(fileContents, "| { f = ()", [ "A"; "B"; "C"; "D" ], []) + + [] + let ``issue #16260 [TO-BE-IMPROVED] operators are fumbling for now`` () = + let fileContents = + """ +module Ops = +let (|>>) a b = a + b +module Foo = + let (|>>) a b = a + b +Ops.Foo.() +Ops.Foo.( +Ops.( +Ops.() +""" + + VerifyCompletionList(fileContents, "Ops.Foo.(", [], [ "|>>"; "(|>>)" ]) + VerifyCompletionList(fileContents, "Ops.(", [], [ "|>>"; "(|>>)" ]) diff --git a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs index e1abc491025..27db356ec4b 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs @@ -14,11 +14,11 @@ type DocumentDiagnosticAnalyzerTests() = let startMarker = "(*start*)" let endMarker = "(*end*)" - let getDiagnostics (fileContents: string) = + member private _.getDiagnostics(fileContents: string, ?additionalFlags) = let task = cancellableTask { let document = - RoslynTestHelpers.CreateSolution(fileContents) + RoslynTestHelpers.CreateSolution(fileContents, ?extraFSharpProjectOtherOptions = additionalFlags) |> RoslynTestHelpers.GetSingleDocument let! syntacticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Syntax) @@ -30,14 +30,14 @@ type DocumentDiagnosticAnalyzerTests() = task.Result member private this.VerifyNoErrors(fileContents: string, ?additionalFlags: string[]) = - let errors = getDiagnostics fileContents + let errors = this.getDiagnostics (fileContents, ?additionalFlags = additionalFlags) if not errors.IsEmpty then failwith $"There should be no errors generated: {errors}" member private this.VerifyErrorAtMarker(fileContents: string, expectedMarker: string, ?expectedMessage: string) = let errors = - getDiagnostics fileContents + this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = DiagnosticSeverity.Error) |> Seq.toArray @@ -68,7 +68,7 @@ type DocumentDiagnosticAnalyzerTests() = expectedSeverity: DiagnosticSeverity ) = let errors = - getDiagnostics fileContents + this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = expectedSeverity) |> Seq.toArray @@ -99,7 +99,7 @@ type DocumentDiagnosticAnalyzerTests() = ) = // TODO: once workaround (https://github.com/dotnet/fsharp/pull/15982) will not be needed, this should be reverted back to normal method (see PR) let errors = - getDiagnostics fileContents + this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = expectedSeverity) |> Seq.toArray @@ -133,7 +133,7 @@ type DocumentDiagnosticAnalyzerTests() = ?expectedMessage: string ) = let errors = - getDiagnostics fileContents + this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = DiagnosticSeverity.Error) |> Seq.toArray diff --git a/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs index beb93403e91..9442957325f 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs @@ -38,7 +38,7 @@ let def = )marker4 """ - let pasteTemplate = + let _pasteTemplate = """ let foo = diff --git a/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj b/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj index 407a1aad700..77ce57f27e0 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj +++ b/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj @@ -7,6 +7,8 @@ false true $(NoWarn);FS3511 + $(OtherFlags) --warnon:1182 + true diff --git a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs index 5b00301821b..9bedb277c9d 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs @@ -188,7 +188,7 @@ type TestHostWorkspaceServices(hostServices: HostServices, workspace: Workspace) with _ -> Unchecked.defaultof<'T> - override _.FindLanguageServices(filter) = Seq.empty + override _.FindLanguageServices(_filter) = Seq.empty override _.GetLanguageServices(languageName) = match languageName with @@ -275,7 +275,7 @@ type RoslynTestHelpers private () = static member SetEditorOptions (solution: Solution) options = solution.Workspace.Services.GetService().With(options) - static member CreateSolution(source, ?options: FSharpProjectOptions, ?editorOptions) = + static member CreateSolution(source, ?options: FSharpProjectOptions, ?extraFSharpProjectOtherOptions: string array, ?editorOptions) = let projId = ProjectId.CreateNewId() let docInfo = RoslynTestHelpers.CreateDocumentInfo projId "C:\\test.fs" source @@ -284,9 +284,18 @@ type RoslynTestHelpers private () = let projInfo = RoslynTestHelpers.CreateProjectInfo projId projFilePath [ docInfo ] let solution = RoslynTestHelpers.CreateSolution [ projInfo ] - options - |> Option.defaultValue RoslynTestHelpers.DefaultProjectOptions - |> RoslynTestHelpers.SetProjectOptions projId solution + let options = + let options = options |> Option.defaultValue RoslynTestHelpers.DefaultProjectOptions + + match extraFSharpProjectOtherOptions with + | None + | Some [||] -> options + | Some otherOptions -> + { options with + OtherOptions = Array.concat [| options.OtherOptions; otherOptions |] + } + + options |> RoslynTestHelpers.SetProjectOptions projId solution if editorOptions.IsSome then RoslynTestHelpers.SetEditorOptions solution editorOptions.Value @@ -352,9 +361,7 @@ type RoslynTestHelpers private () = } let solution = - match customEditorOptions with - | Some o -> RoslynTestHelpers.CreateSolution(code, options, o) - | None -> RoslynTestHelpers.CreateSolution(code, options) + RoslynTestHelpers.CreateSolution(code, options, ?editorOptions = customEditorOptions) solution |> RoslynTestHelpers.GetSingleDocument diff --git a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs index aa8eb39bb53..abd08e2bf45 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs @@ -85,7 +85,7 @@ module QuickInfoProviderTests = | QuickInfo _ -> QuickInfo(desc, docs) | _ -> Desc desc - | ToolTipElement.CompositionError (error) -> Error + | ToolTipElement.CompositionError _ -> Error let executeQuickInfoTest (programText: string) testCases = let document =