Skip to content
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

feat: update function definitions p1 #63

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/jdm-editor/src/completion.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@
"detail": "(str: string, pattern: string) -> string[]",
"info": "Extracts matching substrings according to a pattern"
},
{
"label": "fuzzyMatch",
"type": "function",
"detail": "(haystack: string | string[], needle: string) -> number | number[]",
"info": "Performs a fuzzy search of the needle in the haystack, and returns the match score(s)."
},
{
"label": "split",
"type": "function",
"detail": "(str: string, delimiter: string) -> string[]",
"info": "Splits a string into an array of substrings using the specified delimiter."
},
{
"label": "abs",
"type": "function",
Expand Down Expand Up @@ -155,6 +167,12 @@
"detail": "(value: any) -> boolean",
"info": "Converts the given value to a boolean."
},
{
"label": "type",
"type": "function",
"detail": "<T>(value: T) -> string",
"info": "Returns a string representing the data type of the value."
},
{
"label": "date",
"type": "function",
Expand Down Expand Up @@ -239,6 +257,18 @@
"detail": "(timestamp: number, unit: string) -> number",
"info": "Returns the timestamp representing the end of a specified unit (e.g., day, month, year) based on a given timestamp."
},
{
"label": "keys",
"type": "function",
"detail": "(obj: object) -> string[]",
"info": "Returns an array of a given object's own enumerable property names."
},
{
"label": "values",
"type": "function",
"detail": "(obj: object) -> any[]",
"info": "Returns an array of a given object's own enumerable property values."
},
{
"label": "all",
"type": "function",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const zenHighlightLight = syntaxHighlighting(
HighlightStyle.define([
{ tag: [t.bracket, t.operator, t.variableName, t.propertyName, t.content], color: '#080808' },
{ tag: [t.number, t.bool], color: '#015cc5' },
{ tag: [t.function(t.variableName), t.keyword, t.self, t.special(t.brace)], color: '#6f42c1' },
{ tag: [t.function(t.variableName), t.keyword, t.self, t.special(t.brace), t.logicOperator], color: '#6f42c1' },
{ tag: [t.string, t.meta, t.name, t.quote], color: '#077d16' },
{ tag: t.invalid, color: '#cb2431' },
]),
Expand All @@ -117,7 +117,7 @@ export const zenHighlightDark = syntaxHighlighting(
HighlightStyle.define([
{ tag: [t.bracket, t.operator, t.variableName, t.propertyName, t.content], color: '#bdbec4' },
{ tag: [t.number, t.bool], color: '#57a8f5' },
{ tag: [t.function(t.variableName), t.keyword, t.self, t.special(t.brace)], color: '#c87dbb' },
{ tag: [t.function(t.variableName), t.keyword, t.self, t.special(t.brace), t.logicOperator], color: '#c87dbb' },
{ tag: [t.string, t.meta, t.name, t.quote], color: '#6aab73' },
{ tag: t.invalid, color: '#cb2431' },
]),
Expand Down
18 changes: 9 additions & 9 deletions packages/lezer-zen/src/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/lezer-zen/src/parser.terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export const
LessThan = 26,
and = 29,
or = 30,
questionOp = 32,
ArgList = 36,
SequenceExpression = 37
questionOp = 33,
ArgList = 37,
SequenceExpression = 38
4 changes: 3 additions & 1 deletion packages/lezer-zen/src/zen.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
equal @left,
and @left,
or @left,
nullCoalesce @left,
ternary @right,
comma @left
}
Expand Down Expand Up @@ -67,7 +68,8 @@ BinaryExpression {
expressionNoComma !rel (LessThan | CompareOp<"<=" | ">" "="?>) expressionNoComma |
expressionNoComma !equal CompareOp<"==" | "!="> expressionNoComma |
expressionNoComma !and kw<"and"> expressionNoComma |
expressionNoComma !or kw<"or"> expressionNoComma
expressionNoComma !or kw<"or"> expressionNoComma |
expressionNoComma !nullCoalesce LogicOp<"??"> expressionNoComma
}

MemberExpression {
Expand Down
Loading