more highlight work

-closes #48
This commit is contained in:
thelastWallE 2021-04-26 01:02:31 +02:00
parent af08b91c00
commit 22fb1dd485
1 changed files with 16 additions and 8 deletions

View File

@ -28,14 +28,14 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
regex: /;.*$/ regex: /;.*$/
}, { }, {
token: "comment.line.number-sign", token: "comment.line.number-sign",
regex: /(#\*#)/ regex: /^(#\*#)/
}], }],
"#number": [{ "#number": [{
token: "constant.numeric", token: "constant.numeric",
regex: /\-?\d+(?:[\.,]\d+)?\b/ regex: /\-?\d+(?:[\.]\d+)?\b/
}, { }, {
token: "constant.numeric", token: "constant.numeric",
regex: /\-?[\.,]\d+?\b/ regex: /\-?[\.]\d+?\b/
}], }],
"#boolean": [{ "#boolean": [{
token: "constant.language", token: "constant.language",
@ -112,6 +112,11 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
regex: /\b(?:cartesian|delta|corexy|corexz|polar|rotary_delta|winch|none)\b/, regex: /\b(?:cartesian|delta|corexy|corexz|polar|rotary_delta|winch|none)\b/,
caseInsensitive: true caseInsensitive: true
}], }],
"#known_screws_type": [{
token: "support.type",
regex: /\b(?:CW-M3|CCW-M3|CW-M4|CCW-M4|CW-M5|CCW-M5)\b/,
caseInsensitive: true
}],
"#known_algo_type": [{ "#known_algo_type": [{
token: "support.type", token: "support.type",
regex: /\b(?:lagrange|bicubic)\b/, regex: /\b(?:lagrange|bicubic)\b/,
@ -119,7 +124,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}], }],
"#known_display_type": [{ "#known_display_type": [{
token: "support.type", token: "support.type",
regex: /\b(?:hd44780|st7920|uc1701|ssd1306|sh1106)\b/, regex: /\b(?:hd44780|st7920|uc1701|ssd1306|emulated_st7920|sh1106)\b/,
caseInsensitive: true caseInsensitive: true
}], }],
"#serial": [{ "#serial": [{
@ -169,6 +174,8 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
include: "#known_display_type" include: "#known_display_type"
}, { }, {
include: "#known_kinematics_type" include: "#known_kinematics_type"
}, {
include: "#known_screws_type"
}, { }, {
include: "#known_algo_type" include: "#known_algo_type"
}, { }, {
@ -183,6 +190,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
include: "#single_line_comment" include: "#single_line_comment"
}] }]
}], }],
// For multiple keys on one line eg.: ^EXP1_5, ^EXP1_3
"#config_line_display": [{ "#config_line_display": [{
token: ["variable.name", "text"], token: ["variable.name", "text"],
regex: /(?!(gcode))(\w+)(\s*[=]\s*)/, regex: /(?!(gcode))(\w+)(\s*[=]\s*)/,
@ -231,7 +239,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
caseInsensitive: true, caseInsensitive: true,
push: [{ push: [{
token: "text", token: "text",
regex: /(\s|$)/, regex: /(?=(\s|$|;))/,
next: "pop" next: "pop"
}, { }, {
include: "#number" include: "#number"
@ -241,11 +249,11 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}], }],
"#gcode_parameter": [{ "#gcode_parameter": [{
token: "variable.parameter", token: "variable.parameter",
regex: /\b[A-z]+(?![a-z])/, regex: /\b[A-z]+(?![a-z])|(?:<---------------------- SAVE_CONFIG ---------------------->)|(?:\sDO NOT EDIT THIS BLOCK OR BELOW\. The contents are auto\-generated\.)/,
caseInsensitive: true, caseInsensitive: true,
push: [{ push: [{
token: "text", token: "text",
regex: /(?=(\s|$))/, regex: /(?=(\s|$|;))|^/,
next: "pop" next: "pop"
}, { }, {
include: "#number" include: "#number"
@ -272,7 +280,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
next: "pop" next: "pop"
}, { }, {
token: "constant.language", token: "constant.language",
regex: /5V|average|command|echo|error|manual|median|OD|output_mode_store|pin_down|pin_up|reset|self_test|set_5V_output_mode|set_5V_output_mode|set_OD_output_mode|touch_mode/, regex: /$|5V|average|command|echo|error|manual|median|OD|output_mode_store|pin_down|pin_up|reset|self_test|set_5V_output_mode|set_5V_output_mode|set_OD_output_mode|touch_mode/,
caseInsensitive: true caseInsensitive: true
}, { }, {
include: "#number" include: "#number"