Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorSandeep Somavarapu <sasomava@microsoft.com>2022-06-13 19:21:54 +0300
committerSandeep Somavarapu <sasomava@microsoft.com>2022-06-13 19:21:54 +0300
commit43de1455020e224981a18c55f7117a6dee5cf9eb (patch)
tree6025a580392a46c3fd109588946940bd72c4f349 /build
parent74c528db74d6c70db82b75e409d41eecea35840f (diff)
parente568a31f82680cde0949d7e07dac913565134c93 (diff)
Merge branch 'main' into sandy081/settingsProfile
Diffstat (limited to 'build')
-rw-r--r--build/lib/i18n.js11
-rw-r--r--build/lib/i18n.ts10
2 files changed, 15 insertions, 6 deletions
diff --git a/build/lib/i18n.js b/build/lib/i18n.js
index 99527778da0..dc7c12459b7 100644
--- a/build/lib/i18n.js
+++ b/build/lib/i18n.js
@@ -295,9 +295,10 @@ function stripComments(content) {
// Second group matches a single quoted string
// Third group matches a multi line comment
// Forth group matches a single line comment
- const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
- const result = content.replace(regexp, (match, _m1, _m2, m3, m4) => {
- // Only one of m1, m2, m3, m4 matches
+ // Fifth group matches a trailing comma
+ const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;
+ const result = content.replace(regexp, (match, _m1, _m2, m3, m4, m5) => {
+ // Only one of m1, m2, m3, m4, m5 matches
if (m3) {
// A block comment. Replace with nothing
return '';
@@ -313,6 +314,10 @@ function stripComments(content) {
return '';
}
}
+ else if (m5) {
+ // Remove the trailing comma
+ return match.substring(1);
+ }
else {
// We match a string
return match;
diff --git a/build/lib/i18n.ts b/build/lib/i18n.ts
index c16d31e2d83..dae24b53679 100644
--- a/build/lib/i18n.ts
+++ b/build/lib/i18n.ts
@@ -412,9 +412,10 @@ function stripComments(content: string): string {
// Second group matches a single quoted string
// Third group matches a multi line comment
// Forth group matches a single line comment
- const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
- const result = content.replace(regexp, (match, _m1: string, _m2: string, m3: string, m4: string) => {
- // Only one of m1, m2, m3, m4 matches
+ // Fifth group matches a trailing comma
+ const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;
+ const result = content.replace(regexp, (match, _m1: string, _m2: string, m3: string, m4: string, m5: string) => {
+ // Only one of m1, m2, m3, m4, m5 matches
if (m3) {
// A block comment. Replace with nothing
return '';
@@ -427,6 +428,9 @@ function stripComments(content: string): string {
} else {
return '';
}
+ } else if (m5) {
+ // Remove the trailing comma
+ return match.substring(1);
} else {
// We match a string
return match;