提交 d6f67eb9 编写于 作者: J Joao Moreno

Merge remote-tracking branch 'origin/master'

...@@ -350,6 +350,7 @@ gulp.task('clean-vscode-darwin', util.rimraf(path.join(buildRoot, 'VSCode-darwin ...@@ -350,6 +350,7 @@ gulp.task('clean-vscode-darwin', util.rimraf(path.join(buildRoot, 'VSCode-darwin
gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(buildRoot, 'VSCode-linux-ia32'))); gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(buildRoot, 'VSCode-linux-ia32')));
gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(buildRoot, 'VSCode-linux-x64'))); gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(buildRoot, 'VSCode-linux-x64')));
gulp.task('clean-vscode-linux-arm', util.rimraf(path.join(buildRoot, 'VSCode-linux-arm'))); gulp.task('clean-vscode-linux-arm', util.rimraf(path.join(buildRoot, 'VSCode-linux-arm')));
gulp.task('clean-vscode-linux-arm64', util.rimraf(path.join(buildRoot, 'VSCode-linux-arm64')));
gulp.task('vscode-win32-ia32', ['optimize-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32')); gulp.task('vscode-win32-ia32', ['optimize-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32'));
gulp.task('vscode-win32-x64', ['optimize-vscode', 'clean-vscode-win32-x64'], packageTask('win32', 'x64')); gulp.task('vscode-win32-x64', ['optimize-vscode', 'clean-vscode-win32-x64'], packageTask('win32', 'x64'));
...@@ -357,6 +358,7 @@ gulp.task('vscode-darwin', ['optimize-vscode', 'clean-vscode-darwin'], packageTa ...@@ -357,6 +358,7 @@ gulp.task('vscode-darwin', ['optimize-vscode', 'clean-vscode-darwin'], packageTa
gulp.task('vscode-linux-ia32', ['optimize-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32')); gulp.task('vscode-linux-ia32', ['optimize-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32'));
gulp.task('vscode-linux-x64', ['optimize-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64')); gulp.task('vscode-linux-x64', ['optimize-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64'));
gulp.task('vscode-linux-arm', ['optimize-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm')); gulp.task('vscode-linux-arm', ['optimize-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm'));
gulp.task('vscode-linux-arm64', ['optimize-vscode', 'clean-vscode-linux-arm64'], packageTask('linux', 'arm64'));
gulp.task('vscode-win32-ia32-min', ['minify-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32', { minified: true })); gulp.task('vscode-win32-ia32-min', ['minify-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32', { minified: true }));
gulp.task('vscode-win32-x64-min', ['minify-vscode', 'clean-vscode-win32-x64'], packageTask('win32', 'x64', { minified: true })); gulp.task('vscode-win32-x64-min', ['minify-vscode', 'clean-vscode-win32-x64'], packageTask('win32', 'x64', { minified: true }));
...@@ -364,6 +366,7 @@ gulp.task('vscode-darwin-min', ['minify-vscode', 'clean-vscode-darwin'], package ...@@ -364,6 +366,7 @@ gulp.task('vscode-darwin-min', ['minify-vscode', 'clean-vscode-darwin'], package
gulp.task('vscode-linux-ia32-min', ['minify-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32', { minified: true })); gulp.task('vscode-linux-ia32-min', ['minify-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32', { minified: true }));
gulp.task('vscode-linux-x64-min', ['minify-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64', { minified: true })); gulp.task('vscode-linux-x64-min', ['minify-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64', { minified: true }));
gulp.task('vscode-linux-arm-min', ['minify-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm', { minified: true })); gulp.task('vscode-linux-arm-min', ['minify-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm', { minified: true }));
gulp.task('vscode-linux-arm64-min', ['minify-vscode', 'clean-vscode-linux-arm64'], packageTask('linux', 'arm64', { minified: true }));
// Transifex Localizations // Transifex Localizations
......
...@@ -19,7 +19,7 @@ const rpmDependencies = require('../resources/linux/rpm/dependencies.json'); ...@@ -19,7 +19,7 @@ const rpmDependencies = require('../resources/linux/rpm/dependencies.json');
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000); const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
function getDebPackageArch(arch) { function getDebPackageArch(arch) {
return { x64: 'amd64', ia32: 'i386', arm: 'armhf' }[arch]; return { x64: 'amd64', ia32: 'i386', arm: 'armhf', arm64: "arm64" }[arch];
} }
function prepareDebPackage(arch) { function prepareDebPackage(arch) {
...@@ -98,7 +98,7 @@ function getRpmBuildPath(rpmArch) { ...@@ -98,7 +98,7 @@ function getRpmBuildPath(rpmArch) {
} }
function getRpmPackageArch(arch) { function getRpmPackageArch(arch) {
return { x64: 'x86_64', ia32: 'i386', arm: 'armhf' }[arch]; return { x64: 'x86_64', ia32: 'i386', arm: 'armhf', arm64: "arm64" }[arch];
} }
function prepareRpmPackage(arch) { function prepareRpmPackage(arch) {
...@@ -208,30 +208,39 @@ function buildSnapPackage(arch) { ...@@ -208,30 +208,39 @@ function buildSnapPackage(arch) {
gulp.task('clean-vscode-linux-ia32-deb', util.rimraf('.build/linux/deb/i386')); gulp.task('clean-vscode-linux-ia32-deb', util.rimraf('.build/linux/deb/i386'));
gulp.task('clean-vscode-linux-x64-deb', util.rimraf('.build/linux/deb/amd64')); gulp.task('clean-vscode-linux-x64-deb', util.rimraf('.build/linux/deb/amd64'));
gulp.task('clean-vscode-linux-arm-deb', util.rimraf('.build/linux/deb/armhf')); gulp.task('clean-vscode-linux-arm-deb', util.rimraf('.build/linux/deb/armhf'));
gulp.task('clean-vscode-linux-arm64-deb', util.rimraf('.build/linux/deb/arm64'));
gulp.task('clean-vscode-linux-ia32-rpm', util.rimraf('.build/linux/rpm/i386')); gulp.task('clean-vscode-linux-ia32-rpm', util.rimraf('.build/linux/rpm/i386'));
gulp.task('clean-vscode-linux-x64-rpm', util.rimraf('.build/linux/rpm/x86_64')); gulp.task('clean-vscode-linux-x64-rpm', util.rimraf('.build/linux/rpm/x86_64'));
gulp.task('clean-vscode-linux-arm-rpm', util.rimraf('.build/linux/rpm/armhf')); gulp.task('clean-vscode-linux-arm-rpm', util.rimraf('.build/linux/rpm/armhf'));
gulp.task('clean-vscode-linux-arm64-rpm', util.rimraf('.build/linux/rpm/arm64'));
gulp.task('clean-vscode-linux-ia32-snap', util.rimraf('.build/linux/snap/x64')); gulp.task('clean-vscode-linux-ia32-snap', util.rimraf('.build/linux/snap/x64'));
gulp.task('clean-vscode-linux-x64-snap', util.rimraf('.build/linux/snap/x64')); gulp.task('clean-vscode-linux-x64-snap', util.rimraf('.build/linux/snap/x64'));
gulp.task('clean-vscode-linux-arm-snap', util.rimraf('.build/linux/snap/x64')); gulp.task('clean-vscode-linux-arm-snap', util.rimraf('.build/linux/snap/x64'));
gulp.task('clean-vscode-linux-arm64-snap', util.rimraf('.build/linux/snap/x64'));
gulp.task('vscode-linux-ia32-prepare-deb', ['clean-vscode-linux-ia32-deb'], prepareDebPackage('ia32')); gulp.task('vscode-linux-ia32-prepare-deb', ['clean-vscode-linux-ia32-deb'], prepareDebPackage('ia32'));
gulp.task('vscode-linux-x64-prepare-deb', ['clean-vscode-linux-x64-deb'], prepareDebPackage('x64')); gulp.task('vscode-linux-x64-prepare-deb', ['clean-vscode-linux-x64-deb'], prepareDebPackage('x64'));
gulp.task('vscode-linux-arm-prepare-deb', ['clean-vscode-linux-arm-deb'], prepareDebPackage('arm')); gulp.task('vscode-linux-arm-prepare-deb', ['clean-vscode-linux-arm-deb'], prepareDebPackage('arm'));
gulp.task('vscode-linux-arm64-prepare-deb', ['clean-vscode-linux-arm64-deb'], prepareDebPackage('arm64'));
gulp.task('vscode-linux-ia32-build-deb', ['vscode-linux-ia32-prepare-deb'], buildDebPackage('ia32')); gulp.task('vscode-linux-ia32-build-deb', ['vscode-linux-ia32-prepare-deb'], buildDebPackage('ia32'));
gulp.task('vscode-linux-x64-build-deb', ['vscode-linux-x64-prepare-deb'], buildDebPackage('x64')); gulp.task('vscode-linux-x64-build-deb', ['vscode-linux-x64-prepare-deb'], buildDebPackage('x64'));
gulp.task('vscode-linux-arm-build-deb', ['vscode-linux-arm-prepare-deb'], buildDebPackage('arm')); gulp.task('vscode-linux-arm-build-deb', ['vscode-linux-arm-prepare-deb'], buildDebPackage('arm'));
gulp.task('vscode-linux-arm64-build-deb', ['vscode-linux-arm64-prepare-deb'], buildDebPackage('arm64'));
gulp.task('vscode-linux-ia32-prepare-rpm', ['clean-vscode-linux-ia32-rpm'], prepareRpmPackage('ia32')); gulp.task('vscode-linux-ia32-prepare-rpm', ['clean-vscode-linux-ia32-rpm'], prepareRpmPackage('ia32'));
gulp.task('vscode-linux-x64-prepare-rpm', ['clean-vscode-linux-x64-rpm'], prepareRpmPackage('x64')); gulp.task('vscode-linux-x64-prepare-rpm', ['clean-vscode-linux-x64-rpm'], prepareRpmPackage('x64'));
gulp.task('vscode-linux-arm-prepare-rpm', ['clean-vscode-linux-arm-rpm'], prepareRpmPackage('arm')); gulp.task('vscode-linux-arm-prepare-rpm', ['clean-vscode-linux-arm-rpm'], prepareRpmPackage('arm'));
gulp.task('vscode-linux-arm64-prepare-rpm', ['clean-vscode-linux-arm64-rpm'], prepareRpmPackage('arm64'));
gulp.task('vscode-linux-ia32-build-rpm', ['vscode-linux-ia32-prepare-rpm'], buildRpmPackage('ia32')); gulp.task('vscode-linux-ia32-build-rpm', ['vscode-linux-ia32-prepare-rpm'], buildRpmPackage('ia32'));
gulp.task('vscode-linux-x64-build-rpm', ['vscode-linux-x64-prepare-rpm'], buildRpmPackage('x64')); gulp.task('vscode-linux-x64-build-rpm', ['vscode-linux-x64-prepare-rpm'], buildRpmPackage('x64'));
gulp.task('vscode-linux-arm-build-rpm', ['vscode-linux-arm-prepare-rpm'], buildRpmPackage('arm')); gulp.task('vscode-linux-arm-build-rpm', ['vscode-linux-arm-prepare-rpm'], buildRpmPackage('arm'));
gulp.task('vscode-linux-arm64-build-rpm', ['vscode-linux-arm64-prepare-rpm'], buildRpmPackage('arm64'));
gulp.task('vscode-linux-ia32-prepare-snap', ['clean-vscode-linux-ia32-snap'], prepareSnapPackage('ia32')); gulp.task('vscode-linux-ia32-prepare-snap', ['clean-vscode-linux-ia32-snap'], prepareSnapPackage('ia32'));
gulp.task('vscode-linux-x64-prepare-snap', ['clean-vscode-linux-x64-snap'], prepareSnapPackage('x64')); gulp.task('vscode-linux-x64-prepare-snap', ['clean-vscode-linux-x64-snap'], prepareSnapPackage('x64'));
gulp.task('vscode-linux-arm-prepare-snap', ['clean-vscode-linux-arm-snap'], prepareSnapPackage('arm')); gulp.task('vscode-linux-arm-prepare-snap', ['clean-vscode-linux-arm-snap'], prepareSnapPackage('arm'));
gulp.task('vscode-linux-arm64-prepare-snap', ['clean-vscode-linux-arm64-snap'], prepareSnapPackage('arm64'));
gulp.task('vscode-linux-ia32-build-snap', ['vscode-linux-ia32-prepare-snap'], buildSnapPackage('ia32')); gulp.task('vscode-linux-ia32-build-snap', ['vscode-linux-ia32-prepare-snap'], buildSnapPackage('ia32'));
gulp.task('vscode-linux-x64-build-snap', ['vscode-linux-x64-prepare-snap'], buildSnapPackage('x64')); gulp.task('vscode-linux-x64-build-snap', ['vscode-linux-x64-prepare-snap'], buildSnapPackage('x64'));
gulp.task('vscode-linux-arm-build-snap', ['vscode-linux-arm-prepare-snap'], buildSnapPackage('arm')); gulp.task('vscode-linux-arm-build-snap', ['vscode-linux-arm-prepare-snap'], buildSnapPackage('arm'));
gulp.task('vscode-linux-arm64-build-snap', ['vscode-linux-arm64-prepare-snap'], buildSnapPackage('arm64'));
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><polygon points="5.382,13 2.382,7 6.618,7 7,7.764 9.382,3 13.618,3 8.618,13" fill="#F6F6F6"/><path d="M12 4l-4 8h-2l-2-4h2l1 2 3-6h2z" fill="#424242"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2 -2 16 16" enable-background="new -2 -2 16 16"><polygon fill="#424242" points="9,0 4.5,9 3,6 0,6 3,12 6,12 12,0"/></svg>
\ No newline at end of file \ No newline at end of file
...@@ -31,6 +31,7 @@ const jsTsLanguageConfiguration: vscode.LanguageConfiguration = { ...@@ -31,6 +31,7 @@ const jsTsLanguageConfiguration: vscode.LanguageConfiguration = {
}, { }, {
// e.g. * ...| // e.g. * ...|
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/, beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
action: { indentAction: vscode.IndentAction.None, appendText: '* ' } action: { indentAction: vscode.IndentAction.None, appendText: '* ' }
}, { }, {
// e.g. */| // e.g. */|
......
...@@ -125,9 +125,7 @@ export function setFullscreen(fullscreen: boolean): void { ...@@ -125,9 +125,7 @@ export function setFullscreen(fullscreen: boolean): void {
export function isFullscreen(): boolean { export function isFullscreen(): boolean {
return WindowManager.INSTANCE.isFullscreen(); return WindowManager.INSTANCE.isFullscreen();
} }
export function onDidChangeFullscreen(callback: () => void): IDisposable { export const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;
return WindowManager.INSTANCE.onDidChangeFullscreen(callback);
}
export function setAccessibilitySupport(accessibilitySupport: Platform.AccessibilitySupport): void { export function setAccessibilitySupport(accessibilitySupport: Platform.AccessibilitySupport): void {
WindowManager.INSTANCE.setAccessibilitySupport(accessibilitySupport); WindowManager.INSTANCE.setAccessibilitySupport(accessibilitySupport);
......
...@@ -1674,7 +1674,7 @@ export class TreeView extends HeightMap { ...@@ -1674,7 +1674,7 @@ export class TreeView extends HeightMap {
return candidate; return candidate;
} }
if (element === document.body) { if (element === this.scrollableElement.getDomNode() || element === document.body) {
return null; return null;
} }
} while (element = element.parentElement); } while (element = element.parentElement);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import { basename, dirname, join } from 'path'; import { basename, dirname, join } from 'path';
import { onUnexpectedError } from 'vs/base/common/errors'; import { onUnexpectedError } from 'vs/base/common/errors';
import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { readdir, rimraf, stat } from 'vs/base/node/pfs'; import { readdir, rimraf, stat } from 'vs/base/node/pfs';
import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import product from 'vs/platform/node/product'; import product from 'vs/platform/node/product';
...@@ -49,7 +48,7 @@ export class NodeCachedDataCleaner { ...@@ -49,7 +48,7 @@ export class NodeCachedDataCleaner {
readdir(nodeCachedDataRootDir).then(entries => { readdir(nodeCachedDataRootDir).then(entries => {
const now = Date.now(); const now = Date.now();
const deletes: TPromise<any>[] = []; const deletes: Thenable<any>[] = [];
entries.forEach(entry => { entries.forEach(entry => {
// name check // name check
...@@ -72,7 +71,7 @@ export class NodeCachedDataCleaner { ...@@ -72,7 +71,7 @@ export class NodeCachedDataCleaner {
} }
}); });
return TPromise.join(deletes); return Promise.all(deletes);
}).then(undefined, onUnexpectedError); }).then(undefined, onUnexpectedError);
......
...@@ -66,24 +66,31 @@ function showPartsSplash(configuration) { ...@@ -66,24 +66,31 @@ function showPartsSplash(configuration) {
// ignore // ignore
} }
// high contrast mode has been turned on, ignore stored colors and layouts // high contrast mode has been turned on from the outside, e.g OS -> ignore stored colors and layouts
if (data && configuration.highContrast && data.baseTheme !== 'hc-black') { if (data && configuration.highContrast && data.baseTheme !== 'hc-black') {
data = void 0; data = undefined;
} }
// developing an extension -> ignore stored layouts
if (data && configuration.extensionDevelopmentPath) {
data.layoutInfo = undefined;
}
// minimal color configuration (works with or without persisted data)
const baseTheme = data ? data.baseTheme : configuration.highContrast ? 'hc-black' : 'vs-dark';
const shellBackground = data ? data.colorInfo.editorBackground : configuration.highContrast ? '#000000' : '#1E1E1E';
const shellForeground = data ? data.colorInfo.foreground : configuration.highContrast ? '#FFFFFF' : '#CCCCCC';
const style = document.createElement('style'); const style = document.createElement('style');
document.head.appendChild(style); document.head.appendChild(style);
if (data) {
const { layoutInfo, colorInfo, baseTheme } = data;
// set the theme base id used by images and some styles
document.body.className = `monaco-shell ${baseTheme}`; document.body.className = `monaco-shell ${baseTheme}`;
// stylesheet that defines foreground and background color style.innerHTML = `.monaco-shell { background-color: ${shellBackground}; color: ${shellForeground}; }`;
style.innerHTML = `.monaco-shell { background-color: ${colorInfo.editorBackground}; color: ${colorInfo.foreground}; }`;
if (data && data.layoutInfo) {
// restore parts if possible (we might not always store layout info)
const { id, layoutInfo, colorInfo } = data;
const splash = document.createElement('div'); const splash = document.createElement('div');
splash.id = data.id; splash.id = id;
// ensure there is enough space // ensure there is enough space
layoutInfo.sideBarWidth = Math.min(layoutInfo.sideBarWidth, window.innerWidth - (layoutInfo.activityBarWidth + layoutInfo.editorPartMinWidth)); layoutInfo.sideBarWidth = Math.min(layoutInfo.sideBarWidth, window.innerWidth - (layoutInfo.activityBarWidth + layoutInfo.editorPartMinWidth));
...@@ -105,9 +112,6 @@ function showPartsSplash(configuration) { ...@@ -105,9 +112,6 @@ function showPartsSplash(configuration) {
`; `;
} }
document.body.appendChild(splash); document.body.appendChild(splash);
} else {
document.body.className = `monaco-shell ${configuration.highContrast ? 'hc-black' : 'vs-dark'}`;
style.innerHTML = `.monaco-shell { background-color: ${configuration.highContrast ? '#000000' : '#1E1E1E'}; color: ${configuration.highContrast ? '#FFFFFF' : '#CCCCCC'}; }`;
} }
perf.mark('didShowPartsSplash'); perf.mark('didShowPartsSplash');
......
...@@ -146,6 +146,10 @@ export interface OnEnterRule { ...@@ -146,6 +146,10 @@ export interface OnEnterRule {
* This rule will only execute if the text after the cursor matches this regular expression. * This rule will only execute if the text after the cursor matches this regular expression.
*/ */
afterText?: RegExp; afterText?: RegExp;
/**
* This rule will only execute if the text above the this line matches this regular expression.
*/
oneLineAboveText?: RegExp;
/** /**
* The action to execute. * The action to execute.
*/ */
......
...@@ -48,16 +48,24 @@ export class OnEnterSupport { ...@@ -48,16 +48,24 @@ export class OnEnterSupport {
// (1): `regExpRules` // (1): `regExpRules`
for (let i = 0, len = this._regExpRules.length; i < len; i++) { for (let i = 0, len = this._regExpRules.length; i < len; i++) {
let rule = this._regExpRules[i]; let rule = this._regExpRules[i];
if (rule.beforeText.test(beforeEnterText)) { const regResult = [{
if (rule.afterText) { reg: rule.beforeText,
if (rule.afterText.test(afterEnterText)) { text: beforeEnterText
return rule.action; }, {
} reg: rule.afterText,
} else { text: afterEnterText
}, {
reg: rule.oneLineAboveText,
text: oneLineAboveText
}].every((obj): boolean => {
return obj.reg ? obj.reg.test(obj.text) : true;
});
if (regResult) {
return rule.action; return rule.action;
} }
} }
}
// (2): Special indent-outdent // (2): Special indent-outdent
if (beforeEnterText.length > 0 && afterEnterText.length > 0) { if (beforeEnterText.length > 0 && afterEnterText.length > 0) {
......
...@@ -9,12 +9,12 @@ import { URI } from 'vs/base/common/uri'; ...@@ -9,12 +9,12 @@ import { URI } from 'vs/base/common/uri';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { Position } from 'vs/editor/common/core/position'; import { Position } from 'vs/editor/common/core/position';
import { LanguageIdentifier } from 'vs/editor/common/modes'; import { LanguageIdentifier } from 'vs/editor/common/modes';
import { IndentAction } from 'vs/editor/common/modes/languageConfiguration';
import { TokenSelectionSupport } from 'vs/editor/contrib/smartSelect/tokenSelectionSupport'; import { TokenSelectionSupport } from 'vs/editor/contrib/smartSelect/tokenSelectionSupport';
import { MockMode } from 'vs/editor/test/common/mocks/mockMode'; import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl'; import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
class MockJSMode extends MockMode { class MockJSMode extends MockMode {
...@@ -30,34 +30,7 @@ class MockJSMode extends MockMode { ...@@ -30,34 +30,7 @@ class MockJSMode extends MockMode {
['[', ']'] ['[', ']']
], ],
onEnterRules: [ onEnterRules: javascriptOnEnterRules
{
// e.g. /** | */
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
},
{
// e.g. /** ...|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: { indentAction: IndentAction.None, appendText: ' * ' }
},
{
// e.g. * ...|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
action: { indentAction: IndentAction.None, appendText: '* ' }
},
{
// e.g. */|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
},
{
// e.g. *-----*/|
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
}
]
})); }));
} }
} }
......
...@@ -9,12 +9,12 @@ import { ShiftCommand } from 'vs/editor/common/commands/shiftCommand'; ...@@ -9,12 +9,12 @@ import { ShiftCommand } from 'vs/editor/common/commands/shiftCommand';
import { Selection } from 'vs/editor/common/core/selection'; import { Selection } from 'vs/editor/common/core/selection';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model'; import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
import { IndentAction } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { getEditOperation, testCommand } from 'vs/editor/test/browser/testCommand'; import { getEditOperation, testCommand } from 'vs/editor/test/browser/testCommand';
import { withEditorModel } from 'vs/editor/test/common/editorTestUtils'; import { withEditorModel } from 'vs/editor/test/common/editorTestUtils';
import { MockMode } from 'vs/editor/test/common/mocks/mockMode'; import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
import { LanguageIdentifier } from 'vs/editor/common/modes'; import { LanguageIdentifier } from 'vs/editor/common/modes';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
/** /**
* Create single edit operation * Create single edit operation
...@@ -39,34 +39,7 @@ class DocBlockCommentMode extends MockMode { ...@@ -39,34 +39,7 @@ class DocBlockCommentMode extends MockMode {
['[', ']'] ['[', ']']
], ],
onEnterRules: [ onEnterRules: javascriptOnEnterRules
{
// e.g. /** | */
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
},
{
// e.g. /** ...|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: { indentAction: IndentAction.None, appendText: ' * ' }
},
{
// e.g. * ...|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
action: { indentAction: IndentAction.None, appendText: '* ' }
},
{
// e.g. */|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
},
{
// e.g. *-----*/|
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
}
]
})); }));
} }
} }
......
...@@ -25,6 +25,7 @@ import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl'; ...@@ -25,6 +25,7 @@ import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode'; import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { TokenizationResult2 } from 'vs/editor/common/core/token'; import { TokenizationResult2 } from 'vs/editor/common/core/token';
import { createTextModel, IRelaxedTextModelCreationOptions } from 'vs/editor/test/common/editorTestUtils'; import { createTextModel, IRelaxedTextModelCreationOptions } from 'vs/editor/test/common/editorTestUtils';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
const H = Handler; const H = Handler;
...@@ -3517,31 +3518,7 @@ suite('Editor Controller - Indentation Rules', () => { ...@@ -3517,31 +3518,7 @@ suite('Editor Controller - Indentation Rules', () => {
// ^.*\{[^}"']*$ // ^.*\{[^}"']*$
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/ increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/
}, },
onEnterRules: [ onEnterRules: javascriptOnEnterRules
{
// e.g. /** | */
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
}, {
// e.g. /** ...|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: { indentAction: IndentAction.None, appendText: ' * ' }
}, {
// e.g. * ...|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
action: { indentAction: IndentAction.None, appendText: '* ' }
}, {
// e.g. */|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
},
{
// e.g. *-----*/|
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
}
]
})); }));
} }
} }
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IndentAction } from 'vs/editor/common/modes/languageConfiguration';
export const javascriptOnEnterRules = [
{
// e.g. /** | */
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
}, {
// e.g. /** ...|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: { indentAction: IndentAction.None, appendText: ' * ' }
}, {
// e.g. * ...|
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
action: { indentAction: IndentAction.None, appendText: '* ' }
}, {
// e.g. */|
beforeText: /^(\t|[ ])*[ ]\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
},
{
// e.g. *-----*/|
beforeText: /^(\t|[ ])*[ ]\*[^/]*\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
}
];
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
import * as assert from 'assert'; import * as assert from 'assert';
import { CharacterPair, IndentAction } from 'vs/editor/common/modes/languageConfiguration'; import { CharacterPair, IndentAction } from 'vs/editor/common/modes/languageConfiguration';
import { OnEnterSupport } from 'vs/editor/common/modes/supports/onEnter'; import { OnEnterSupport } from 'vs/editor/common/modes/supports/onEnter';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
suite('OnEnter', () => { suite('OnEnter', () => {
...@@ -49,32 +50,10 @@ suite('OnEnter', () => { ...@@ -49,32 +50,10 @@ suite('OnEnter', () => {
test('uses regExpRules', () => { test('uses regExpRules', () => {
let support = new OnEnterSupport({ let support = new OnEnterSupport({
regExpRules: [ regExpRules: javascriptOnEnterRules
{
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
},
{
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: { indentAction: IndentAction.None, appendText: ' * ' }
},
{
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
action: { indentAction: IndentAction.None, appendText: '* ' }
},
{
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
},
{
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
}
]
}); });
let testIndentAction = (beforeText: string, afterText: string, expectedIndentAction: IndentAction, expectedAppendText: string, removeText: number = 0) => { let testIndentAction = (oneLineAboveText: string, beforeText: string, afterText: string, expectedIndentAction: IndentAction, expectedAppendText: string, removeText: number = 0) => {
let actual = support.onEnter('', beforeText, afterText); let actual = support.onEnter(oneLineAboveText, beforeText, afterText);
if (expectedIndentAction === null) { if (expectedIndentAction === null) {
assert.equal(actual, null, 'isNull:' + beforeText); assert.equal(actual, null, 'isNull:' + beforeText);
} else { } else {
...@@ -89,40 +68,70 @@ suite('OnEnter', () => { ...@@ -89,40 +68,70 @@ suite('OnEnter', () => {
} }
}; };
testIndentAction('\t/**', ' */', IndentAction.IndentOutdent, ' * '); testIndentAction('', '\t/**', ' */', IndentAction.IndentOutdent, ' * ');
testIndentAction('\t/**', '', IndentAction.None, ' * '); testIndentAction('', '\t/**', '', IndentAction.None, ' * ');
testIndentAction('\t/** * / * / * /', '', IndentAction.None, ' * '); testIndentAction('', '\t/** * / * / * /', '', IndentAction.None, ' * ');
testIndentAction('\t/** /*', '', IndentAction.None, ' * '); testIndentAction('', '\t/** /*', '', IndentAction.None, ' * ');
testIndentAction('/**', '', IndentAction.None, ' * '); testIndentAction('', '/**', '', IndentAction.None, ' * ');
testIndentAction('\t/**/', '', null, null); testIndentAction('', '\t/**/', '', null, null);
testIndentAction('\t/***/', '', null, null); testIndentAction('', '\t/***/', '', null, null);
testIndentAction('\t/*******/', '', null, null); testIndentAction('', '\t/*******/', '', null, null);
testIndentAction('\t/** * * * * */', '', null, null); testIndentAction('', '\t/** * * * * */', '', null, null);
testIndentAction('\t/** */', '', null, null); testIndentAction('', '\t/** */', '', null, null);
testIndentAction('\t/** asdfg */', '', null, null); testIndentAction('', '\t/** asdfg */', '', null, null);
testIndentAction('\t/* asdfg */', '', null, null); testIndentAction('', '\t/* asdfg */', '', null, null);
testIndentAction('\t/* asdfg */', '', null, null); testIndentAction('', '\t/* asdfg */', '', null, null);
testIndentAction('\t/** asdfg */', '', null, null); testIndentAction('', '\t/** asdfg */', '', null, null);
testIndentAction('*/', '', null, null); testIndentAction('', '*/', '', null, null);
testIndentAction('\t/*', '', null, null); testIndentAction('', '\t/*', '', null, null);
testIndentAction('\t*', '', null, null); testIndentAction('', '\t*', '', null, null);
testIndentAction('\t *', '', IndentAction.None, '* ');
testIndentAction('\t */', '', IndentAction.None, null, 1); testIndentAction('\t/**', '\t *', '', IndentAction.None, '* ');
testIndentAction('\t * */', '', IndentAction.None, null, 1); testIndentAction('\t * something', '\t *', '', IndentAction.None, '* ');
testIndentAction('\t * * / * / * / */', '', null, null); testIndentAction('\t *', '\t *', '', IndentAction.None, '* ');
testIndentAction('\t * ', '', IndentAction.None, '* ');
testIndentAction(' * ', '', IndentAction.None, '* '); testIndentAction('', '\t */', '', IndentAction.None, null, 1);
testIndentAction(' * asdfsfagadfg', '', IndentAction.None, '* '); testIndentAction('', '\t * */', '', IndentAction.None, null, 1);
testIndentAction(' * asdfsfagadfg * * * ', '', IndentAction.None, '* '); testIndentAction('', '\t * * / * / * / */', '', null, null);
testIndentAction(' * /*', '', IndentAction.None, '* ');
testIndentAction(' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* '); testIndentAction('\t/**', '\t * ', '', IndentAction.None, '* ');
testIndentAction(' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* '); testIndentAction('\t * something', '\t * ', '', IndentAction.None, '* ');
testIndentAction(' */', '', IndentAction.None, null, 1); testIndentAction('\t *', '\t * ', '', IndentAction.None, '* ');
testIndentAction('\t */', '', IndentAction.None, null, 1);
testIndentAction('\t\t */', '', IndentAction.None, null, 1); testIndentAction('/**', ' * ', '', IndentAction.None, '* ');
testIndentAction(' */', '', IndentAction.None, null, 1); testIndentAction(' * something', ' * ', '', IndentAction.None, '* ');
testIndentAction(' */', '', IndentAction.None, null, 1); testIndentAction(' *', ' * asdfsfagadfg', '', IndentAction.None, '* ');
testIndentAction('\t */', '', IndentAction.None, null, 1);
testIndentAction(' *--------------------------------------------------------------------------------------------*/', '', IndentAction.None, null, 1); testIndentAction('/**', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
testIndentAction(' * something', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
testIndentAction(' *', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
testIndentAction('/**', ' * /*', '', IndentAction.None, '* ');
testIndentAction(' * something', ' * /*', '', IndentAction.None, '* ');
testIndentAction(' *', ' * /*', '', IndentAction.None, '* ');
testIndentAction('/**', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
testIndentAction(' * something', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
testIndentAction(' *', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
testIndentAction('/**', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
testIndentAction(' * something', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
testIndentAction('', ' */', '', IndentAction.None, null, 1);
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
testIndentAction('', ' */', '', IndentAction.None, null, 1);
testIndentAction('', ' */', '', IndentAction.None, null, 1);
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
testIndentAction('', ' *--------------------------------------------------------------------------------------------*/', '', IndentAction.None, null, 1);
// issue #43469
testIndentAction('class A {', ' * test() {', '', IndentAction.Indent, null, 0);
testIndentAction('', ' * test() {', '', IndentAction.Indent, null, 0);
testIndentAction(' ', ' * test() {', '', IndentAction.Indent, null, 0);
testIndentAction('class A {', ' * test() {', '', IndentAction.Indent, null, 0);
testIndentAction('', ' * test() {', '', IndentAction.Indent, null, 0);
testIndentAction(' ', ' * test() {', '', IndentAction.Indent, null, 0);
}); });
}); });
\ No newline at end of file
...@@ -4670,6 +4670,10 @@ declare namespace monaco.languages { ...@@ -4670,6 +4670,10 @@ declare namespace monaco.languages {
* This rule will only execute if the text after the cursor matches this regular expression. * This rule will only execute if the text after the cursor matches this regular expression.
*/ */
afterText?: RegExp; afterText?: RegExp;
/**
* This rule will only execute if the text above the this line matches this regular expression.
*/
oneLineAboveText?: RegExp;
/** /**
* The action to execute. * The action to execute.
*/ */
......
...@@ -120,7 +120,7 @@ export class HistoryMainService implements IHistoryMainService { ...@@ -120,7 +120,7 @@ export class HistoryMainService implements IHistoryMainService {
const mru = this.getRecentlyOpened(); const mru = this.getRecentlyOpened();
let update = false; let update = false;
pathsToRemove.forEach((pathToRemove => { pathsToRemove.forEach(pathToRemove => {
// Remove workspace // Remove workspace
let index = arrays.firstIndex(mru.workspaces, workspace => { let index = arrays.firstIndex(mru.workspaces, workspace => {
...@@ -132,7 +132,7 @@ export class HistoryMainService implements IHistoryMainService { ...@@ -132,7 +132,7 @@ export class HistoryMainService implements IHistoryMainService {
} }
if (typeof pathToRemove === 'string') { if (typeof pathToRemove === 'string') {
if (isSingleFolderWorkspaceIdentifier(workspace)) { if (isSingleFolderWorkspaceIdentifier(workspace)) {
return workspace.scheme === Schemas.file && areResourcesEqual(URI.file(pathToRemove), workspace); return workspace.scheme === Schemas.file && isEqual(pathToRemove, workspace.fsPath, !isLinux /* ignorecase */);
} }
if (isWorkspaceIdentifier(workspace)) { if (isWorkspaceIdentifier(workspace)) {
return isEqual(pathToRemove, workspace.configPath, !isLinux /* ignorecase */); return isEqual(pathToRemove, workspace.configPath, !isLinux /* ignorecase */);
...@@ -146,15 +146,20 @@ export class HistoryMainService implements IHistoryMainService { ...@@ -146,15 +146,20 @@ export class HistoryMainService implements IHistoryMainService {
} }
// Remove file // Remove file
const pathToRemoveURI = pathToRemove instanceof URI ? pathToRemove : typeof pathToRemove === 'string' ? URI.file(pathToRemove) : null; index = arrays.firstIndex(mru.files, file => {
if (pathToRemoveURI) { if (pathToRemove instanceof URI) {
index = arrays.firstIndex(mru.files, file => areResourcesEqual(file, pathToRemoveURI)); return areResourcesEqual(file, pathToRemove);
} else if (typeof pathToRemove === 'string') {
return isEqual(file.fsPath, pathToRemove, !isLinux /* ignorecase */);
} }
return false;
});
if (index >= 0) { if (index >= 0) {
mru.files.splice(index, 1); mru.files.splice(index, 1);
update = true; update = true;
} }
})); });
if (update) { if (update) {
this.saveRecentlyOpened(mru); this.saveRecentlyOpened(mru);
......
...@@ -157,7 +157,7 @@ export class InstantiationService implements IInstantiationService { ...@@ -157,7 +157,7 @@ export class InstantiationService implements IInstantiationService {
for (let dependency of dependencies) { for (let dependency of dependencies) {
let instanceOrDesc = this._services.get(dependency.id); let instanceOrDesc = this._services.get(dependency.id);
if (!instanceOrDesc) { if (!instanceOrDesc && !dependency.optional) {
console.warn(`[createInstance] ${id} depends on ${dependency.id} which is NOT registered.`); console.warn(`[createInstance] ${id} depends on ${dependency.id} which is NOT registered.`);
} }
......
...@@ -3738,6 +3738,10 @@ declare module 'vscode' { ...@@ -3738,6 +3738,10 @@ declare module 'vscode' {
* This rule will only execute if the text after the cursor matches this regular expression. * This rule will only execute if the text after the cursor matches this regular expression.
*/ */
afterText?: RegExp; afterText?: RegExp;
/**
* This rule will only execute if the text above the this line matches this regular expression.
*/
oneLineAboveText?: RegExp;
/** /**
* The action to execute. * The action to execute.
*/ */
......
...@@ -402,6 +402,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha ...@@ -402,6 +402,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
return { return {
beforeText: MainThreadLanguageFeatures._reviveRegExp(onEnterRule.beforeText), beforeText: MainThreadLanguageFeatures._reviveRegExp(onEnterRule.beforeText),
afterText: MainThreadLanguageFeatures._reviveRegExp(onEnterRule.afterText), afterText: MainThreadLanguageFeatures._reviveRegExp(onEnterRule.afterText),
oneLineAboveText: MainThreadLanguageFeatures._reviveRegExp(onEnterRule.oneLineAboveText),
action: onEnterRule.action action: onEnterRule.action
}; };
} }
......
...@@ -226,6 +226,7 @@ export interface ISerializedIndentationRule { ...@@ -226,6 +226,7 @@ export interface ISerializedIndentationRule {
export interface ISerializedOnEnterRule { export interface ISerializedOnEnterRule {
beforeText: ISerializedRegExp; beforeText: ISerializedRegExp;
afterText?: ISerializedRegExp; afterText?: ISerializedRegExp;
oneLineAboveText?: ISerializedRegExp;
action: EnterAction; action: EnterAction;
} }
export interface ISerializedLanguageConfiguration { export interface ISerializedLanguageConfiguration {
......
...@@ -1232,6 +1232,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape { ...@@ -1232,6 +1232,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return { return {
beforeText: ExtHostLanguageFeatures._serializeRegExp(onEnterRule.beforeText), beforeText: ExtHostLanguageFeatures._serializeRegExp(onEnterRule.beforeText),
afterText: ExtHostLanguageFeatures._serializeRegExp(onEnterRule.afterText), afterText: ExtHostLanguageFeatures._serializeRegExp(onEnterRule.afterText),
oneLineAboveText: ExtHostLanguageFeatures._serializeRegExp(onEnterRule.oneLineAboveText),
action: onEnterRule.action action: onEnterRule.action
}; };
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
'use strict'; 'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { IWindowService } from 'vs/platform/windows/common/windows'; import { IWindowService } from 'vs/platform/windows/common/windows';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
...@@ -25,7 +24,6 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; ...@@ -25,7 +24,6 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { forEach } from 'vs/base/common/collections'; import { forEach } from 'vs/base/common/collections';
import { mergeSort } from 'vs/base/common/arrays'; import { mergeSort } from 'vs/base/common/arrays';
class Info { class Info {
static getTimerInfo(metrics: IStartupMetrics, nodeModuleLoadTime?: number): { [name: string]: Info } { static getTimerInfo(metrics: IStartupMetrics, nodeModuleLoadTime?: number): { [name: string]: Info } {
...@@ -158,7 +156,7 @@ export class ShowStartupPerformance extends Action { ...@@ -158,7 +156,7 @@ export class ShowStartupPerformance extends Action {
super(id, label); super(id, label);
} }
run(): TPromise<boolean> { run(): Promise<boolean> {
// Show dev tools // Show dev tools
this.windowService.openDevTools(); this.windowService.openDevTools();
...@@ -217,7 +215,7 @@ export class ShowStartupPerformance extends Action { ...@@ -217,7 +215,7 @@ export class ShowStartupPerformance extends Action {
console.groupEnd(); console.groupEnd();
}); });
return TPromise.as(true); return Promise.resolve(true);
} }
} }
...@@ -238,7 +236,7 @@ export class ReportPerformanceIssueAction extends Action { ...@@ -238,7 +236,7 @@ export class ReportPerformanceIssueAction extends Action {
super(id, label); super(id, label);
} }
run(appendix?: string): TPromise<boolean> { run(appendix?: string): Promise<boolean> {
Promise.all([ Promise.all([
this.timerService.startupMetrics, this.timerService.startupMetrics,
this.integrityService.isPure() this.integrityService.isPure()
...@@ -248,7 +246,7 @@ export class ReportPerformanceIssueAction extends Action { ...@@ -248,7 +246,7 @@ export class ReportPerformanceIssueAction extends Action {
window.open(issueUrl); window.open(issueUrl);
}); });
return TPromise.wrap(true); return Promise.resolve(true);
} }
private generatePerformanceIssueUrl(metrics: IStartupMetrics, baseUrl: string, name: string, version: string, _commit: string, _date: string, isPure: boolean, appendix?: string): string { private generatePerformanceIssueUrl(metrics: IStartupMetrics, baseUrl: string, name: string, version: string, _commit: string, _date: string, isPure: boolean, appendix?: string): string {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import { dirname, join } from 'path'; import { dirname, join } from 'path';
import { basename } from 'vs/base/common/paths'; import { basename } from 'vs/base/common/paths';
import { TPromise } from 'vs/base/common/winjs.base';
import { del, exists, readdir, readFile } from 'vs/base/node/pfs'; import { del, exists, readdir, readFile } from 'vs/base/node/pfs';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
...@@ -80,7 +79,7 @@ class StartupProfiler implements IWorkbenchContribution { ...@@ -80,7 +79,7 @@ class StartupProfiler implements IWorkbenchContribution {
}).then(res => { }).then(res => {
if (res.confirmed) { if (res.confirmed) {
const action = this._instantiationService.createInstance(ReportPerformanceIssueAction, ReportPerformanceIssueAction.ID, ReportPerformanceIssueAction.LABEL); const action = this._instantiationService.createInstance(ReportPerformanceIssueAction, ReportPerformanceIssueAction.ID, ReportPerformanceIssueAction.LABEL);
TPromise.join<any>([ Promise.all<any>([
this._windowsService.showItemInFolder(join(dir, files[0])), this._windowsService.showItemInFolder(join(dir, files[0])),
action.run(`:warning: Make sure to **attach** these files from your *home*-directory: :warning:\n${files.map(file => `-\`${file}\``).join('\n')}`) action.run(`:warning: Make sure to **attach** these files from your *home*-directory: :warning:\n${files.map(file => `-\`${file}\``).join('\n')}`)
]).then(() => { ]).then(() => {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
'use strict'; 'use strict';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions';
import { IModeService } from 'vs/editor/common/services/modeService'; import { IModeService } from 'vs/editor/common/services/modeService';
import { LanguageId } from 'vs/editor/common/modes'; import { LanguageId } from 'vs/editor/common/modes';
...@@ -63,7 +62,7 @@ class InsertSnippetAction extends EditorAction { ...@@ -63,7 +62,7 @@ class InsertSnippetAction extends EditorAction {
}); });
} }
public run(accessor: ServicesAccessor, editor: ICodeEditor, arg: any): TPromise<void> { public run(accessor: ServicesAccessor, editor: ICodeEditor, arg: any): Promise<void> {
const modeService = accessor.get(IModeService); const modeService = accessor.get(IModeService);
const snippetService = accessor.get(ISnippetsService); const snippetService = accessor.get(ISnippetsService);
...@@ -75,7 +74,7 @@ class InsertSnippetAction extends EditorAction { ...@@ -75,7 +74,7 @@ class InsertSnippetAction extends EditorAction {
const { lineNumber, column } = editor.getPosition(); const { lineNumber, column } = editor.getPosition();
let { snippet, name, langId } = Args.fromUser(arg); let { snippet, name, langId } = Args.fromUser(arg);
return new TPromise<Snippet>(async (resolve, reject) => { return new Promise<Snippet>(async (resolve, reject) => {
if (snippet) { if (snippet) {
return resolve(new Snippet( return resolve(new Snippet(
......
...@@ -5,20 +5,22 @@ ...@@ -5,20 +5,22 @@
'use strict'; 'use strict';
import { onDidChangeFullscreen, isFullscreen } from 'vs/base/browser/browser';
import { getTotalHeight, getTotalWidth } from 'vs/base/browser/dom'; import { getTotalHeight, getTotalWidth } from 'vs/base/browser/dom';
import { Color } from 'vs/base/common/color';
import { anyEvent, debounceEvent } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IBroadcastService } from 'vs/platform/broadcast/electron-browser/broadcastService';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IThemeService, getThemeTypeSelector } from 'vs/platform/theme/common/themeService'; import { ColorIdentifier, editorBackground, foreground } from 'vs/platform/theme/common/colorRegistry';
import { IBroadcastService } from 'vs/platform/broadcast/electron-browser/broadcastService'; import { getThemeTypeSelector, IThemeService } from 'vs/platform/theme/common/themeService';
import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import * as themes from 'vs/workbench/common/theme'; import * as themes from 'vs/workbench/common/theme';
import { IPartService, Parts, Position } from 'vs/workbench/services/part/common/partService'; import { IPartService, Parts, Position } from 'vs/workbench/services/part/common/partService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { debounceEvent } from 'vs/base/common/event';
import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
import { ColorIdentifier, editorBackground, foreground } from 'vs/platform/theme/common/colorRegistry';
import { Color } from 'vs/base/common/color';
class PartsSplash { class PartsSplash {
...@@ -26,18 +28,22 @@ class PartsSplash { ...@@ -26,18 +28,22 @@ class PartsSplash {
private readonly _disposables: IDisposable[] = []; private readonly _disposables: IDisposable[] = [];
private lastBaseTheme: string; private _lastBaseTheme: string;
private lastBackground: string; private _lastBackground: string;
constructor( constructor(
@IThemeService private readonly _themeService: IThemeService, @IThemeService private readonly _themeService: IThemeService,
@IPartService private readonly _partService: IPartService, @IPartService private readonly _partService: IPartService,
@IStorageService private readonly _storageService: IStorageService, @IStorageService private readonly _storageService: IStorageService,
@IEnvironmentService private readonly _envService: IEnvironmentService,
@ILifecycleService lifecycleService: ILifecycleService, @ILifecycleService lifecycleService: ILifecycleService,
@IBroadcastService private broadcastService: IBroadcastService @IBroadcastService private broadcastService: IBroadcastService
) { ) {
lifecycleService.when(LifecyclePhase.Running).then(_ => this._removePartsSplash()); lifecycleService.when(LifecyclePhase.Running).then(_ => this._removePartsSplash());
debounceEvent(_partService.onEditorLayout, () => { }, 50)(this._savePartsSplash, this, this._disposables); debounceEvent(anyEvent<any>(
onDidChangeFullscreen,
_partService.onEditorLayout
), () => { }, 150)(this._savePartsSplash, this, this._disposables);
} }
dispose(): void { dispose(): void {
...@@ -55,7 +61,7 @@ class PartsSplash { ...@@ -55,7 +61,7 @@ class PartsSplash {
statusBarBackground: this._getThemeColor(themes.STATUS_BAR_BACKGROUND), statusBarBackground: this._getThemeColor(themes.STATUS_BAR_BACKGROUND),
statusBarNoFolderBackground: this._getThemeColor(themes.STATUS_BAR_NO_FOLDER_BACKGROUND), statusBarNoFolderBackground: this._getThemeColor(themes.STATUS_BAR_NO_FOLDER_BACKGROUND),
}; };
const layoutInfo = { const layoutInfo = !this._shouldSaveLayoutInfo() ? undefined : {
sideBarSide: this._partService.getSideBarPosition() === Position.RIGHT ? 'right' : 'left', sideBarSide: this._partService.getSideBarPosition() === Position.RIGHT ? 'right' : 'left',
editorPartMinWidth: DEFAULT_EDITOR_MIN_DIMENSIONS.width, editorPartMinWidth: DEFAULT_EDITOR_MIN_DIMENSIONS.width,
titleBarHeight: getTotalHeight(this._partService.getContainer(Parts.TITLEBAR_PART)), titleBarHeight: getTotalHeight(this._partService.getContainer(Parts.TITLEBAR_PART)),
...@@ -63,12 +69,17 @@ class PartsSplash { ...@@ -63,12 +69,17 @@ class PartsSplash {
sideBarWidth: getTotalWidth(this._partService.getContainer(Parts.SIDEBAR_PART)), sideBarWidth: getTotalWidth(this._partService.getContainer(Parts.SIDEBAR_PART)),
statusBarHeight: getTotalHeight(this._partService.getContainer(Parts.STATUSBAR_PART)), statusBarHeight: getTotalHeight(this._partService.getContainer(Parts.STATUSBAR_PART)),
}; };
this._storageService.store('parts-splash-data', JSON.stringify({ id: PartsSplash._splashElementId, colorInfo, layoutInfo, baseTheme }), StorageScope.GLOBAL); this._storageService.store('parts-splash-data', JSON.stringify({
id: PartsSplash._splashElementId,
colorInfo,
layoutInfo,
baseTheme
}), StorageScope.GLOBAL);
if (baseTheme !== this.lastBaseTheme || colorInfo.editorBackground !== this.lastBackground) { if (baseTheme !== this._lastBaseTheme || colorInfo.editorBackground !== this._lastBackground) {
// notify the main window on background color changes: the main window sets the background color to new windows // notify the main window on background color changes: the main window sets the background color to new windows
this.lastBaseTheme = baseTheme; this._lastBaseTheme = baseTheme;
this.lastBackground = colorInfo.editorBackground; this._lastBackground = colorInfo.editorBackground;
// the color needs to be in hex // the color needs to be in hex
const backgroundColor = this._themeService.getTheme().getColor(editorBackground) || themes.WORKBENCH_BACKGROUND(this._themeService.getTheme()); const backgroundColor = this._themeService.getTheme().getColor(editorBackground) || themes.WORKBENCH_BACKGROUND(this._themeService.getTheme());
...@@ -82,6 +93,10 @@ class PartsSplash { ...@@ -82,6 +93,10 @@ class PartsSplash {
return color ? color.toString() : undefined; return color ? color.toString() : undefined;
} }
private _shouldSaveLayoutInfo(): boolean {
return !isFullscreen() && !this._envService.isExtensionDevelopment;
}
private _removePartsSplash(): void { private _removePartsSplash(): void {
let element = document.getElementById(PartsSplash._splashElementId); let element = document.getElementById(PartsSplash._splashElementId);
if (element) { if (element) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册