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

Monaco bugs #2922

Merged
merged 1 commit into from
Dec 9, 2023
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
2 changes: 1 addition & 1 deletion apps/zui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
setupFiles: ["./src/test/unit/setup/before-env.ts"],
setupFilesAfterEnv: ["./src/test/unit/setup/after-env.ts"],
testEnvironmentOptions: {
testURL: "http://localhost:3000/?name=search&id=test-1",
testURL: "http://localhost:4567/?name=search&id=test-1",
},
globalSetup: "./src/test/unit/setup/global.ts",
modulePaths: ["<rootDir>"],
Expand Down
2 changes: 1 addition & 1 deletion apps/zui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"start": "node scripts/start",
"start:main": "yarn build:main --watch",
"start:renderer": "next dev",
"start:renderer": "next dev -p 4567",
"start:electron": "nodemon --watch dist ../../node_modules/electron/cli.js .",
"watch-code": "run-p start:main start:renderer",
"build": "run-p -l 'build:**'",
Expand Down
185 changes: 185 additions & 0 deletions apps/zui/src/core/zed-syntax.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
const primitiveTypes = [
"uint8",
"uint16",
"uint32",
"uint64",
"int8",
"int16",
"int32",
"int64",
"float16",
"float32",
"float64",
"bool",
"string",
"duration",
"time",
"bytes",
"ip",
"net",
"type",
"null",
]

const keywords = ["this", "const", "from", "file", "func", "op", "type"]

const builtinOps = [
"assert",
"combine",
"cut",
"drop",
"file",
"fork",
"from",
"fuse",
"get",
"head",
"join",
"load",
"merge",
"over",
"pass",
"put",
"rename",
"sample",
"search",
"sort",
"summarize",
"switch",
"tail",
"uniq",
"where",
"yield",
]

const builtinFuncs = [
"abs",
"base64",
"bucket",
"cast",
"ceil",
"cidr_match",
"compare",
"coalesce",
"crop",
"error",
"every",
"fields",
"fill",
"flatten",
"floor",
"grep",
"has",
"hex",
"has_error",
"is",
"is_error",
"join",
"kind",
"ksuid",
"len",
"levenshtein",
"log",
"lower",
"missing",
"nameof",
"nest_dotted",
"network_of",
"now",
"order",
"parse_uri",
"parse_zson",
"pow",
"quiet",
"regexp",
"regexp_replace",
"replace",
"round",
"rune_len",
"shape",
"split",
"sqrt",
"trim",
"typename",
"typeof",
"typeunder",
"under",
"unflatten",
"upper",
]

const builtinAggFuncs = [
"AND",
"OR",
"and",
"any",
"avg",
"collect",
"count",
"dcount",
"fuse",
"map",
"max",
"min",
"or",
"sum",
"union",
]

const operators = ["+", "-", "*", "/", ">", ">=", "<", "<=", "=", ":="]

const symbols = /[+\-*/><=:]+/

const identifier = /[a-zA-Z][\w$]*/

const identifierRule = [
identifier,
{
cases: {
"@keywords": "keyword",
"@builtinOps": "keyword",
"@builtinFuncs": "keyword",
"@builtinAggFuncs": "keyword",
"@primitiveTypes": "keyword",
"@operators": "operators",
"@default": "variable",
},
},
]

const operatorRule = [
symbols,
{
cases: {
"@operators": "operator",
"#default": "",
},
},
]

const integerRule = [/\d+/, "number"]
const floatRule = [/\d*\.\d+/, "number.float"]
const stringRule = [/("[^"]*")|('[^']*')/, "string"]
const commentRule = [/\/\/.*/, "comment"]
const bracketRule = [/[{}()[]]/, "@brackets"]

export const tokens = {
keywords,
operators,
primitiveTypes,
builtinAggFuncs,
builtinFuncs,
builtinOps,
symbols,
tokenizer: {
root: [
identifierRule,
commentRule,
bracketRule,
operatorRule,
integerRule,
floatRule,
stringRule,
] as any,
},
}
Empty file.
2 changes: 1 addition & 1 deletion apps/zui/src/electron/windows/zui-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export abstract class ZuiWindow {
load() {
this.beforeLoad()
const url = env.isDevelopment
? `http://localhost:3000${this.path}?id=${this.id}&name=${this.name}`
? `http://localhost:4567${this.path}?id=${this.id}&name=${this.name}`
: `file://${this.path}.html?id=${this.id}&name=${this.name}`
return this.ref.loadURL(url)
}
Expand Down
Loading
Loading