diff --git a/backend/.vscodeignore b/backend/.vscodeignore
index 7b0aeba1..edfbcd96 100644
--- a/backend/.vscodeignore
+++ b/backend/.vscodeignore
@@ -3,5 +3,6 @@
!package.json
!node_modules
!dist
+!resources
out/tests/**
tests/**
diff --git a/backend/package.json b/backend/package.json
index d5c56f8c..8c733d14 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -5,7 +5,7 @@
"license": "Apache 2.0",
"description": "Provide rich user experience for Yeoman generators using VSCode extension or the browser",
"repository": "https://github.com/SAP/yeoman-ui",
- "version": "0.0.33",
+ "version": "0.0.34",
"engines": {
"vscode": "^1.39.2"
},
@@ -22,8 +22,31 @@
{
"command": "loadYeomanUI",
"title": "Yeoman UI Generators"
+ },
+ {
+ "command": "yeomanUI.toggleLog",
+ "title": "Toggle Log",
+ "icon": {
+ "light": "./resources/images/icons/console_light.svg",
+ "dark": "./resources/images/icons/console_dark.svg"
+ }
}
- ]
+ ],
+ "menus": {
+ "commandPalette": [
+ {
+ "command": "yeomanUI.toggleLog",
+ "when": "false"
+ }
+ ],
+ "editor/title": [
+ {
+ "command": "yeomanUI.toggleLog",
+ "group": "navigation",
+ "when": "yeomanUI.Focused"
+ }
+ ]
+ }
},
"scripts": {
"backend": "npm install && npm run compile",
diff --git a/backend/resources/images/icons/console_dark.svg b/backend/resources/images/icons/console_dark.svg
new file mode 100644
index 00000000..a271db4c
--- /dev/null
+++ b/backend/resources/images/icons/console_dark.svg
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/backend/resources/images/icons/console_light.svg b/backend/resources/images/icons/console_light.svg
new file mode 100644
index 00000000..a7428719
--- /dev/null
+++ b/backend/resources/images/icons/console_light.svg
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/backend/src/extension.ts b/backend/src/extension.ts
index 726fffb4..97aeeef6 100644
--- a/backend/src/extension.ts
+++ b/backend/src/extension.ts
@@ -18,6 +18,14 @@ export function activate(context: vscode.ExtensionContext) {
const messages = _.get(options, "messages");
YeomanUIPanel.createOrShow(context.extensionPath, GeneratorFilter.create(genFilter), messages);
}));
+ context.subscriptions.push(
+ vscode.commands.registerCommand('yeomanUI.toggleLog', () => {
+ const yeomanUi = _.get(YeomanUIPanel, "currentPanel.yeomanui");
+ if (yeomanUi) {
+ yeomanUi.toggleLog();
+ }
+ }));
+
if (vscode.window.registerWebviewPanelSerializer) {
// Make sure we register a serializer in activation event
@@ -97,6 +105,9 @@ export class YeomanUIPanel {
// Set the webview's initial html content
this._update();
+ // Set the context (yeoman-ui is focused)
+ vscode.commands.executeCommand('setContext', 'yeomanUI.Focused', this.panel.active);
+
// Listen for when the panel is disposed
// This happens when the user closes the panel or when the panel is closed programatically
this.panel.onDidDispose(() => this.dispose(), null, this.disposables);
@@ -107,6 +118,7 @@ export class YeomanUIPanel {
if (this.panel.visible) {
this._update();
}
+ vscode.commands.executeCommand('setContext', 'yeomanUI.Focused', this.panel.active);
},
null,
this.disposables
diff --git a/backend/tests/extension.spec.ts b/backend/tests/extension.spec.ts
index 1a65e852..9b2806f2 100644
--- a/backend/tests/extension.spec.ts
+++ b/backend/tests/extension.spec.ts
@@ -3,7 +3,6 @@ import { expect } from "chai";
import * as sinon from "sinon";
import * as _ from "lodash";
import { mockVscode } from "./mockUtil";
-import { GeneratorFilter } from "../src/filter";
const oRegisteredCommands = {};
const testVscode = {
@@ -21,6 +20,7 @@ describe('extension unit test', () => {
let commandsMock: any;
let windowMock: any;
let yeomanUiPanelMock: any;
+ let yeomanUiMock: any;
before(() => {
sandbox = sinon.createSandbox();
@@ -34,12 +34,15 @@ describe('extension unit test', () => {
commandsMock = sandbox.mock(testVscode.commands);
windowMock = sandbox.mock(testVscode.window);
yeomanUiPanelMock = sandbox.mock(extension.YeomanUIPanel);
+ _.set(extension.YeomanUIPanel, "currentPanel.yeomanui", {toggleLog: () => {}});
+ yeomanUiMock = sandbox.mock(extension.YeomanUIPanel.currentPanel.yeomanui);
});
afterEach(() => {
commandsMock.verify();
windowMock.verify();
yeomanUiPanelMock.verify();
+ yeomanUiMock.verify();
});
describe('activate', () => {
@@ -50,8 +53,11 @@ describe('extension unit test', () => {
it("commands registration", () => {
extension.activate(testContext);
- expect(_.size(_.keys(oRegisteredCommands))).to.be.equal(1);
- expect(_.keys(oRegisteredCommands)[0]).to.be.equal("loadYeomanUI");
+ expect(_.size(_.keys(oRegisteredCommands))).to.be.equal(2);
+ // tslint:disable-next-line: no-unused-expression
+ expect( _.get(oRegisteredCommands, "loadYeomanUI")).to.be.not.undefined;
+ // tslint:disable-next-line: no-unused-expression
+ expect(_.get(oRegisteredCommands, "yeomanUI.toggleLog")).to.be.not.undefined;
});
it("execution loadYeomanUI command", () => {
@@ -60,5 +66,12 @@ describe('extension unit test', () => {
yeomanUiPanelMock.expects("createOrShow").withArgs(testContext.extensionPath);
loadYeomanUICommand();
});
+
+ it("execution yeomanui.toggleLog command", () => {
+ extension.activate(testContext);
+ const yeomanUIToggleLogCommand = _.get(oRegisteredCommands, "yeomanUI.toggleLog");
+ yeomanUiMock.expects("toggleLog");
+ yeomanUIToggleLogCommand();
+ });
});
});
\ No newline at end of file
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 967e8eeb..67ce17f6 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -15,6 +15,7 @@
:selectedGeneratorHeader="selectedGeneratorHeader"
:stepName="prompts[promptIndex].name"
:rpc="rpc"
+ :isInVsCode="isInVsCode()"
@parentShowConsole="toggleConsole"
/>
@@ -27,7 +28,6 @@
v-if="isDone"
:doneMessage="doneMessage"
:donePath="donePath"
- :isInVsCode="isInVsCode()"
/>
{{selectedGeneratorHeader}}
-
+
mdi-console
@@ -13,7 +13,7 @@