diff --git a/CHANGELOG.md b/CHANGELOG.md index 664b820abc4..c9e6d84e69a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [1.5.0](https://github.com/ajaxorg/ace/compare/v1.4.14...v1.5.0) (2022-05-12) + + +### Features + +* Added ability to configure certain format options for beautify extension ([20275de](https://github.com/ajaxorg/ace/commit/20275de79c40636d27d5ce293cf528c915338fbd)) + + +### Bug Fixes + +* Modify syntax ([b78d772](https://github.com/ajaxorg/ace/commit/b78d77240e1909b9d91fcd2ac35a4c17af05f56b)) +* Render bidirectional unicode characters as control characters ([#4693](https://github.com/ajaxorg/ace/issues/4693)) ([4d2ecf0](https://github.com/ajaxorg/ace/commit/4d2ecf08afeb1556f2511a1423729c2549802da8)) + 2022.01.26 Version 1.4.14 - update vim mode diff --git a/build b/build index 6c0e60e5525..61015eb194d 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 6c0e60e5525a6d6ff0e9e929848f7834809a4784 +Subproject commit 61015eb194d5783b705a77338ebb3a78569e9484 diff --git a/demo/kitchen-sink/docs/ion.ion b/demo/kitchen-sink/docs/ion.ion index f9cc3adfa42..26b94fe7d7c 100644 --- a/demo/kitchen-sink/docs/ion.ion +++ b/demo/kitchen-sink/docs/ion.ion @@ -7,7 +7,7 @@ Comment [1,2,3,45 /*TODO: should be 42, obviously*/, 2016-04-21T08:10:46Z, 2016-04-21T08:10:46-08:00, 2016-04-21, 2016, 0x5, 0b0110] (5 7 1 3 [ 'a', 'b', - null, null.int, null.bool, null.list + null, null.int, null.bool, null.list, true, false, nan, -inf, +inf, "str", @@ -33,7 +33,7 @@ states::{ // https://amzn.github.io/ion-docs/docs/spec.html#string string: rules::[ - match::{ + match :: { regex: "(\\\")((?:\\\\\"|[^\"])*)(\\\")", token: ['string.dblq.punc.start', 'string.dblq', 'string.dblq.punc.end'] }, @@ -41,7 +41,7 @@ states::{ regex: "\'{3}", token: 'string.trpq.punc.start', states: rules::[ - pop::{ + pop :: { regex: "\'{3}", token: 'string.trpq.punc.end', }, @@ -58,7 +58,7 @@ states::{ */ } { - "json": { +"json": { "compatibility": true, "open sourced": "2016-04-21T08:10:46Z", "foo": 9, diff --git a/demo/kitchen-sink/docs/partiql.partiql b/demo/kitchen-sink/docs/partiql.partiql index b73e53065ac..a38956799c7 100644 --- a/demo/kitchen-sink/docs/partiql.partiql +++ b/demo/kitchen-sink/docs/partiql.partiql @@ -3,9 +3,8 @@ line comment */ -SELECT a, b, c FROM stuff s INNER CROSS JOIN @s WHERE f(s) -- comment +SELECT "a", b, c FROM stuff s INNER CROSS JOIN @s WHERE f(s) -- comment -- comment -SELECT "a", b FROM stuff s, @s WHERE f(s) SELECT VALUE {'sensor': s.sensor, 'readings': (SELECT VALUE l.co @@ -30,6 +29,7 @@ FROM `[{'a':1, 'b':1}, {'a':2}, "foo"]` AS x SELECT VALUE {v.a: v.b, v.c: v.d} FROM <<{'a':'same', 'b':1, 'c':'same', 'd':2}>> AS v +WHERE v.b SELECT u.id, feedbackId, commentId, upvoteId FROM users as u, u.feedbacks as feedback at feedbackId @@ -52,9 +52,6 @@ SELECT ( SELECT SUM(AVG(n)) FROM <> AS n -SELECT VALUES v.a -FROM [{'a':1, 'b':true}, {'a':2, 'b':null}, {'a':3}] v -WHERE v.b SELECT attributeId, COUNT(*) as the_count FROM repeating_things diff --git a/lib/ace/config.js b/lib/ace/config.js index 976903f62bd..a5b0b7737c0 100644 --- a/lib/ace/config.js +++ b/lib/ace/config.js @@ -223,6 +223,6 @@ function deHyphenate(str) { return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); }); } -exports.version = "1.4.14"; +exports.version = "1.5.0"; }); diff --git a/lib/ace/ext/beautify.js b/lib/ace/ext/beautify.js index f8d3713b169..278bb262e3b 100644 --- a/lib/ace/ext/beautify.js +++ b/lib/ace/ext/beautify.js @@ -44,12 +44,17 @@ exports.singletonTags = ["area", "base", "br", "col", "command", "embed", "hr", // insert a line break after block level tags exports.blockTags = ["article", "aside", "blockquote", "body", "div", "dl", "fieldset", "footer", "form", "head", "header", "html", "nav", "ol", "p", "script", "section", "style", "table", "tbody", "tfoot", "thead", "ul"]; +exports.formatOptions = { + lineBreaksAfterCommasInCurlyBlock: true +}; + exports.beautify = function(session) { var iterator = new TokenIterator(session, 0, 0); var token = iterator.getCurrentToken(); var tabString = session.getTabString(); var singletonTags = exports.singletonTags; var blockTags = exports.blockTags; + var formatOptions = exports.formatOptions || {}; var nextToken; var breakBefore = false; var spaceBefore = false; @@ -269,7 +274,7 @@ exports.beautify = function(session) { trimNext(); // line break after commas in curly block - if (value.match(/^(,)$/) && curlyDepth>0 && roundDepth===0) { + if (value.match(/^(,)$/) && curlyDepth>0 && roundDepth===0 && formatOptions.lineBreaksAfterCommasInCurlyBlock) { rowsToAdd++; } else { spaceAfter = true; diff --git a/lib/ace/ext/beautify_test.js b/lib/ace/ext/beautify_test.js index 982bbce0268..b925cbcb0d6 100644 --- a/lib/ace/ext/beautify_test.js +++ b/lib/ace/ext/beautify_test.js @@ -383,6 +383,40 @@ module.exports = { + "\t\t\"b\": \"2\"\n" + "\t}\n" + ""); + }, + + "test beautify php default behaviour with line breaks after comma": function() { + var s = new EditSession([ + ">"], + ["punctuation.definition.tuple.end.partiql","}"], + ["punctuation.definition.bag.end.partiql",">>"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], @@ -610,12 +613,12 @@ ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], - ["keyword.operator.partiql","<<"], + ["punctuation.definition.bag.begin.partiql","<<"], ["variable.language.identifier.partiql","numbers"], - ["punctuation.partiql",","], + ["punctuation.definition.bag.separator.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","numbers"], - ["keyword.operator.partiql",">>"], + ["punctuation.definition.bag.end.partiql",">>"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], @@ -635,43 +638,47 @@ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], - ["punctuation.partiql","[{"], + ["punctuation.definition.array.begin.partiql","["], + ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], - ["punctuation.partiql",":"], + ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","1"], - ["punctuation.partiql",","], + ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","b"], ["punctuation.definition.string.end.partiql","'"], - ["punctuation.partiql",":"], + ["punctuation.definition.tuple.separator.partiql",":"], ["constant.language.partiql","true"], - ["punctuation.partiql","},"], + ["punctuation.definition.tuple.end.partiql","}"], + ["punctuation.definition.array.separator.partiql",","], ["text.partiql"," "], - ["punctuation.partiql","{"], + ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], - ["punctuation.partiql",":"], + ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","2"], - ["punctuation.partiql",","], + ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","b"], ["punctuation.definition.string.end.partiql","'"], - ["punctuation.partiql",":"], + ["punctuation.definition.tuple.separator.partiql",":"], ["constant.language.partiql","null"], - ["punctuation.partiql","},"], + ["punctuation.definition.tuple.end.partiql","}"], + ["punctuation.definition.array.separator.partiql",","], ["text.partiql"," "], - ["punctuation.partiql","{"], + ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], - ["punctuation.partiql",":"], + ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","3"], - ["punctuation.partiql","}]"], + ["punctuation.definition.tuple.end.partiql","}"], + ["punctuation.definition.array.end.partiql","]"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"] ],[ diff --git a/lib/ace/mode/_test/tokens_pgsql.json b/lib/ace/mode/_test/tokens_pgsql.json index 3f1c3ee5e03..7462f2a4172 100644 --- a/lib/ace/mode/_test/tokens_pgsql.json +++ b/lib/ace/mode/_test/tokens_pgsql.json @@ -791,14 +791,14 @@ ["variable","\"f1\""], ["text",": "], ["constant.numeric","5"], - ["text",","] + ["punctuation.operator",","] ],[ "json-start", ["text"," "], ["variable","\"f2\""], ["text",": "], ["string","\"test\""], - ["text",","] + ["punctuation.operator",","] ],[ "json-start", ["text"," "], diff --git a/lib/ace/mode/ion_highlight_rules.js b/lib/ace/mode/ion_highlight_rules.js index 79a567b60f8..e7271fec3d2 100644 --- a/lib/ace/mode/ion_highlight_rules.js +++ b/lib/ace/mode/ion_highlight_rules.js @@ -123,8 +123,8 @@ define(function(require, exports, module) { "include": "value" }, { - "token": "punctuation.definition.symbol.operator.ion", - "regex": "[\\!\\#\\%\\&\\*\\+\\-\\./\\;\\<\\=\\>\\?\\@\\^\\`\\|\\~]" + "token": "storage.type.symbol.operator.ion", + "regex": "[\\!\\#\\%\\&\\*\\+\\-\\./\\;\\<\\=\\>\\?\\@\\^\\`\\|\\~]+" } ] } @@ -140,12 +140,16 @@ define(function(require, exports, module) { "push": [ { "token": "comment.block.ion", - "regex": "\\*/", + "regex": "[*]/", "next": "pop" }, { "token": "comment.block.ion", - "regex": "(:?.|[^\\*]+)" + "regex": "[^*/]+" + }, + { + "token": "comment.block.ion", + "regex": "[*/]+" } ] } @@ -218,11 +222,11 @@ define(function(require, exports, module) { ], "symbol": [ { - "token": "constant.other.symbol.quoted.ion", + "token": "storage.type.symbol.quoted.ion", "regex": "(['])((?:(?:\\\\')|(?:[^']))*?)(['])" }, { - "token": "constant.other.symbol.identifier.ion", + "token": "storage.type.symbol.identifier.ion", "regex": "[\\$_a-zA-Z][\\$_a-zA-Z0-9]*" } ], @@ -280,19 +284,29 @@ define(function(require, exports, module) { }, { "token": "string.quoted.triple.ion", - "regex": "(?:\\\\'*|.|[^']+)" + "regex": "(?:\\\\'|[^'])+" + }, + { + "token": "string.quoted.triple.ion", + "regex": "'" } ] } ], "annotation": [ { - "token": "variable.language.annotation.ion", - "regex": "'(?:[^']|\\\\\\\\|\\\\')*'\\s*::" + "token": [ + "variable.language.annotation.ion", + "punctuation.definition.annotation.ion" + ], + "regex": "('(?:[^']|\\\\\\\\|\\\\')*')\\s*(::)" }, { - "token": "variable.language.annotation.ion", - "regex": "[\\$_a-zA-Z][\\$_a-zA-Z0-9]*::" + "token": [ + "variable.language.annotation.ion", + "punctuation.definition.annotation.ion" + ], + "regex": "([\\$_a-zA-Z][\\$_a-zA-Z0-9]*)\\s*(::)" } ], "whitespace": [ diff --git a/lib/ace/mode/json_highlight_rules.js b/lib/ace/mode/json_highlight_rules.js index 072a1020380..d453d1de803 100644 --- a/lib/ace/mode/json_highlight_rules.js +++ b/lib/ace/mode/json_highlight_rules.js @@ -72,6 +72,9 @@ var JsonHighlightRules = function() { }, { token : "paren.rparen", regex : "[\\])}]" + }, { + token : "punctuation.operator", + regex : /[,]/ }, { token : "text", regex : "\\s+" diff --git a/lib/ace/mode/partiql.js b/lib/ace/mode/partiql.js index 6a198c98ccd..f9f2188ccb7 100644 --- a/lib/ace/mode/partiql.js +++ b/lib/ace/mode/partiql.js @@ -53,7 +53,7 @@ define(function(require, exports, module) { (function() { this.lineCommentStart = "--"; - this.blockComment = {start: "/*", end: "*/"}; + this.blockComment = {start: "/*", end: "*/", nestable:true}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); diff --git a/lib/ace/mode/partiql_highlight_rules.js b/lib/ace/mode/partiql_highlight_rules.js index 60bd1f7280d..2d0a9d63fb5 100644 --- a/lib/ace/mode/partiql_highlight_rules.js +++ b/lib/ace/mode/partiql_highlight_rules.js @@ -126,14 +126,79 @@ define(function(require, exports, module) { { "include": "comment" }, + { + "include": "tuple_value" + }, + { + "include": "collection_value" + }, { "include": "scalar_value" + } + ], + "scalar_value": [ + { + "include": "string" }, { - "include": "tuple_value" + "include": "number" }, { - "include": "collection_value" + "include": "keywords" + }, + { + "include": "identifier" + }, + { + "include": "embed-ion" + }, + { + "include": "operator" + }, + { + "include": "punctuation" + } + ], + "punctuation": [ + { + "token": "punctuation.partiql", + "regex": "[;:()\\[\\]\\{\\},.]" + } + ], + "operator": [ + { + "token": "keyword.operator.partiql", + "regex": "[+*/<>=~!@#%&|?^-]+" + } + ], + "identifier": [ + { + "token": "variable.language.identifier.quoted.partiql", + "regex": "([\"])((?:(?:\\\\.)|(?:[^\"\\\\]))*?)([\"])" + }, + { + "token": "variable.language.identifier.at.partiql", + "regex": "@\\w+" + }, + { + "token": "variable.language.identifier.partiql", + "regex": "\\b\\w+(?:\\.\\w+)?\\b" + } + ], + "number": [ + { + "token": "constant.numeric.partiql", + "regex": "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + } + ], + "string": [ + { + "token": [ + "punctuation.definition.string.begin.partiql", + "string.quoted.single.partiql", + "punctuation.definition.string.end.partiql" + ], + "regex": "(['])((?:(?:\\\\.)|(?:[^'\\\\]))*?)(['])" } ], "collection_value": [ @@ -157,12 +222,12 @@ define(function(require, exports, module) { { "include": "comment" }, - { - "include": "value" - }, { "token": "punctuation.definition.bag.separator.partiql", "regex": "," + }, + { + "include": "value" } ] } @@ -175,17 +240,27 @@ define(function(require, exports, module) { { "token": "comment.block.partiql", "regex": "/\\*", - "push": [ - { - "token": "comment.block.partiql", - "regex": "\\*/", - "next": "pop" - }, - { - "token": "comment.block.partiql", - "regex": "(:?.|[^\\*]+)" - } - ] + "push": "comment__1" + } + ], + "comment__1": [ + { + "token": "comment.block.partiql", + "regex": "[*]/", + "next": "pop" + }, + { + "token": "comment.block.partiql", + "regex": "[^*/]+" + }, + { + "token": "comment.block.partiql", + "regex": "/\\*", + "push": "comment__1" + }, + { + "token": "comment.block.partiql", + "regex": "[*/]+" } ], "array_value": [ @@ -201,12 +276,12 @@ define(function(require, exports, module) { { "include": "comment" }, - { - "include": "value" - }, { "token": "punctuation.definition.array.separator.partiql", "regex": "," + }, + { + "include": "value" } ] } @@ -224,81 +299,16 @@ define(function(require, exports, module) { { "include": "comment" }, - { - "include": "value" - }, { "token": "punctuation.definition.tuple.separator.partiql", "regex": ",|:" + }, + { + "include": "value" } ] } ], - "scalar_value": [ - { - "include": "string" - }, - { - "include": "number" - }, - { - "include": "keywords" - }, - { - "include": "identifier" - }, - { - "include": "embed-ion" - }, - { - "include": "operator" - }, - { - "include": "punctuation" - } - ], - "punctuation": [ - { - "token": "punctuation.partiql", - "regex": "[;:()\\[\\]\\{\\},.]" - } - ], - "operator": [ - { - "token": "keyword.operator.partiql", - "regex": "[+*/<>=~!@#%&|?^-]" - } - ], - "identifier": [ - { - "token": "variable.language.identifier.quoted.partiql", - "regex": "([\"])((?:(?:\\\\.)|(?:[^\"\\\\]))*?)([\"])" - }, - { - "token": "variable.language.identifier.at.partiql", - "regex": "@\\w+" - }, - { - "token": "variable.language.identifier.partiql", - "regex": "\\b\\w+(?:\\.\\w+)?\\b" - } - ], - "number": [ - { - "token": "constant.numeric.partiql", - "regex": "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - } - ], - "string": [ - { - "token": [ - "punctuation.definition.string.begin.partiql", - "string.quoted.single.partiql", - "punctuation.definition.string.end.partiql" - ], - "regex": "(['])((?:(?:\\\\.)|(?:[^'\\\\]))*?)(['])" - } - ], "whitespace": [ { "token": "text.partiql", @@ -309,7 +319,7 @@ define(function(require, exports, module) { this.$rules["keywords"] = [keywordMapperRule]; this.$rules["embed-ion"] = [{token : "punctuation.definition.ion.begin.partiql", regex : "`", next : "ion-start"}]; - this.embedRules(IonHighlightRules, "ion-", [{token : "punctuation.definition.ion.begin.partiql", regex : "`", next : "start"}]); + this.embedRules(IonHighlightRules, "ion-", [{token : "punctuation.definition.ion.end.partiql", regex : "`", next : "start"}]); this.normalizeRules(); }; diff --git a/package.json b/package.json index 972ddc23184..d5ec1435a5a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ace", "description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE", - "version": "1.4.14", + "version": "1.5.0", "homepage": "http://github.com/ajaxorg/ace", "engines": { "node": ">= 0.6.0" @@ -45,4 +45,4 @@ "tag": true } } -} \ No newline at end of file +} diff --git a/tool/release.sh b/tool/release.sh index 380d7c7653c..cc8b920b840 100755 --- a/tool/release.sh +++ b/tool/release.sh @@ -52,10 +52,11 @@ git --no-pager log --color --first-parent --oneline v$CUR_VERSION..master | echo "current version is $CUR_VERSION" # get new version number -VERSION_NUM=; -until [[ "$VERSION_NUM" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] ; do - read -p "enter version number for the build " VERSION_NUM -done +git checkout -- package.json +git checkout -- CHANGELOG.md +npm run changelog +VERSION_NUM="$(node -p "require('./package.json').version")"; +echo "version number for the build is" $VERSION_NUM # update version number everywhere node -e "