Skip to content

Commit c2e16f6

Browse files
author
Eli Dowling
committed
fixed a little mistake in du hover fix
1 parent 1a2a3d4 commit c2e16f6

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/FSharpLanguageServer/Program.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ type Server(client: ILanguageClient,useCache:bool) =
363363
)
364364

365365
//Adds one to the position we are looking for, for each match before our pos because we add an extra space at those points
366-
let newPos=indicies|>List.rev|>List.fold(fun cPos matchPos -> if cPos<=matchPos then cPos+1 else cPos ) charPos
366+
let newPos=indicies|>List.rev|>List.fold(fun cPos matchPos -> if matchPos<=cPos then cPos+1 else cPos ) charPos
367367
newLine,newPos
368368

369369
/// Find the symbol at a position
@@ -375,7 +375,7 @@ type Server(client: ILanguageClient,useCache:bool) =
375375

376376
let line, charPos =fixLineForIdentifying line position.character
377377

378-
let maybeId = QuickParse.GetCompleteIdentifierIsland false line (position.character)
378+
let maybeId = QuickParse.GetCompleteIdentifierIsland false line (charPos)
379379
match c, maybeId with
380380
| Error(errors), _ ->
381381
lgError "'SymbolAt' Check failed, errors: %A" (errors)
@@ -699,7 +699,7 @@ type Server(client: ILanguageClient,useCache:bool) =
699699
let line, charPos = fixLineForIdentifying line p.position.character
700700
let addedChars=charPos-p.position.character
701701

702-
let maybeId = QuickParse.GetCompleteIdentifierIsland false line (charPos)
702+
let maybeId = QuickParse.GetCompleteIdentifierIsland false line charPos
703703
match c, maybeId with
704704
| Error(errors), _ ->
705705
lgError "Check failed, errors: {errors}" (errors)

‎tests/Expecto/FsharpLanguageServer/ServerTests.fs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ let serverTests=
225225
| Some hover -> Expect.isNonEmpty hover.contents "Hover list is empty"
226226
}
227227

228+
test "hover over first char of DU aginst pipe" {
229+
let client, server = createServerAndReadFile("MainProject", "Hover.fs")
230+
match server.Hover(textDocumentPosition("MainProject", "Hover.fs", 28, 6)) |> Async.RunSynchronously with
231+
| None -> failtest "No hover"
232+
| Some hover -> Expect.isNonEmpty hover.contents "Hover list is empty"
233+
}
228234
//See issue #106
229235
test "hover over middle of member name" {
230236
let client, server = createServerAndReadFile("MainProject", "Hover.fs")

0 commit comments

Comments
 (0)