-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix off by one in code lens resolve #994
fix off by one in code lens resolve #994
Conversation
@@ -1776,70 +1776,67 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = | |||
|
|||
let handler f (arg: CodeLens) = | |||
async { | |||
let pos = FcsPos.mkPos (arg.Range.Start.Line + 1) (arg.Range.Start.Character + 2) | |||
let pos = protocolPosToPos arg.Range.Start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the core fix, the rest is refactoring
f54da69
to
a675d94
Compare
CI failing with errors that look related to code lenses... |
yeah, the type signature lenses in particular. I'll get it green at some point. |
@@ -481,7 +481,7 @@ type ParseAndCheckResults | |||
Ok(symboluse, symboluses) | |||
|
|||
member __.TryGetSignatureData (pos: Position) (lineStr: LineStr) = | |||
match Lexer.findLongIdents (pos.Column - 1, lineStr) with | |||
match Lexer.findLongIdents (pos.Column, lineStr) with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing the first off-by-one (https://github.com/fsharp/FsAutoComplete/pull/994/files#r948031768) surfaced this off-by-one.
sigh
@@ -101,10 +101,23 @@ let tests state = | |||
(args[1] :?> JObject).ToObject<Ionide.LanguageServerProtocol.Types.Position>(), | |||
(args[2] :?> JArray) |> Seq.map (fun t -> (t:?>JObject).ToObject<Ionide.LanguageServerProtocol.Types.Location>()) |> Array.ofSeq | |||
Expect.equal filePath doc.Uri "File path should be the doc we're checking" | |||
Expect.equal triggerPos { Line = 1; Character = 8 } "Position should be 0:0" | |||
Expect.equal triggerPos { Line = 1; Character = 6 } "Position should be 1:6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changed because we stopped adding 2 to the column count as part of this fix. Why did we do that originally? Completely unknown to me reasons.
Fixes ionide/ionide-vscode-fsharp#1763
Turns out it was an off by one! We basically should never use Pos.mkPos directly IMO if possible :(