Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ajaxorg/ace
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/ajaxorg/ace:
  fix: Made commas be tokenized as punctuation operator instead of text in JSON (ajaxorg#4703)
  fix: Multiple Partiql and Amazon Ion textual notation fixes (ajaxorg#4686)
  fix: Updated PHP mode to support PHP8.1 syntax (ajaxorg#4696)
  release v1.5.0
  chore: use npm changelog in release script (ajaxorg#4698)
  feat: Added ability to configure certain format options for beautify extension
  fix: Render bidirectional unicode characters as control characters (ajaxorg#4693)
  • Loading branch information
jjpost committed May 19, 2022
2 parents f169ca8 + 4c4883a commit fa5090b
Show file tree
Hide file tree
Showing 18 changed files with 340 additions and 243 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion build
Submodule build updated 83 files
+540 −0 CHANGELOG.md
+3 −3 ace-modules.d.ts
+1 −1 ace.d.ts
+31 −10 demo/kitchen-sink/demo.js
+68 −0 demo/kitchen-sink/docs/ion.ion
+62 −0 demo/kitchen-sink/docs/partiql.partiql
+15 −1 demo/kitchen-sink/docs/php_laravel_blade.blade.php
+75 −0 demo/kitchen-sink/docs/sac.sac
+1 −1 kitchen-sink.html
+1 −1 package.json
+1 −1 src-min-noconflict/ace.js
+1 −1 src-min-noconflict/ext-beautify.js
+1 −1 src-min-noconflict/ext-language_tools.js
+1 −1 src-min-noconflict/ext-modelist.js
+1 −1 src-min-noconflict/ext-options.js
+1 −1 src-min-noconflict/ext-prompt.js
+1 −1 src-min-noconflict/ext-settings_menu.js
+1 −1 src-min-noconflict/mode-csound_document.js
+1 −1 src-min-noconflict/mode-csound_orchestra.js
+8 −0 src-min-noconflict/mode-ion.js
+1 −1 src-min-noconflict/mode-lua.js
+1 −1 src-min-noconflict/mode-luapage.js
+8 −0 src-min-noconflict/mode-partiql.js
+1 −1 src-min-noconflict/mode-php_laravel_blade.js
+8 −0 src-min-noconflict/mode-sac.js
+8 −0 src-min-noconflict/snippets/ion.js
+8 −0 src-min-noconflict/snippets/partiql.js
+8 −0 src-min-noconflict/snippets/sac.js
+1 −1 src-min/ace.js
+1 −1 src-min/ext-beautify.js
+1 −1 src-min/ext-language_tools.js
+1 −1 src-min/ext-modelist.js
+1 −1 src-min/ext-options.js
+1 −1 src-min/ext-prompt.js
+1 −1 src-min/ext-settings_menu.js
+1 −1 src-min/mode-csound_document.js
+1 −1 src-min/mode-csound_orchestra.js
+8 −0 src-min/mode-ion.js
+1 −1 src-min/mode-lua.js
+1 −1 src-min/mode-luapage.js
+8 −0 src-min/mode-partiql.js
+1 −1 src-min/mode-php_laravel_blade.js
+8 −0 src-min/mode-sac.js
+8 −0 src-min/snippets/ion.js
+8 −0 src-min/snippets/partiql.js
+8 −0 src-min/snippets/sac.js
+28 −45 src-noconflict/ace.js
+17 −8 src-noconflict/ext-beautify.js
+10 −1 src-noconflict/ext-language_tools.js
+4 −1 src-noconflict/ext-modelist.js
+4 −1 src-noconflict/ext-options.js
+4 −1 src-noconflict/ext-prompt.js
+4 −1 src-noconflict/ext-settings_menu.js
+14 −4 src-noconflict/mode-csound_document.js
+14 −4 src-noconflict/mode-csound_orchestra.js
+514 −0 src-noconflict/mode-ion.js
+1 −1 src-noconflict/mode-lua.js
+1 −1 src-noconflict/mode-luapage.js
+792 −0 src-noconflict/mode-partiql.js
+10 −4 src-noconflict/mode-php_laravel_blade.js
+410 −0 src-noconflict/mode-sac.js
+9 −0 src-noconflict/snippets/ion.js
+9 −0 src-noconflict/snippets/partiql.js
+9 −0 src-noconflict/snippets/sac.js
+28 −45 src/ace.js
+17 −8 src/ext-beautify.js
+10 −1 src/ext-language_tools.js
+4 −1 src/ext-modelist.js
+4 −1 src/ext-options.js
+4 −1 src/ext-prompt.js
+4 −1 src/ext-settings_menu.js
+14 −4 src/mode-csound_document.js
+14 −4 src/mode-csound_orchestra.js
+514 −0 src/mode-ion.js
+1 −1 src/mode-lua.js
+1 −1 src/mode-luapage.js
+792 −0 src/mode-partiql.js
+10 −4 src/mode-php_laravel_blade.js
+410 −0 src/mode-sac.js
+9 −0 src/snippets/ion.js
+9 −0 src/snippets/partiql.js
+9 −0 src/snippets/sac.js
+3 −3 webpack-resolver.js
8 changes: 4 additions & 4 deletions demo/kitchen-sink/docs/ion.ion
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -33,15 +33,15 @@ 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']
},
push::{
regex: "\'{3}",
token: 'string.trpq.punc.start',
states: rules::[
pop::{
pop :: {
regex: "\'{3}",
token: 'string.trpq.punc.end',
},
Expand All @@ -58,7 +58,7 @@ states::{
*/
}
{
"json": {
"json": {
"compatibility": true,
"open sourced": "2016-04-21T08:10:46Z",
"foo": 9,
Expand Down
7 changes: 2 additions & 5 deletions demo/kitchen-sink/docs/partiql.partiql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -52,9 +52,6 @@ SELECT (

SELECT SUM(AVG(n)) FROM <<numbers, numbers>> 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
Expand Down
2 changes: 1 addition & 1 deletion lib/ace/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

});
7 changes: 6 additions & 1 deletion lib/ace/ext/beautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
34 changes: 34 additions & 0 deletions lib/ace/ext/beautify_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,40 @@ module.exports = {
+ "\t\t\"b\": \"2\"\n"
+ "\t}\n"
+ "</script>");
},

"test beautify php default behaviour with line breaks after comma": function() {
var s = new EditSession([
"<?php\n",
"class Test {",
"public int $id, $num;",
"}"
], new PHPMode());
s.setUseSoftTabs(false);

beautify.beautify(s);
assert.equal(s.getValue(), "<?php\n"
+ "class Test {\n"
+ "\tpublic int $id,\n"
+ "\t$num;\n"
+ "}");
},

"test beautify php with no line breaks after comma": function() {
var s = new EditSession([
"<?php\n",
"class Test {",
"public int $id, $num;",
"}"
], new PHPMode());
s.setUseSoftTabs(false);

beautify.formatOptions.lineBreaksAfterCommasInCurlyBlock = false;
beautify.beautify(s);
assert.equal(s.getValue(), "<?php\n"
+ "class Test {\n"
+ "\tpublic int $id, $num;\n"
+ "}");
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/ace/layer/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ var Text = function(parentEl) {

this.$renderToken = function(parent, screenColumn, token, value) {
var self = this;
var re = /(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g;
var re = /(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g;

var valueFragment = this.dom.createFragment(this.element);

Expand Down
45 changes: 27 additions & 18 deletions lib/ace/mode/_test/tokens_ion.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
],[
["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'a'"],
["storage.type.symbol.quoted.ion","'a'"],
["punctuation.definition.list.separator.ion",","],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'b'"],
["storage.type.symbol.quoted.ion","'b'"],
["punctuation.definition.list.separator.ion",","]
],[
["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"],
Expand Down Expand Up @@ -163,7 +163,8 @@
"start"
],[
"punctuation.definition.struct.begin.ion",
["variable.language.annotation.ion","states::"],
["variable.language.annotation.ion","states"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.struct.begin.ion","{"]
],[
"punctuation.definition.struct.begin.ion",
Expand All @@ -175,13 +176,15 @@
["constant.other.symbol.identifier.ion","root"],
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["variable.language.annotation.ion","rules::"],
["variable.language.annotation.ion","rules"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.list.begin.ion","["]
],[
["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
["variable.language.annotation.ion","include::"],
["constant.other.symbol.quoted.ion","'value'"]
["variable.language.annotation.ion","include"],
["punctuation.definition.annotation.ion","::"],
["storage.type.symbol.quoted.ion","'value'"]
],[
"punctuation.definition.struct.begin.ion",
["text.ion"," "],
Expand All @@ -199,12 +202,14 @@
["constant.other.symbol.identifier.ion","string"],
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["variable.language.annotation.ion","rules::"],
["variable.language.annotation.ion","rules"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.list.begin.ion","["]
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
["variable.language.annotation.ion","match::"],
["variable.language.annotation.ion","match"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.struct.begin.ion","{"]
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
Expand All @@ -223,13 +228,13 @@
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["punctuation.definition.list.begin.ion","["],
["constant.other.symbol.quoted.ion","'string.dblq.punc.start'"],
["storage.type.symbol.quoted.ion","'string.dblq.punc.start'"],
["punctuation.definition.list.separator.ion",","],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'string.dblq'"],
["storage.type.symbol.quoted.ion","'string.dblq'"],
["punctuation.definition.list.separator.ion",","],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'string.dblq.punc.end'"],
["storage.type.symbol.quoted.ion","'string.dblq.punc.end'"],
["punctuation.definition.list.end.ion","]"]
],[
["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
Expand All @@ -239,7 +244,8 @@
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
["variable.language.annotation.ion","push::"],
["variable.language.annotation.ion","push"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.struct.begin.ion","{"]
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
Expand All @@ -257,20 +263,22 @@
["constant.other.symbol.identifier.ion","token"],
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'string.trpq.punc.start'"],
["storage.type.symbol.quoted.ion","'string.trpq.punc.start'"],
["punctuation.definition.struct.separator.ion",","]
],[
["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
["constant.other.symbol.identifier.ion","states"],
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["variable.language.annotation.ion","rules::"],
["variable.language.annotation.ion","rules"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.list.begin.ion","["]
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
["variable.language.annotation.ion","pop::"],
["variable.language.annotation.ion","pop"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.struct.begin.ion","{"]
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
Expand All @@ -288,7 +296,7 @@
["constant.other.symbol.identifier.ion","token"],
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'string.trpq.punc.end'"],
["storage.type.symbol.quoted.ion","'string.trpq.punc.end'"],
["punctuation.definition.struct.separator.ion",","]
],[
["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
Expand All @@ -298,7 +306,8 @@
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
["variable.language.annotation.ion","match::"],
["variable.language.annotation.ion","match"],
["punctuation.definition.annotation.ion","::"],
["punctuation.definition.struct.begin.ion","{"]
],[
["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
Expand All @@ -316,7 +325,7 @@
["constant.other.symbol.identifier.ion","token"],
["punctuation.definition.struct.separator.ion",":"],
["text.ion"," "],
["constant.other.symbol.quoted.ion","'string.trpq'"]
["storage.type.symbol.quoted.ion","'string.trpq'"]
],[
["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"],
["text.ion"," "],
Expand Down
Loading

0 comments on commit fa5090b

Please sign in to comment.