Skip to content

Commit

Permalink
package 11.06.24
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakhar Kozlov committed Jun 11, 2024
1 parent 007a5a0 commit d34e384
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 75 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

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.35.0](https://github.com/ajaxorg/ace/compare/v1.34.2...v1.35.0) (2024-06-11)


### Features

* allow '{n}' as placeholder for translated strings ([#5581](https://github.com/ajaxorg/ace/issues/5581)) ([2206024](https://github.com/ajaxorg/ace/commit/220602488b95748c74141d647e13114c7a4569fb))


### Bug Fixes

* allow setting the placeholder type for nls ([#5584](https://github.com/ajaxorg/ace/issues/5584)) ([3e2d50f](https://github.com/ajaxorg/ace/commit/3e2d50f5307e201c20825311585e1f612f1ff23c))
* not closed generic state in case of left-shift operator ([#5572](https://github.com/ajaxorg/ace/issues/5572)) ([e5bea6f](https://github.com/ajaxorg/ace/commit/e5bea6f63290003ff3270d56dbf9610e8a3091a8))
* wrong vue-directives regexp ([#5586](https://github.com/ajaxorg/ace/issues/5586)) ([5f89a33](https://github.com/ajaxorg/ace/commit/5f89a334e69640bb395e74ae86530217d08f141c))

### [1.34.2](https://github.com/ajaxorg/ace/compare/v1.34.1...v1.34.2) (2024-05-27)

### [1.34.1](https://github.com/ajaxorg/ace/compare/v1.34.0...v1.34.1) (2024-05-24)
Expand Down
12 changes: 12 additions & 0 deletions demo/kitchen-sink/docs/vue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ Things to verify:
@click.prevent="onClick('hello')">
Hello
</span>
<router-link v-bind:to="item.url"/>
<!-- v-bind with dynamic key -->
<div v-bind:[key]="value"></div>

<!-- v-bind shorthand with dynamic key -->
<div :[key]="value"></div>

<!-- v-on with dynamic event -->
<div v-on:[event]="handler"></div>

<!-- v-on shorthand with dynamic event -->
<div @[event]="handler"></div>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ace-builds",
"main": "./src-noconflict/ace.js",
"typings": "ace.d.ts",
"version": "1.34.2",
"version": "1.35.0",
"description": "Ace (Ajax.org Cloud9 Editor)",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
2 changes: 1 addition & 1 deletion src-min-noconflict/ace.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min-noconflict/mode-rust.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min-noconflict/mode-vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/ace.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/mode-rust.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/mode-vue.js

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions src-noconflict/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1068,10 +1068,12 @@ function warn(message) {
console.warn.apply(console, arguments);
}
var messages;
var nlsPlaceholders;
var AppConfig = /** @class */ (function () {
function AppConfig() {
this.$defaultOptions = {};
messages = defaultEnglishMessages;
nlsPlaceholders = "dollarSigns";
}
AppConfig.prototype.defineOptions = function (obj, path, options) {
if (!obj.$options)
Expand Down Expand Up @@ -1116,8 +1118,11 @@ var AppConfig = /** @class */ (function () {
this.setDefaultValue(path, key, optionHash[key]);
}, this);
};
AppConfig.prototype.setMessages = function (value) {
AppConfig.prototype.setMessages = function (value, options) {
messages = value;
if (options && options.placeholders) {
nlsPlaceholders = options.placeholders;
}
};
AppConfig.prototype.nls = function (key, defaultString, params) {
if (!messages[key]) {
Expand All @@ -1128,11 +1133,18 @@ var AppConfig = /** @class */ (function () {
}
var translated = messages[key] || messages[defaultString] || defaultString;
if (params) {
translated = translated.replace(/\$(\$|[\d]+)/g, function (_, name) {
if (name == "$")
return "$";
return params[name];
});
if (nlsPlaceholders === "dollarSigns") {
translated = translated.replace(/\$(\$|[\d]+)/g, function (_, dollarMatch) {
if (dollarMatch == "$")
return "$";
return params[dollarMatch];
});
}
if (nlsPlaceholders === "curlyBrackets") {
translated = translated.replace(/\{([^\}]+)\}/g, function (_, curlyBracketMatch) {
return params[curlyBracketMatch];
});
}
}
return translated;
};
Expand Down Expand Up @@ -1304,7 +1316,7 @@ var reportErrorIfPathIsNotConfigured = function () {
reportErrorIfPathIsNotConfigured = function () { };
}
};
exports.version = "1.34.2";
exports.version = "1.35.0";

});

Expand Down
59 changes: 33 additions & 26 deletions src-noconflict/mode-rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ var RustHighlightRules = function () {
]
}, {
token: ['keyword.source.rust', 'text', 'entity.name.function.source.rust', 'punctuation'],
regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')(<)',
regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')(<)(?!<)',
push: "generics"
}, {
token: ['keyword.source.rust', 'text', 'entity.name.function.source.rust'],
regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')'
}, {
token: ['support.constant', "punctuation"],
regex: "(" + wordPattern + '::)(<)',
regex: "(" + wordPattern + '::)(<)(?!<)',
push: "generics"
}, {
token: 'support.constant',
Expand Down Expand Up @@ -160,62 +160,69 @@ var RustHighlightRules = function () {
]
}, {
token: ["keyword.source.rust", "identifier", "punctuaction"],
regex: "(?:(impl)|(" + wordPattern + "))(<)",
regex: "(?:(impl)|(" + wordPattern + "))(<)(?!<)",
stateName: 'generics',
push: [
{
token: 'keyword.operator',
regex: /<<|=/
}, {
token: "punctuaction",
regex: "<",
regex: "<(?!<)",
push: "generics"
}, {
token: 'variable.other.source.rust', // `(?![\\\'])` to keep a lifetime name highlighting from continuing one character
regex: '\'' + wordPattern + '(?![\\\'])'
}, {
token: "storage.type.source.rust",
regex: "\\b(u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|char|bool)\\b"
}, {
token: "punctuation.operator",
regex: "[,:]"
}, {
token: "keyword",
regex: "\\b(?:const|dyn)\\b"
}, {
token: "punctuation",
regex: ">",
next: "pop"
}, {
token: "paren.lparen",
regex: "[(]"
}, {
token: "paren.rparen",
regex: "[)]"
}, {
},
{ include: "punctuation" },
{ include: "operators" },
{ include: "constants" },
{
token: "identifier",
regex: "\\b" + wordPattern + "\\b"
}, {
token: 'keyword.operator',
regex: "="
}
]
}, {
token: keywordMapper,
regex: wordPattern
}, {
token: 'keyword.operator', // `[*/](?![*/])=?` is separated because `//` and `/* */` become comments and must be
regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/
}, {
token: "punctuation.operator",
regex: /[?:,;.]/
}, {
token: 'meta.preprocessor.source.rust',
regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b'
},
{ include: "punctuation" },
{ include: "operators" },
{ include: "constants" }
],
punctuation: [
{
token: "paren.lparen",
regex: /[\[({]/
}, {
token: "paren.rparen",
regex: /[\])}]/
}, {
token: 'meta.preprocessor.source.rust',
regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b'
}, {
token: "punctuation.operator",
regex: /[?:,;.]/
}
],
operators: [
{
token: 'keyword.operator', // `[*/](?![*/])=?` is separated because `//` and `/* */` become comments and must be
regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/
}
],
constants: [
{
token: 'constant.numeric.source.rust',
regex: /\b(?:0x[a-fA-F0-9_]+|0o[0-7_]+|0b[01_]+|[0-9][0-9_]*(?!\.))(?:[iu](?:size|8|16|32|64|128))?\b/
}, {
Expand Down
2 changes: 1 addition & 1 deletion src-noconflict/mode-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -3689,7 +3689,7 @@ var VueHighlightRules = function (options) {
var self = this;
VueRules.tag_stuff.unshift({
token: "string",
regex: /(?:\b(v-)|(:|@))([a-zA-Z\-.]+)(?:\:([a-zA-Z\-]+))?(?:\.([a-zA-Z\-]+))*(\s*)(=)(\s*)(["'])/,
regex: /(?:\b(v-)|(:|@))(\[?[a-zA-Z\-.]+\]?)(?:(\:\[?[a-zA-Z\-]+\]?))?(?:(\.[a-zA-Z\-]+))*(\s*)(=)(\s*)(["'])/,
onMatch: function (value, currentState, stack) {
var quote = value[value.length - 1];
stack.unshift(quote, currentState);
Expand Down
26 changes: 19 additions & 7 deletions src/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1068,10 +1068,12 @@ function warn(message) {
console.warn.apply(console, arguments);
}
var messages;
var nlsPlaceholders;
var AppConfig = /** @class */ (function () {
function AppConfig() {
this.$defaultOptions = {};
messages = defaultEnglishMessages;
nlsPlaceholders = "dollarSigns";
}
AppConfig.prototype.defineOptions = function (obj, path, options) {
if (!obj.$options)
Expand Down Expand Up @@ -1116,8 +1118,11 @@ var AppConfig = /** @class */ (function () {
this.setDefaultValue(path, key, optionHash[key]);
}, this);
};
AppConfig.prototype.setMessages = function (value) {
AppConfig.prototype.setMessages = function (value, options) {
messages = value;
if (options && options.placeholders) {
nlsPlaceholders = options.placeholders;
}
};
AppConfig.prototype.nls = function (key, defaultString, params) {
if (!messages[key]) {
Expand All @@ -1128,11 +1133,18 @@ var AppConfig = /** @class */ (function () {
}
var translated = messages[key] || messages[defaultString] || defaultString;
if (params) {
translated = translated.replace(/\$(\$|[\d]+)/g, function (_, name) {
if (name == "$")
return "$";
return params[name];
});
if (nlsPlaceholders === "dollarSigns") {
translated = translated.replace(/\$(\$|[\d]+)/g, function (_, dollarMatch) {
if (dollarMatch == "$")
return "$";
return params[dollarMatch];
});
}
if (nlsPlaceholders === "curlyBrackets") {
translated = translated.replace(/\{([^\}]+)\}/g, function (_, curlyBracketMatch) {
return params[curlyBracketMatch];
});
}
}
return translated;
};
Expand Down Expand Up @@ -1304,7 +1316,7 @@ var reportErrorIfPathIsNotConfigured = function () {
reportErrorIfPathIsNotConfigured = function () { };
}
};
exports.version = "1.34.2";
exports.version = "1.35.0";

});

Expand Down
59 changes: 33 additions & 26 deletions src/mode-rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ var RustHighlightRules = function () {
]
}, {
token: ['keyword.source.rust', 'text', 'entity.name.function.source.rust', 'punctuation'],
regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')(<)',
regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')(<)(?!<)',
push: "generics"
}, {
token: ['keyword.source.rust', 'text', 'entity.name.function.source.rust'],
regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')'
}, {
token: ['support.constant', "punctuation"],
regex: "(" + wordPattern + '::)(<)',
regex: "(" + wordPattern + '::)(<)(?!<)',
push: "generics"
}, {
token: 'support.constant',
Expand Down Expand Up @@ -160,62 +160,69 @@ var RustHighlightRules = function () {
]
}, {
token: ["keyword.source.rust", "identifier", "punctuaction"],
regex: "(?:(impl)|(" + wordPattern + "))(<)",
regex: "(?:(impl)|(" + wordPattern + "))(<)(?!<)",
stateName: 'generics',
push: [
{
token: 'keyword.operator',
regex: /<<|=/
}, {
token: "punctuaction",
regex: "<",
regex: "<(?!<)",
push: "generics"
}, {
token: 'variable.other.source.rust', // `(?![\\\'])` to keep a lifetime name highlighting from continuing one character
regex: '\'' + wordPattern + '(?![\\\'])'
}, {
token: "storage.type.source.rust",
regex: "\\b(u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|char|bool)\\b"
}, {
token: "punctuation.operator",
regex: "[,:]"
}, {
token: "keyword",
regex: "\\b(?:const|dyn)\\b"
}, {
token: "punctuation",
regex: ">",
next: "pop"
}, {
token: "paren.lparen",
regex: "[(]"
}, {
token: "paren.rparen",
regex: "[)]"
}, {
},
{ include: "punctuation" },
{ include: "operators" },
{ include: "constants" },
{
token: "identifier",
regex: "\\b" + wordPattern + "\\b"
}, {
token: 'keyword.operator',
regex: "="
}
]
}, {
token: keywordMapper,
regex: wordPattern
}, {
token: 'keyword.operator', // `[*/](?![*/])=?` is separated because `//` and `/* */` become comments and must be
regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/
}, {
token: "punctuation.operator",
regex: /[?:,;.]/
}, {
token: 'meta.preprocessor.source.rust',
regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b'
},
{ include: "punctuation" },
{ include: "operators" },
{ include: "constants" }
],
punctuation: [
{
token: "paren.lparen",
regex: /[\[({]/
}, {
token: "paren.rparen",
regex: /[\])}]/
}, {
token: 'meta.preprocessor.source.rust',
regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b'
}, {
token: "punctuation.operator",
regex: /[?:,;.]/
}
],
operators: [
{
token: 'keyword.operator', // `[*/](?![*/])=?` is separated because `//` and `/* */` become comments and must be
regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/
}
],
constants: [
{
token: 'constant.numeric.source.rust',
regex: /\b(?:0x[a-fA-F0-9_]+|0o[0-7_]+|0b[01_]+|[0-9][0-9_]*(?!\.))(?:[iu](?:size|8|16|32|64|128))?\b/
}, {
Expand Down
Loading

0 comments on commit d34e384

Please sign in to comment.