Skip to content
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 invalid range #781

Merged
merged 2 commits into from
Jun 22, 2023
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

- Add support for syntax highlighting in `%raw` and `%ffi` extension points. https://github.com/rescript-lang/rescript-vscode/pull/774

#### :bug: Bug Fix

- Fix invalid range for `definition`. https://github.com/rescript-lang/rescript-vscode/pull/781

## 1.18.0

#### :rocket: New Feature
Expand Down
4 changes: 2 additions & 2 deletions analysis/src/Commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ let definition ~path ~pos ~debug =
| Some locItem -> (
match References.definitionForLocItem ~full locItem with
| None -> None
| Some (uri, loc) ->
| Some (uri, loc) when not loc.loc_ghost ->
let isInterface = full.file.uri |> Uri.isInterface in
let posIsZero {Lexing.pos_lnum; pos_bol; pos_cnum} =
(* range is zero *)
Expand All @@ -113,7 +113,7 @@ let definition ~path ~pos ~debug =
else
Some
{Protocol.uri = Uri.toString uri; range = Utils.cmtLocToRange loc}
))
| Some _ -> None))
in
print_endline
(match locationOpt with
Expand Down