From 76cbab0a2f780bccbc676f59739fdfe5555e10a7 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 19 Jan 2018 12:02:44 +0100 Subject: [PATCH] some polish and fixes --- .../code/electron-browser/issue/bootstrap.css | 88 ------------------- .../electron-browser/issue/issueReporter.html | 3 +- .../electron-browser/issue/issueReporter.js | 27 ++++++ .../issue/issueReporterMain.ts | 3 + .../issue/issueReporterModel.ts | 2 + .../issue/{ => media}/issueReporter.css | 84 ++++++++++++++++++ .../issue/test/testReporterModel.test.ts | 2 + src/vs/code/electron-main/main.ts | 1 + tslint.json | 12 +++ 9 files changed, 132 insertions(+), 90 deletions(-) delete mode 100644 src/vs/code/electron-browser/issue/bootstrap.css rename src/vs/code/electron-browser/issue/{ => media}/issueReporter.css (61%) diff --git a/src/vs/code/electron-browser/issue/bootstrap.css b/src/vs/code/electron-browser/issue/bootstrap.css deleted file mode 100644 index 07e8df4786f..00000000000 --- a/src/vs/code/electron-browser/issue/bootstrap.css +++ /dev/null @@ -1,88 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -/** - * Table - */ - -table { - width: 100%; - max-width: 100%; - margin-bottom: 1rem; - background-color: transparent; - border-collapse: collapse; -} -th { - vertical-align: bottom; - border-bottom: 2px solid #e9ecef; - padding: .75rem; - border-top: 1px solid #e9ecef; - text-align: inherit; -} -tr:nth-of-type(even) { - background-color: rgba(0,0,0,.05); -} -td { - padding: .75rem; - vertical-align: top; - border-top: 1px solid #e9ecef; -} - -/** - * Forms - */ -input, textarea { - display: block; - width: 100%; - padding: .375rem .75rem; - margin: 0; - font-size: 1rem; - line-height: 1.5; - color: #495057; - background-color: #fff; - border-radius: .25rem; - border: 1px solid #ced4da; -} -textarea { - overflow: auto; - resize: vertical; -} -small { - color: #868e96; - display: block; - margin-top: .25rem; - font-size: 80%; - font-weight: 400; -} - -/** - * Button - */ -button { - display: inline-block; - font-weight: 400; - line-height: 1.25; - text-align: center; - white-space: nowrap; - vertical-align: middle; - user-select: none; - padding: .5rem 1rem; - font-size: 1rem; - border-radius: .25rem; - background: none; -} - -select { - height: calc(2.25rem + 2px); - display: block; - width: 100%; - padding: 0.375rem 0.75rem; - font-size: 1rem; - line-height: 1.5; - color: #495057; - background-color: #fff; - border-radius: 0.25rem; - border: none; -} diff --git a/src/vs/code/electron-browser/issue/issueReporter.html b/src/vs/code/electron-browser/issue/issueReporter.html index c5ef557615c..553c3d51de5 100644 --- a/src/vs/code/electron-browser/issue/issueReporter.html +++ b/src/vs/code/electron-browser/issue/issueReporter.html @@ -3,8 +3,7 @@ - - +
diff --git a/src/vs/code/electron-browser/issue/issueReporter.js b/src/vs/code/electron-browser/issue/issueReporter.js index f54c82c250f..31dc101872f 100644 --- a/src/vs/code/electron-browser/issue/issueReporter.js +++ b/src/vs/code/electron-browser/issue/issueReporter.js @@ -3,7 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +'use strict'; + const path = require('path'); +const remote = require('electron').remote; function parseURLQueryArgs() { const search = window.location.search || ''; @@ -36,6 +39,30 @@ function uriFromPath(_path) { function main() { const args = parseURLQueryArgs(); const configuration = JSON.parse(args['config'] || '{}') || {}; + + const extractKey = function (e) { + return [ + e.ctrlKey ? 'ctrl-' : '', + e.metaKey ? 'meta-' : '', + e.altKey ? 'alt-' : '', + e.shiftKey ? 'shift-' : '', + e.keyCode + ].join(''); + }; + + const TOGGLE_DEV_TOOLS_KB = (process.platform === 'darwin' ? 'meta-alt-73' : 'ctrl-shift-73'); // mac: Cmd-Alt-I, rest: Ctrl-Shift-I + const RELOAD_KB = (process.platform === 'darwin' ? 'meta-82' : 'ctrl-82'); // mac: Cmd-R, rest: Ctrl-R + + window.addEventListener('keydown', function (e) { + const key = extractKey(e); + if (key === TOGGLE_DEV_TOOLS_KB) { + remote.getCurrentWebContents().toggleDevTools(); + } else if (key === RELOAD_KB) { + remote.getCurrentWindow().reload(); + } + }); + + // Load the loader and start loading the workbench const rootUrl = uriFromPath(configuration.appRoot) + '/out'; // In the bundled version the nls plugin is packaged with the loader so the NLS Plugins diff --git a/src/vs/code/electron-browser/issue/issueReporterMain.ts b/src/vs/code/electron-browser/issue/issueReporterMain.ts index ace7e535d87..f37957e1518 100644 --- a/src/vs/code/electron-browser/issue/issueReporterMain.ts +++ b/src/vs/code/electron-browser/issue/issueReporterMain.ts @@ -3,6 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import 'vs/css!./media/issueReporter'; import { shell, ipcRenderer, webFrame } from 'electron'; import { $ } from 'vs/base/browser/dom'; import * as browser from 'vs/base/browser/browser'; diff --git a/src/vs/code/electron-browser/issue/issueReporterModel.ts b/src/vs/code/electron-browser/issue/issueReporterModel.ts index 2389cbea151..ab6facf3a25 100644 --- a/src/vs/code/electron-browser/issue/issueReporterModel.ts +++ b/src/vs/code/electron-browser/issue/issueReporterModel.ts @@ -3,6 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +'use strict'; + import { assign } from 'vs/base/common/objects'; export interface IssueReporterData { diff --git a/src/vs/code/electron-browser/issue/issueReporter.css b/src/vs/code/electron-browser/issue/media/issueReporter.css similarity index 61% rename from src/vs/code/electron-browser/issue/issueReporter.css rename to src/vs/code/electron-browser/issue/media/issueReporter.css index 2d9c3f5274d..cb43afc9bc1 100644 --- a/src/vs/code/electron-browser/issue/issueReporter.css +++ b/src/vs/code/electron-browser/issue/media/issueReporter.css @@ -3,6 +3,90 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/** + * Table + */ + +table { + width: 100%; + max-width: 100%; + margin-bottom: 1rem; + background-color: transparent; + border-collapse: collapse; +} +th { + vertical-align: bottom; + border-bottom: 2px solid #e9ecef; + padding: .75rem; + border-top: 1px solid #e9ecef; + text-align: inherit; +} +tr:nth-of-type(even) { + background-color: rgba(0,0,0,.05); +} +td { + padding: .75rem; + vertical-align: top; + border-top: 1px solid #e9ecef; +} + +/** + * Forms + */ +input, textarea { + display: block; + width: 100%; + padding: .375rem .75rem; + margin: 0; + font-size: 1rem; + line-height: 1.5; + color: #495057; + background-color: #fff; + border-radius: .25rem; + border: 1px solid #ced4da; +} +textarea { + overflow: auto; + resize: vertical; +} +small { + color: #868e96; + display: block; + margin-top: .25rem; + font-size: 80%; + font-weight: 400; +} + +/** + * Button + */ +button { + display: inline-block; + font-weight: 400; + line-height: 1.25; + text-align: center; + white-space: nowrap; + vertical-align: middle; + user-select: none; + padding: .5rem 1rem; + font-size: 1rem; + border-radius: .25rem; + background: none; +} + +select { + height: calc(2.25rem + 2px); + display: block; + width: 100%; + padding: 0.375rem 0.75rem; + font-size: 1rem; + line-height: 1.5; + color: #495057; + background-color: #fff; + border-radius: 0.25rem; + border: none; +} + * { box-sizing: border-box; } diff --git a/src/vs/code/electron-browser/issue/test/testReporterModel.test.ts b/src/vs/code/electron-browser/issue/test/testReporterModel.test.ts index 657dc3d2649..16c41488e74 100644 --- a/src/vs/code/electron-browser/issue/test/testReporterModel.test.ts +++ b/src/vs/code/electron-browser/issue/test/testReporterModel.test.ts @@ -3,6 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +'use strict'; + import * as assert from 'assert'; import { IssueReporterModel } from 'vs/code/electron-browser/issue/issueReporterModel'; diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 6ab6a690829..ea7bf733406 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -127,6 +127,7 @@ function setupIPC(accessor: ServicesAccessor): TPromise { function setup(retry: boolean): TPromise { return serve(environmentService.mainIPCHandle).then(server => { + // Print --status usage info if (environmentService.args.status) { logService.warn('Warning: The --status argument can only be used if Code is already running. Please run it again after Code has started.'); diff --git a/tslint.json b/tslint.json index 23e3b8f5899..24a7ac86d1b 100644 --- a/tslint.json +++ b/tslint.json @@ -398,6 +398,18 @@ "*" // node modules ] }, + { + "target": "**/vs/code/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "vs/nls", + "**/vs/base/**", + "**/vs/platform/**", + "**/vs/code/**", + "*" // node modules + ] + }, { "target": "**/vs/code/**", "restrictions": [