-
Notifications
You must be signed in to change notification settings - Fork 13
Conversation
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@@ -445,6 +445,11 @@ export const aggregateOpModifierTerms = [ | |||
}, | |||
]; | |||
|
|||
export const numberTerms = [ | |||
{ label: 'nan', info: 'not a number', type: 'constant' }, |
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.
I'd go with:
{ label: 'nan', info: 'not a number', type: 'constant' }, | |
{ label: 'NaN', info: 'Floating-point NaN value', type: 'constant' }, |
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.
fixed
@@ -445,6 +445,11 @@ export const aggregateOpModifierTerms = [ | |||
}, | |||
]; | |||
|
|||
export const numberTerms = [ | |||
{ label: 'nan', info: 'not a number', type: 'constant' }, | |||
{ label: 'inf', info: 'the infinite and beyond of the number', type: 'constant' }, |
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.
I'd go with:
{ label: 'inf', info: 'the infinite and beyond of the number', type: 'constant' }, | |
{ label: 'Inf', info: 'Floating-point infinity', type: 'constant' }, |
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.
fixed
@@ -330,12 +336,22 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context | |||
{ kind: ContextKind.Function }, | |||
{ kind: ContextKind.Aggregation } | |||
); | |||
if (parent.type.id !== FunctionCallArgs && parent.type.id !== MatrixSelector) { |
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.
Hmm, when I type n
in a function call parameter, it now doesn't autocomplete nan
, but should. Is it because of this?
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.
ah yeah that's possible. It was more because we don't want to autocomplete the number in the the sum
for example.
But yeah I forgot that sometimes it's possible ....
Maybe we should just autocomplete it everytime even if it's sometimes false depending of the aggregation / function
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.
even if I don't really like it :/.
But well in the other side, putting NaN / Inf is a bit a corner case in the function call parameters right ?
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.
Yeah, it's legal in the type system and will cause a valid query, but I'm not aware of any valid use case with the current set of functions taking scalars :) So probably it's fine to just not support it for now, yeah.
Signed-off-by: Augustin Husson <husson.augustin@gmail.com> Co-authored-by: Julius Volz <julius.volz@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #141 +/- ##
==========================================
+ Coverage 72.56% 72.72% +0.15%
==========================================
Files 15 15
Lines 740 748 +8
Branches 166 167 +1
==========================================
+ Hits 537 544 +7
- Misses 124 125 +1
Partials 79 79
Continue to review full report at Codecov.
|
👍 |
fix #136