Skip to content
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
2 changes: 1 addition & 1 deletion src/Compiler/Service/FSharpParseFileResults.fs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput,

SyntaxTraversal.Traverse(pos, input, visitor)

member _.GetAllArgumentsForFunctionApplicationAtPostion pos =
member _.GetAllArgumentsForFunctionApplicationAtPosition pos =
SynExprAppLocationsImpl.getAllCurriedArgsAtPosition pos input

member _.TryRangeOfParenEnclosingOpEqualsGreaterUsage opGreaterEqualPos =
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Service/FSharpParseFileResults.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type public FSharpParseFileResults =
member TryRangeOfFunctionOrMethodBeingApplied: pos: pos -> range option

/// Gets the ranges of all arguments, if they can be found, for a function application at the given position.
member GetAllArgumentsForFunctionApplicationAtPostion: pos: pos -> range list option
member GetAllArgumentsForFunctionApplicationAtPosition: pos: pos -> range list option

/// <summary>
/// Given the position of an expression, attempts to find the range of the
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Service/ServiceUntypedParse.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type public FSharpParseFileResults =
member FindNoteworthyParamInfoLocations: pos: pos -> FSharpNoteworthyParamInfoLocations option

/// Gets the ranges of all arguments, if they can be found, for a function application at the given position.
member GetAllArgumentsForFunctionApplicationAtPostion: pos: pos -> range list option
member GetAllArgumentsForFunctionApplicationAtPosition: pos: pos -> range list option

/// Determines if the expression or pattern at the given position has a type annotation
member IsTypeAnnotationGivenAtPosition: pos -> bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FShar
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] TryRangeOfRefCellDereferenceContainingPos(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] TryRangeOfStringInterpolationContainingPos(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] ValidateBreakpointLocation(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]] GetAllArgumentsForFunctionApplicationAtPostion(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]] GetAllArgumentsForFunctionApplicationAtPosition(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Syntax.Ident,System.Int32]] TryIdentOfPipelineContainingPosAndNumArgsApplied(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range]] TryRangeOfParenEnclosingOpEqualsGreaterUsage(FSharp.Compiler.Text.Position)
FSharp.Compiler.CodeAnalysis.FSharpParseFileResults: System.String FileName
Expand Down
66 changes: 33 additions & 33 deletions tests/service/ServiceUntypedParseTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,13 @@ let x = { Name = "Hello" }
module FunctionApplicationArguments =

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - Single arg``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - Single arg``() =
let source = """
let f x = ()
f 12
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -401,13 +401,13 @@ f 12
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - Multi arg``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - Multi arg``() =
let source = """
let f x y z = ()
f 1 2 3
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -417,13 +417,13 @@ f 1 2 3
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - Multi arg parentheses``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - Multi arg parentheses``() =
let source = """
let f x y z = ()
f (1) (2) (3)
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -433,13 +433,13 @@ f (1) (2) (3)
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - Multi arg nested parentheses``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - Multi arg nested parentheses``() =
let source = """
let f x y z = ()
f ((1)) (((2))) ((((3))))
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -449,23 +449,23 @@ f ((1)) (((2))) ((((3))))
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - unit``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - unit``() =
let source = """
let f () = ()
f ()
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
Assert.IsTrue(res.IsNone, "Found argument for unit-accepting function, which shouldn't be the case.")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - curried function``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - curried function``() =
let source = """
let f x y = x + y
f 12
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -475,14 +475,14 @@ f 12
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - tuple value``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - tuple value``() =
let source = """
let f (t: int * int) = ()
let t = (1, 2)
f t
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 4 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 4 0)
match res with
| Some res ->
res
Expand All @@ -492,13 +492,13 @@ f t
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - tuple literal``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - tuple literal``() =
let source = """
let f (t: int * int) = ()
f (1, 2)
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -508,14 +508,14 @@ f (1, 2)
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - tuple value with definition that has explicit names``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - tuple value with definition that has explicit names``() =
let source = """
let f ((x, y): int * int) = ()
let t = (1, 2)
f t
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 4 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 4 0)
match res with
| Some res ->
res
Expand All @@ -525,13 +525,13 @@ f t
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - tuple literal inside parens``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - tuple literal inside parens``() =
let source = """
let f (x, y) = ()
f ((1, 2))
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -541,13 +541,13 @@ f ((1, 2))
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - tuples with elements as arguments``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - tuples with elements as arguments``() =
let source = """
let f (a, b) = ()
f (1, 2)
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -557,13 +557,13 @@ f (1, 2)
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - top-level arguments with nested function call``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - top-level arguments with nested function call``() =
let source = """
let f x y = x + y
f (f 1 2) 3
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 0)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 0)
match res with
| Some res ->
res
Expand All @@ -573,13 +573,13 @@ f (f 1 2) 3
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - nested function argument positions``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - nested function argument positions``() =
let source = """
let f x y = x + y
f (f 1 2) 3
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 3 3)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 3 3)
match res with
| Some res ->
res
Expand All @@ -589,12 +589,12 @@ f (f 1 2) 3
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - nested function application in infix expression``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - nested function application in infix expression``() =
let source = """
let addStr x y = string x + y
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 2 17)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 2 17)
match res with
| Some res ->
res
Expand All @@ -604,12 +604,12 @@ let addStr x y = string x + y
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - nested function application outside of infix expression``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - nested function application outside of infix expression``() =
let source = """
let addStr x y = x + string y
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 2 21)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 2 21)
match res with
| Some res ->
res
Expand All @@ -619,12 +619,12 @@ let addStr x y = x + string y
Assert.Fail("No arguments found in source code")

[<Test>]
let ``GetAllArgumentsForFunctionApplicationAtPostion - nested function applications both inside and outside of infix expression``() =
let ``GetAllArgumentsForFunctionApplicationAtPosition - nested function applications both inside and outside of infix expression``() =
let source = """
let addStr x y = string x + string y
"""
let parseFileResults, _ = getParseAndCheckResults source
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 2 17)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 2 17)
match res with
| Some res ->
res
Expand All @@ -634,7 +634,7 @@ let addStr x y = string x + string y
Assert.Fail("No arguments found in source code")


let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPostion (mkPos 2 28)
let res = parseFileResults.GetAllArgumentsForFunctionApplicationAtPosition (mkPos 2 28)
match res with
| Some res ->
res
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ type internal FSharpSignatureHelpProvider
let numDefinedArgs = definedArgs.Length

let curriedArgsInSource =
parseResults.GetAllArgumentsForFunctionApplicationAtPostion symbolUse.Range.Start
parseResults.GetAllArgumentsForFunctionApplicationAtPosition symbolUse.Range.Start
|> Option.defaultValue []
|> Array.ofList

Expand Down