diff --git a/resources/unpacked/devtools/front_end/console/ConsoleView.js b/resources/unpacked/devtools/front_end/console/ConsoleView.js
index a76ce94fe4..6ac4515fa2 100644
--- a/resources/unpacked/devtools/front_end/console/ConsoleView.js
+++ b/resources/unpacked/devtools/front_end/console/ConsoleView.js
@@ -827,21 +827,22 @@ WebInspector.ConsoleView.prototype = {
* @param {!WebInspector.ConsoleMessage} message
* @return {!WebInspector.ConsoleViewMessage}
*/
- _createViewMessage2: function(message)
- {
+ _createViewMessage2: function(message) {
var nestingLevel = this._currentGroup.nestingLevel();
switch (message.type) {
- case WebInspector.ConsoleMessage.MessageType.Command:
- return new WebInspector.ConsoleCommand(message, this._linkifier, nestingLevel);
- case WebInspector.ConsoleMessage.MessageType.DiracCommand:
- return new WebInspector.ConsoleDiracCommand(message, this._linkifier, nestingLevel);
- case WebInspector.ConsoleMessage.MessageType.Result:
- return new WebInspector.ConsoleCommandResult(message, this._linkifier, nestingLevel);
- case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
- case WebInspector.ConsoleMessage.MessageType.StartGroup:
- return new WebInspector.ConsoleGroupViewMessage(message, this._linkifier, nestingLevel);
- default:
- return new WebInspector.ConsoleViewMessage(message, this._linkifier, nestingLevel);
+ case WebInspector.ConsoleMessage.MessageType.Command:
+ return new WebInspector.ConsoleCommand(message, this._linkifier, nestingLevel);
+ case WebInspector.ConsoleMessage.MessageType.DiracCommand:
+ return new WebInspector.ConsoleDiracCommand(message, this._linkifier, nestingLevel);
+ case WebInspector.ConsoleMessage.MessageType.DiracMarkup:
+ return new WebInspector.ConsoleDiracMarkup(message, this._linkifier, nestingLevel);
+ case WebInspector.ConsoleMessage.MessageType.Result:
+ return new WebInspector.ConsoleCommandResult(message, this._linkifier, nestingLevel);
+ case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
+ case WebInspector.ConsoleMessage.MessageType.StartGroup:
+ return new WebInspector.ConsoleGroupViewMessage(message, this._linkifier, nestingLevel);
+ default:
+ return new WebInspector.ConsoleViewMessage(message, this._linkifier, nestingLevel);
}
},
@@ -1072,6 +1073,37 @@ WebInspector.ConsoleView.prototype = {
this._prompt.setText("");
},
+ appendDiracMarkup: function (markup) {
+ const executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
+ if (!executionContext) {
+ return false;
+ }
+
+ const target = executionContext.target();
+ const source = WebInspector.ConsoleMessage.MessageSource.Other;
+ const level = WebInspector.ConsoleMessage.MessageLevel.Log;
+ const type = WebInspector.ConsoleMessage.MessageType.DiracMarkup;
+ const message = new WebInspector.ConsoleMessage(target, source, level, markup, type);
+ message.setExecutionContextId(executionContext.id);
+ target.consoleModel.addMessage(message);
+ },
+
+ displayWelcomeMessage: function() {
+ dirac.feedback('displayWelcomeMessage');
+ const wrapCode = (text) => {
+ return "" + text + "
";
+ };
+ const wrapBold = (text) => {
+ return "" + text + "";
+ };
+
+ var markup = [
+ "Welcome to " + wrapBold("Dirac DevTools") + " hosted in " + wrapBold("Dirac Chrome Extension v" + dirac.getVersion()) + ".",
+ "Use " + wrapCode("CTRL+,") + " and " + wrapCode("CTRL+.") + " to switch between Javascript and Dirac prompts.",
+ "In connected Dirac prompt, you can enter " + wrapCode("(dirac! :help)") + " for more info."];
+ this.appendDiracMarkup(markup.join("\n"));
+ },
+
_normalizePromptIndex: function(index) {
var count = this._prompts.length;
while (index<0) {
@@ -1700,7 +1732,7 @@ WebInspector.ConsoleCommand.prototype = {
WebInspector.ConsoleDiracCommand = function(message, linkifier, nestingLevel)
{
WebInspector.ConsoleCommand.call(this, message, linkifier, nestingLevel);
-}
+};
WebInspector.ConsoleDiracCommand.prototype = {
@@ -1725,7 +1757,43 @@ WebInspector.ConsoleDiracCommand.prototype = {
},
__proto__: WebInspector.ConsoleCommand.prototype
-}
+};
+
+/**
+ * @constructor
+ * @extends {WebInspector.ConsoleViewMessage}
+ * @param {!WebInspector.ConsoleMessage} message
+ * @param {!WebInspector.Linkifier} linkifier
+ * @param {number} nestingLevel
+ */
+WebInspector.ConsoleDiracMarkup = function(message, linkifier, nestingLevel)
+{
+ WebInspector.ConsoleViewMessage.call(this, message, linkifier, nestingLevel);
+};
+
+WebInspector.ConsoleDiracMarkup.prototype = {
+
+ /**
+ * @override
+ * @return {!Element}
+ */
+ contentElement: function()
+ {
+ if (!this._element) {
+ this._element = createElementWithClass("div", "console-message console-dirac-markup");
+ this._element.message = this;
+
+ this._formattedCommand = createElementWithClass("span", "console-message-text source-code");
+ this._formattedCommand.innerHTML = this._message.messageText;
+ this._element.appendChild(this._formattedCommand);
+
+ this.element().classList.add("dirac-flavor"); // applied to wrapper element
+ }
+ return this._element;
+ },
+
+ __proto__: WebInspector.ConsoleViewMessage.prototype
+};
/**
diff --git a/resources/unpacked/devtools/front_end/console/dirac-prompt.css b/resources/unpacked/devtools/front_end/console/dirac-prompt.css
index 4301cc0418..be334bd032 100644
--- a/resources/unpacked/devtools/front_end/console/dirac-prompt.css
+++ b/resources/unpacked/devtools/front_end/console/dirac-prompt.css
@@ -11,6 +11,10 @@
-webkit-filter: hue-rotate(280deg);
}
+.console-dirac-markup {
+ line-height: 14px;
+}
+
.console-message, .console-user-command {
padding-left: 4px !important;
padding-right: 4px !important;
diff --git a/resources/unpacked/devtools/front_end/sdk/ConsoleModel.js b/resources/unpacked/devtools/front_end/sdk/ConsoleModel.js
index a52572afc4..8218f01163 100644
--- a/resources/unpacked/devtools/front_end/sdk/ConsoleModel.js
+++ b/resources/unpacked/devtools/front_end/sdk/ConsoleModel.js
@@ -451,6 +451,7 @@ WebInspector.ConsoleMessage.MessageType = {
Profile: "profile",
ProfileEnd: "profileEnd",
DiracCommand: "diracCommand",
+ DiracMarkup: "diracMarkup",
Command: "command"
}
diff --git a/test/browser/transcripts/expected/suite01-completions.txt b/test/browser/transcripts/expected/suite01-completions.txt
index 56bec2cb57..eb7dfc7055 100644
--- a/test/browser/transcripts/expected/suite01-completions.txt
+++ b/test/browser/transcripts/expected/suite01-completions.txt
@@ -12,6 +12,7 @@ devtools #1 console initialized
devtools #1 adopt-prompt-element use-parinfer? true
devtools #1 setDiracPromptMode('status')
devtools #1 ConsoleView constructed
+devtools #1 displayWelcomeMessage
devtools #1 setCurrentPanel: console
automate #1 switch-prompt-to-dirac!
devtools #1 switched console prompt to 'dirac'
diff --git a/test/browser/transcripts/expected/suite01-console.txt b/test/browser/transcripts/expected/suite01-console.txt
index 5df279f3b5..ee25837e2c 100644
--- a/test/browser/transcripts/expected/suite01-console.txt
+++ b/test/browser/transcripts/expected/suite01-console.txt
@@ -12,6 +12,7 @@ devtools #1 console initialized
devtools #1 adopt-prompt-element use-parinfer? true
devtools #1 setDiracPromptMode('status')
devtools #1 ConsoleView constructed
+devtools #1 displayWelcomeMessage
devtools #1 setCurrentPanel: console
automate #1 enable-console-feedback!
automate #1 simulate-console-action! ["CTRL+."]
diff --git a/test/browser/transcripts/expected/suite01-dirac-eval.txt b/test/browser/transcripts/expected/suite01-dirac-eval.txt
index 47176faf72..63d0454dc4 100644
--- a/test/browser/transcripts/expected/suite01-dirac-eval.txt
+++ b/test/browser/transcripts/expected/suite01-dirac-eval.txt
@@ -12,6 +12,7 @@ devtools #1 console initialized
devtools #1 adopt-prompt-element use-parinfer? true
devtools #1 setDiracPromptMode('status')
devtools #1 ConsoleView constructed
+devtools #1 displayWelcomeMessage
devtools #1 setCurrentPanel: console
automate #1 switch-prompt-to-dirac!
devtools #1 switched console prompt to 'dirac'
diff --git a/test/browser/transcripts/expected/suite01-disabled-parinfer.txt b/test/browser/transcripts/expected/suite01-disabled-parinfer.txt
index a26584f957..1ea750898a 100644
--- a/test/browser/transcripts/expected/suite01-disabled-parinfer.txt
+++ b/test/browser/transcripts/expected/suite01-disabled-parinfer.txt
@@ -13,6 +13,7 @@ devtools #1 console initialized
devtools #1 adopt-prompt-element use-parinfer? false
devtools #1 setDiracPromptMode('status')
devtools #1 ConsoleView constructed
+devtools #1 displayWelcomeMessage
devtools #1 setCurrentPanel: console
automate #1 switch-prompt-to-dirac!
devtools #1 switched console prompt to 'dirac'
diff --git a/test/browser/transcripts/expected/suite01-no-agent-connection.txt b/test/browser/transcripts/expected/suite01-no-agent-connection.txt
index 83700c0473..07038a9eae 100644
--- a/test/browser/transcripts/expected/suite01-no-agent-connection.txt
+++ b/test/browser/transcripts/expected/suite01-no-agent-connection.txt
@@ -12,6 +12,7 @@ devtools #1 console initialized
devtools #1 adopt-prompt-element use-parinfer? true
devtools #1 setDiracPromptMode('status')
devtools #1 ConsoleView constructed
+devtools #1 displayWelcomeMessage
devtools #1 setCurrentPanel: console
automate #1 switch-prompt-to-dirac!
devtools #1 switched console prompt to 'dirac'