-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add coverage to Try Flow #7871
base: main
Are you sure you want to change the base?
Add coverage to Try Flow #7871
Conversation
/сс @mroch |
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.
cool!
how noisy will this be? we need some settings (parser options, flowconfig options, etc) and this could be one of them if we need to toggle it off.
src/flow_dot_js.ml
Outdated
let root = Path.dummy_path in | ||
let content = Js.to_string js_content in | ||
match parse_content filename content with | ||
| Error _ -> failwith "parse error" |
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 seems too easy to hit. I'd say make it return a JSON error instead
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.
maybe raise_js_error
?
const flow = Promise.resolve(editor.getOption('flow')); | ||
const sources = Promise.all([ | ||
flow | ||
.then(flowProxy => flowProxy.coverage('-', text)) |
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 code has to run on older versions of flow. I guess the catch
will handle that, but swallowing errors always comes back to bite me. if it returns a JSON error for parse errors instead of throwing, then you could return a similar error if flow.coverage == null
.
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.
How is this different from catch?
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.
not catching inside Promise.all, would kill whole sequence, checkContent wouldn't be called then
even if it is user-defined error
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.
swallowing errors always comes back to bite me.
type-at-pos bites back, if you add console.error
to type-at-pos catch it would complain about re_string_match
not implemented 😬
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.
84fb954
to
e90d123
Compare
@mroch I added coverage checkbox |
Fixes #2854