File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed
tests/FSharp.Editor.Tests/Hints Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ open FSharp.Compiler.EditorServices
9
9
open FSharp.Compiler .Symbols
10
10
open FSharp.Compiler .Text
11
11
open Hints
12
+ open Microsoft.VisualStudio .FSharp .Editor
12
13
13
14
module InlineParameterNameHints =
14
15
@@ -56,10 +57,8 @@ module InlineParameterNameHints =
56
57
>> Seq.contains range
57
58
58
59
let private getSourceTextAtRange ( sourceText : SourceText ) ( range : range ) =
59
-
60
- let line = sourceText.Lines[ range.Start.Line - 1 ]. ToString()
61
- let length = range.EndColumn - range.StartColumn
62
- line.Substring( range.Start.Column, length)
60
+ ( RoslynHelpers.FSharpRangeToTextSpan( sourceText, range) |> sourceText.GetSubText)
61
+ .ToString()
63
62
64
63
let isMemberOrFunctionOrValueValidForHint ( symbol : FSharpMemberOrFunctionOrValue ) ( symbolUse : FSharpSymbolUse ) =
65
64
Original file line number Diff line number Diff line change @@ -494,7 +494,7 @@ let q = query { for x in { 1 .. 10 } do select x }
494
494
Assert.Empty actual
495
495
496
496
[<Fact>]
497
- let ``Hints are not shown when parameter names coinside with variable names`` () =
497
+ let ``Hints are not shown when parameter names coincide with variable names`` () =
498
498
let code =
499
499
"""
500
500
let getFullName name surname = $"{name} {surname}"
@@ -517,3 +517,28 @@ let fullName = getFullName name lastName
517
517
let actual = getParameterNameHints document
518
518
519
519
Assert.Equal( expected, actual)
520
+
521
+ [<Fact>]
522
+ let ``Hints don 't break with multi - line arguments`` () =
523
+ let code =
524
+ """
525
+ None
526
+ |> Option.map (fun x ->
527
+ x + 5
528
+ )
529
+ |> ignore
530
+ """
531
+
532
+ let document = getFsDocument code
533
+
534
+ let expected =
535
+ [
536
+ {
537
+ Content = " mapping = "
538
+ Location = ( 2 , 15 )
539
+ }
540
+ ]
541
+
542
+ let actual = getParameterNameHints document
543
+
544
+ Assert.Equal( expected, actual)
You can’t perform that action at this time.
0 commit comments