-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Hey, thanks for this awesome cli/library!
I'm writing an app-launcher style application, and I want to include the ability to do quick inline calculations while typing. Fend seems perfectly suited to that. However, I only want to show the result if the user was actually attempting to do any calculations, and it seems hard to judge that.
As an example, when I enter "1", I get the following result from fend:
FendResult {
plain_result: "1",
span_result: [
Span {
string: "1",
kind: Number,
},
Span {
string: "",
kind: Ident,
},
],
attrs: Attrs {
debug: false,
show_approx: true,
plain_number: false,
trailing_newline: true,
},
},
Essentially fend just parsed the term successfully, but didn't resolve anything. I could prepare the query with the plain_result, but that breaks as soon as the user enters something like 1kmh which gets parsed as 1 kmh.
Is there any way (or could I help implement a way) to check whether any actual calculations were done? I understand the definition for that is probably fuzzy, but I think a reasonable threshold could be found 🙂