Skip to content

Commit b16d87a

Browse files
aspeddrocristianoc
authored andcommitted
inlayhint: fix server crashers when open file is removed
1 parent fad3de2 commit b16d87a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Fix Incorrect semantic highlighting of `external` declarations https://github.com/rescript-lang/rescript-vscode/pull/517
2525

2626
- Fix issue where doc comment with nested comments inside is not shown properly on hover https://github.com/rescript-lang/rescript-vscode/pull/526
27+
- Fix server crashes when open file is removed from disk with inlayHints enabled https://github.com/rescript-lang/rescript-vscode/issues/538
2728

2829
## v1.4.2
2930

analysis/src/Hint.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ let inlay ~path ~pos ~maxLength ~debug =
8282
Ast_iterator.default_iterator.value_binding iterator vb
8383
in
8484
let iterator = {Ast_iterator.default_iterator with value_binding} in
85-
(if Filename.check_suffix path ".res" then
85+
(if Files.exists path && Filename.check_suffix path ".res" then
8686
let parser =
8787
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
8888
in
@@ -143,7 +143,7 @@ let codeLens ~path ~debug =
143143
let iterator = {Ast_iterator.default_iterator with value_binding} in
144144
(* We only print code lenses in implementation files. This is because they'd be redundant in interface files,
145145
where the definition itself will be the same thing as what would've been printed in the code lens. *)
146-
(if Filename.check_suffix path ".res" then
146+
(if Files.exists path && Filename.check_suffix path ".res" then
147147
let parser =
148148
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
149149
in

0 commit comments

Comments
 (0)