[module.json extensions] source_frame
Bug: 1134103
Change-Id: Ifede39c0db9b44e8df2ae312d38e00bfdf80b2cf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2658340
Commit-Queue: Andres Olivares <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/devtools_grd_files.gni b/devtools_grd_files.gni
index fd68ea5..b6e9227 100644
--- a/devtools_grd_files.gni
+++ b/devtools_grd_files.gni
@@ -375,6 +375,7 @@
"front_end/snippets/snippets.js",
"front_end/snippets/snippets_module.js",
"front_end/source_frame/source_frame-legacy.js",
+ "front_end/source_frame/source_frame-meta.js",
"front_end/source_frame/source_frame.js",
"front_end/source_frame/source_frame_module.js",
"front_end/sources/sources-legacy.js",
diff --git a/devtools_module_entrypoints.gni b/devtools_module_entrypoints.gni
index 0bb4be3..765316a 100644
--- a/devtools_module_entrypoints.gni
+++ b/devtools_module_entrypoints.gni
@@ -175,6 +175,7 @@
"snippets/snippets-legacy.js",
"snippets/snippets.js",
"source_frame/source_frame-legacy.js",
+ "source_frame/source_frame-meta.js",
"source_frame/source_frame.js",
"sources/sources-legacy.js",
"sources/sources-meta.js",
diff --git a/front_end/BUILD.gn b/front_end/BUILD.gn
index 92ee8e3..3cc663e 100644
--- a/front_end/BUILD.gn
+++ b/front_end/BUILD.gn
@@ -52,7 +52,6 @@
"search:bundle",
"services:bundle",
"snippets:bundle",
- "source_frame:bundle",
"startup:bundle",
"test_runner:bundle",
"text_editor:bundle",
@@ -224,6 +223,7 @@
"sdk:meta",
"services:legacy",
"settings:meta",
+ "source_frame:meta",
"sources:meta",
"startup:bundle",
"ui:legacy",
diff --git a/front_end/i18n/locales/en-US.json b/front_end/i18n/locales/en-US.json
index f3b2afb..f5cd7b5 100644
--- a/front_end/i18n/locales/en-US.json
+++ b/front_end/i18n/locales/en-US.json
@@ -3956,42 +3956,39 @@
"source_frame/JSONView.js | find": {
"message": "Find"
},
- "source_frame/ModuleUIStrings.js | defaultIndentation": {
- "message": "Default indentation:"
- },
- "source_frame/ModuleUIStrings.js | eSpaces": {
- "message": "8 spaces"
- },
- "source_frame/ModuleUIStrings.js | fSpaces": {
- "message": "4 spaces"
- },
- "source_frame/ModuleUIStrings.js | setIndentationToESpaces": {
- "message": "Set indentation to 8 spaces"
- },
- "source_frame/ModuleUIStrings.js | setIndentationToFSpaces": {
- "message": "Set indentation to 4 spaces"
- },
- "source_frame/ModuleUIStrings.js | setIndentationToSpaces": {
- "message": "Set indentation to 2 spaces"
- },
- "source_frame/ModuleUIStrings.js | setIndentationToTabCharacter": {
- "message": "Set indentation to tab character"
- },
- "source_frame/ModuleUIStrings.js | sources": {
- "message": "Sources"
- },
- "source_frame/ModuleUIStrings.js | Spaces": {
- "message": "2 spaces"
- },
- "source_frame/ModuleUIStrings.js | tabCharacter": {
- "message": "Tab character"
- },
"source_frame/PreviewFactory.js | nothingToPreview": {
"message": "Nothing to preview"
},
"source_frame/ResourceSourceFrame.js | find": {
"message": "Find"
},
+ "source_frame/source_frame-meta.ts | defaultIndentation": {
+ "message": "Default indentation:"
+ },
+ "source_frame/source_frame-meta.ts | eSpaces": {
+ "message": "8 spaces"
+ },
+ "source_frame/source_frame-meta.ts | fSpaces": {
+ "message": "4 spaces"
+ },
+ "source_frame/source_frame-meta.ts | setIndentationToESpaces": {
+ "message": "Set indentation to 8 spaces"
+ },
+ "source_frame/source_frame-meta.ts | setIndentationToFSpaces": {
+ "message": "Set indentation to 4 spaces"
+ },
+ "source_frame/source_frame-meta.ts | setIndentationToSpaces": {
+ "message": "Set indentation to 2 spaces"
+ },
+ "source_frame/source_frame-meta.ts | setIndentationToTabCharacter": {
+ "message": "Set indentation to tab character"
+ },
+ "source_frame/source_frame-meta.ts | Spaces": {
+ "message": "2 spaces"
+ },
+ "source_frame/source_frame-meta.ts | tabCharacter": {
+ "message": "Tab character"
+ },
"source_frame/SourceFrame.js | bytecodePositionXs": {
"message": "Bytecode position 0x{PH1}"
},
diff --git a/front_end/shell.js b/front_end/shell.js
index a73836b..4a31e13 100644
--- a/front_end/shell.js
+++ b/front_end/shell.js
@@ -31,4 +31,5 @@
import './perf_ui/perf_ui-meta.js';
import './quick_open/quick_open-meta.js';
import './sdk/sdk-meta.js';
+import './source_frame/source_frame-meta.js';
// We generate the descriptors in this file, which depend on the runtime.
diff --git a/front_end/source_frame/BUILD.gn b/front_end/source_frame/BUILD.gn
index 2756e7c..7852747 100644
--- a/front_end/source_frame/BUILD.gn
+++ b/front_end/source_frame/BUILD.gn
@@ -47,3 +47,9 @@
deps = [ ":bundle" ]
}
+
+devtools_entrypoint("meta") {
+ entrypoint = "source_frame-meta.ts"
+
+ deps = [ ":bundle" ]
+}
diff --git a/front_end/source_frame/ModuleUIStrings.js b/front_end/source_frame/ModuleUIStrings.js
index a6f0fb4..09f6acc 100644
--- a/front_end/source_frame/ModuleUIStrings.js
+++ b/front_end/source_frame/ModuleUIStrings.js
@@ -3,46 +3,5 @@
// found in the LICENSE file.
import * as i18n from '../i18n/i18n.js';
-export const UIStrings = {
- /**
- *@description Name of the Sources panel
- */
- sources: 'Sources',
- /**
- *@description Title of a setting under the Sources category in Settings
- */
- defaultIndentation: 'Default indentation:',
- /**
- *@description Title of a setting under the Sources category that can be invoked through the Command Menu
- */
- setIndentationToSpaces: 'Set indentation to 2 spaces',
- /**
- *@description A drop-down menu option to set indentation to 2 spaces
- */
- Spaces: '2 spaces',
- /**
- *@description Title of a setting under the Sources category that can be invoked through the Command Menu
- */
- setIndentationToFSpaces: 'Set indentation to 4 spaces',
- /**
- *@description A drop-down menu option to set indentation to 4 spaces
- */
- fSpaces: '4 spaces',
- /**
- *@description Title of a setting under the Sources category that can be invoked through the Command Menu
- */
- setIndentationToESpaces: 'Set indentation to 8 spaces',
- /**
- *@description A drop-down menu option to set indentation to 8 spaces
- */
- eSpaces: '8 spaces',
- /**
- *@description Title of a setting under the Sources category that can be invoked through the Command Menu
- */
- setIndentationToTabCharacter: 'Set indentation to tab character',
- /**
- *@description A drop-down menu option to set indentation to tab character
- */
- tabCharacter: 'Tab character',
-};
+export const UIStrings = {};
i18n.i18n.registerUIStrings('source_frame/ModuleUIStrings.js', UIStrings);
diff --git a/front_end/source_frame/module.json b/front_end/source_frame/module.json
index 3677f59..5c7e3a0 100644
--- a/front_end/source_frame/module.json
+++ b/front_end/source_frame/module.json
@@ -1,36 +1,4 @@
{
- "extensions": [
- {
- "type": "setting",
- "category": "Sources",
- "title": "Default indentation:",
- "settingName": "textEditorIndent",
- "settingType": "enum",
- "defaultValue": " ",
- "options": [
- {
- "title": "Set indentation to 2 spaces",
- "text": "2 spaces",
- "value": " "
- },
- {
- "title": "Set indentation to 4 spaces",
- "text": "4 spaces",
- "value": " "
- },
- {
- "title": "Set indentation to 8 spaces",
- "text": "8 spaces",
- "value": " "
- },
- {
- "title": "Set indentation to tab character",
- "text": "Tab character",
- "value": "\t"
- }
- ]
- }
- ],
"dependencies": [
"i18n",
"text_editor",
diff --git a/front_end/source_frame/source_frame-meta.ts b/front_end/source_frame/source_frame-meta.ts
new file mode 100644
index 0000000..57b9758
--- /dev/null
+++ b/front_end/source_frame/source_frame-meta.ts
@@ -0,0 +1,77 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import * as Common from '../common/common.js';
+import * as i18n from '../i18n/i18n.js';
+
+export const UIStrings = {
+ /**
+ *@description Title of a setting under the Sources category in Settings
+ */
+ defaultIndentation: 'Default indentation:',
+ /**
+ *@description Title of a setting under the Sources category that can be invoked through the Command Menu
+ */
+ setIndentationToSpaces: 'Set indentation to 2 spaces',
+ /**
+ *@description A drop-down menu option to set indentation to 2 spaces
+ */
+ Spaces: '2 spaces',
+ /**
+ *@description Title of a setting under the Sources category that can be invoked through the Command Menu
+ */
+ setIndentationToFSpaces: 'Set indentation to 4 spaces',
+ /**
+ *@description A drop-down menu option to set indentation to 4 spaces
+ */
+ fSpaces: '4 spaces',
+ /**
+ *@description Title of a setting under the Sources category that can be invoked through the Command Menu
+ */
+ setIndentationToESpaces: 'Set indentation to 8 spaces',
+ /**
+ *@description A drop-down menu option to set indentation to 8 spaces
+ */
+ eSpaces: '8 spaces',
+ /**
+ *@description Title of a setting under the Sources category that can be invoked through the Command Menu
+ */
+ setIndentationToTabCharacter: 'Set indentation to tab character',
+ /**
+ *@description A drop-down menu option to set indentation to tab character
+ */
+ tabCharacter: 'Tab character',
+};
+const str_ = i18n.i18n.registerUIStrings('source_frame/source_frame-meta.ts', UIStrings);
+const i18nString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
+
+Common.Settings.registerSettingExtension({
+ category: Common.Settings.SettingCategoryObject.SOURCES,
+ title: i18nString(UIStrings.defaultIndentation),
+ settingName: 'textEditorIndent',
+ settingType: Common.Settings.SettingTypeObject.ENUM,
+ defaultValue: ' ',
+ options: [
+ {
+ title: i18nString(UIStrings.setIndentationToSpaces),
+ text: i18nString(UIStrings.Spaces),
+ value: ' ',
+ },
+ {
+ title: i18nString(UIStrings.setIndentationToFSpaces),
+ text: i18nString(UIStrings.fSpaces),
+ value: ' ',
+ },
+ {
+ title: i18nString(UIStrings.setIndentationToESpaces),
+ text: i18nString(UIStrings.eSpaces),
+ value: ' ',
+ },
+ {
+ title: i18nString(UIStrings.setIndentationToTabCharacter),
+ text: i18nString(UIStrings.tabCharacter),
+ value: '\t',
+ },
+ ],
+});