LSP: Handle case when user tries to include a directory
In case there is a
#include ""
this is not highlighted, because LSP server crashes while executing on_doc with Sys_error("Is a directory").
Probably get_scope exits by throwing an exception, but ligo info get-scope from CLI works normally and returns
"errors": [
{
"status": "error",
"stage": "preprocessing",
"content": {
"message": "File \"\" not found.",
...
This is also bad because in !2358 (merged) we're saving file contents to hashtabl during on_doc so we can parse CST later, and currently exceptions from get_scope are breaking this data flow.
Current state
get-scope returns an error instead of failing and causing crashes, but error is still not pretty and has no range, because it comes from a caught OCaml exception
Acceptance criteria
-
#include ""is correctly highlighted as an error in diagnostics
Edited by Sorokin-Anton