From 4d2ecf08afeb1556f2511a1423729c2549802da8 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Wed, 11 May 2022 09:06:39 +0200 Subject: [PATCH 1/7] fix: Render bidirectional unicode characters as control characters (#4693) --- lib/ace/layer/text.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index ff5748d3697..84ba805030a 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -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); From 20275de79c40636d27d5ce293cf528c915338fbd Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Wed, 11 May 2022 15:16:56 +0200 Subject: [PATCH 2/7] feat: Added ability to configure certain format options for beautify extension --- lib/ace/ext/beautify.js | 7 ++++++- lib/ace/ext/beautify_test.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) 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([ + " Date: Thu, 12 May 2022 14:08:15 +0400 Subject: [PATCH 3/7] chore: use npm changelog in release script (#4698) --- tool/release.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 " From 4fb4214cca8a146c6aeb2a5f3c42d0498e5813fa Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 12 May 2022 12:37:01 +0200 Subject: [PATCH 4/7] release v1.5.0 --- CHANGELOG.md | 17 +++++++++++++++++ build | 2 +- lib/ace/config.js | 2 +- package.json | 4 ++-- 4 files changed, 21 insertions(+), 4 deletions(-) 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/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/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 +} From 33cf1c66af970edaf7eb0a468276fca249b8a5c8 Mon Sep 17 00:00:00 2001 From: jeroenpost86 Date: Thu, 12 May 2022 03:49:39 -0700 Subject: [PATCH 5/7] fix: Updated PHP mode to support PHP8.1 syntax (#4696) Co-authored-by: Pipelines --- lib/ace/mode/php/php.js | 4830 ++++++++++++++++++++------------------- 1 file changed, 2509 insertions(+), 2321 deletions(-) diff --git a/lib/ace/mode/php/php.js b/lib/ace/mode/php/php.js index 29f4c05699b..315471c3376 100644 --- a/lib/ace/mode/php/php.js +++ b/lib/ace/mode/php/php.js @@ -16,2329 +16,2517 @@ */ - -define(function(require, exports, module) { - -var PHP = {Constants:{}}; - -PHP.Constants.T_INCLUDE = 259 -PHP.Constants.T_INCLUDE_ONCE = 260 -PHP.Constants.T_EVAL = 318 -PHP.Constants.T_REQUIRE = 261 -PHP.Constants.T_REQUIRE_ONCE = 262 -PHP.Constants.T_LOGICAL_OR = 263 -PHP.Constants.T_LOGICAL_XOR = 264 -PHP.Constants.T_LOGICAL_AND = 265 -PHP.Constants.T_PRINT = 266 -PHP.Constants.T_YIELD = 267 -PHP.Constants.T_DOUBLE_ARROW = 268 -PHP.Constants.T_YIELD_FROM = 269 -PHP.Constants.T_PLUS_EQUAL = 270 -PHP.Constants.T_MINUS_EQUAL = 271 -PHP.Constants.T_MUL_EQUAL = 272 -PHP.Constants.T_DIV_EQUAL = 273 -PHP.Constants.T_CONCAT_EQUAL = 274 -PHP.Constants.T_MOD_EQUAL = 275 -PHP.Constants.T_AND_EQUAL = 276 -PHP.Constants.T_OR_EQUAL = 277 -PHP.Constants.T_XOR_EQUAL = 278 -PHP.Constants.T_SL_EQUAL = 279 -PHP.Constants.T_SR_EQUAL = 280 -PHP.Constants.T_POW_EQUAL = 281 -PHP.Constants.T_COALESCE_EQUAL = 282 -PHP.Constants.T_COALESCE = 283 -PHP.Constants.T_BOOLEAN_OR = 284 -PHP.Constants.T_BOOLEAN_AND = 285 -PHP.Constants.T_IS_EQUAL = 286 -PHP.Constants.T_IS_NOT_EQUAL = 287 -PHP.Constants.T_IS_IDENTICAL = 288 -PHP.Constants.T_IS_NOT_IDENTICAL = 289 -PHP.Constants.T_SPACESHIP = 290 -PHP.Constants.T_IS_SMALLER_OR_EQUAL = 291 -PHP.Constants.T_IS_GREATER_OR_EQUAL = 292 -PHP.Constants.T_SL = 293 -PHP.Constants.T_SR = 294 -PHP.Constants.T_INSTANCEOF = 295 -PHP.Constants.T_INC = 319 -PHP.Constants.T_DEC = 320 -PHP.Constants.T_INT_CAST = 296 -PHP.Constants.T_DOUBLE_CAST = 297 -PHP.Constants.T_STRING_CAST = 298 -PHP.Constants.T_ARRAY_CAST = 299 -PHP.Constants.T_OBJECT_CAST = 300 -PHP.Constants.T_BOOL_CAST = 301 -PHP.Constants.T_UNSET_CAST = 302 -PHP.Constants.T_POW = 303 -PHP.Constants.T_NEW = 304 -PHP.Constants.T_CLONE = 305 -PHP.Constants.T_EXIT = 321 -PHP.Constants.T_IF = 322 -PHP.Constants.T_ELSEIF = 307 -PHP.Constants.T_ELSE = 308 -PHP.Constants.T_ENDIF = 323 -PHP.Constants.T_LNUMBER = 309 -PHP.Constants.T_DNUMBER = 310 -PHP.Constants.T_STRING = 311 -PHP.Constants.T_STRING_VARNAME = 316 -PHP.Constants.T_VARIABLE = 312 -PHP.Constants.T_NUM_STRING = 317 -PHP.Constants.T_INLINE_HTML = 313 -PHP.Constants.T_BAD_CHARACTER = 395 -PHP.Constants.T_ENCAPSED_AND_WHITESPACE = 314 -PHP.Constants.T_CONSTANT_ENCAPSED_STRING = 315 -PHP.Constants.T_ECHO = 324 -PHP.Constants.T_DO = 325 -PHP.Constants.T_WHILE = 326 -PHP.Constants.T_ENDWHILE = 327 -PHP.Constants.T_FOR = 328 -PHP.Constants.T_ENDFOR = 329 -PHP.Constants.T_FOREACH = 330 -PHP.Constants.T_ENDFOREACH = 331 -PHP.Constants.T_DECLARE = 332 -PHP.Constants.T_ENDDECLARE = 333 -PHP.Constants.T_AS = 334 -PHP.Constants.T_SWITCH = 335 -PHP.Constants.T_ENDSWITCH = 336 -PHP.Constants.T_CASE = 337 -PHP.Constants.T_DEFAULT = 338 -PHP.Constants.T_BREAK = 339 -PHP.Constants.T_CONTINUE = 340 -PHP.Constants.T_GOTO = 341 -PHP.Constants.T_FUNCTION = 342 -PHP.Constants.T_FN = 343 -PHP.Constants.T_CONST = 344 -PHP.Constants.T_RETURN = 345 -PHP.Constants.T_TRY = 346 -PHP.Constants.T_CATCH = 347 -PHP.Constants.T_FINALLY = 348 -PHP.Constants.T_THROW = 349 -PHP.Constants.T_USE = 350 -PHP.Constants.T_INSTEADOF = 351 -PHP.Constants.T_GLOBAL = 352 -PHP.Constants.T_STATIC = 353 -PHP.Constants.T_ABSTRACT = 354 -PHP.Constants.T_FINAL = 355 -PHP.Constants.T_PRIVATE = 356 -PHP.Constants.T_PROTECTED = 357 -PHP.Constants.T_PUBLIC = 358 -PHP.Constants.T_VAR = 359 -PHP.Constants.T_UNSET = 360 -PHP.Constants.T_ISSET = 361 -PHP.Constants.T_EMPTY = 362 -PHP.Constants.T_HALT_COMPILER = 363 -PHP.Constants.T_CLASS = 364 -PHP.Constants.T_TRAIT = 365 -PHP.Constants.T_INTERFACE = 366 -PHP.Constants.T_EXTENDS = 367 -PHP.Constants.T_IMPLEMENTS = 368 -PHP.Constants.T_OBJECT_OPERATOR = 369 -PHP.Constants.T_DOUBLE_ARROW = 268 -PHP.Constants.T_LIST = 370 -PHP.Constants.T_ARRAY = 371 -PHP.Constants.T_CALLABLE = 372 -PHP.Constants.T_CLASS_C = 376 -PHP.Constants.T_TRAIT_C = 377 -PHP.Constants.T_METHOD_C = 378 -PHP.Constants.T_FUNC_C = 379 -PHP.Constants.T_LINE = 373 -PHP.Constants.T_FILE = 374 -PHP.Constants.T_COMMENT = 380 -PHP.Constants.T_DOC_COMMENT = 381 -PHP.Constants.T_OPEN_TAG = 382 -PHP.Constants.T_OPEN_TAG_WITH_ECHO = 383 -PHP.Constants.T_CLOSE_TAG = 384 -PHP.Constants.T_WHITESPACE = 385 -PHP.Constants.T_START_HEREDOC = 386 -PHP.Constants.T_END_HEREDOC = 387 -PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES = 388 -PHP.Constants.T_CURLY_OPEN = 389 -PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM = 390 -PHP.Constants.T_NAMESPACE = 391 -PHP.Constants.T_NS_C = 392 -PHP.Constants.T_DIR = 375 -PHP.Constants.T_NS_SEPARATOR = 393 -PHP.Constants.T_ELLIPSIS = 394 - -PHP.Lexer = function(src, ini) { - var heredoc, heredocEndAllowed, - - stateStack = ['INITIAL'], stackPos = 0, - swapState = function(state) { - stateStack[stackPos] = state; - }, - pushState = function(state) { - stateStack[++stackPos] = state; - }, - popState = function() { - --stackPos; - }, - - shortOpenTag = ini === undefined || /^(on|true|1)$/i.test(ini.short_open_tag), - openTag = shortOpenTag - ? /^(\<\?php(?:\r\n|[ \t\r\n])|<\?|\