Skip to content

Commit

Permalink
Fix bug in inlay hints for members/constructors
Browse files Browse the repository at this point in the history
This bug resulted in member/constructor hints sometimes being applied
just before the leftmost open paren.
  • Loading branch information
baronfel committed Oct 14, 2023
1 parent 2ecb8f6 commit 2c70722
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/FsAutoComplete.Core/InlayHints.fs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ let private getFirstPositionAfterParen (str: string) startPos =
match str with
| null -> -1
| str when startPos > str.Length -> -1
| str -> str.IndexOf('(') + 1
| str -> str.IndexOf('(', startPos) + 1

let private maxHintLength = 30

Expand Down
4 changes: 2 additions & 2 deletions test/FsAutoComplete.Tests.Lsp/InlayHintTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,9 @@ let private paramHintTests state =
server
"""
type Parser(jsonText: string) = member _.Parse(decoder: string -> string) = decoder jsonText
$|let parse (decoder: string -> string) (str: string) = Parser$0(str).Parse(decoder)$|
$|let parse (decoder: string -> string) (str: string) = Parser($0str).Parse($0decoder)$|
"""
[ paramHint "jsonText" ]
[ paramHint "jsonText"; paramHint "decoder" ]

testList
"operator"
Expand Down

0 comments on commit 2c70722

Please sign in to comment.