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

Merge branch 'master' into grid

......@@ -104,7 +104,7 @@ const copyrightFilter = [
'!build/**/*.init',
'!resources/linux/snap/snapcraft.yaml',
'!resources/win32/bin/code.js',
'!extensions/markdown-language-features/media/tomorrow.css',
'!extensions/markdown-language-features/media/highlight.css',
'!extensions/html-language-features/server/src/modes/typescript/*',
'!extensions/*/server/bin/*'
];
......
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
var Lint = require("tslint");
var path_1 = require("path");
var Rule = /** @class */ (function (_super) {
__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
if (/vs(\/|\\)editor/.test(sourceFile.fileName)) {
// the vs/editor folder is allowed to use the standalone editor
return [];
}
return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
};
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
var NoStandaloneEditorRuleWalker = /** @class */ (function (_super) {
__extends(NoStandaloneEditorRuleWalker, _super);
function NoStandaloneEditorRuleWalker(file, opts) {
return _super.call(this, file, opts) || this;
}
NoStandaloneEditorRuleWalker.prototype.visitImportEqualsDeclaration = function (node) {
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
this._validateImport(node.moduleReference.expression.getText(), node);
}
};
NoStandaloneEditorRuleWalker.prototype.visitImportDeclaration = function (node) {
this._validateImport(node.moduleSpecifier.getText(), node);
};
NoStandaloneEditorRuleWalker.prototype.visitCallExpression = function (node) {
_super.prototype.visitCallExpression.call(this, node);
// import('foo') statements inside the code
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
var path = node.arguments[0];
this._validateImport(path.getText(), node);
}
};
NoStandaloneEditorRuleWalker.prototype._validateImport = function (path, node) {
// remove quotes
path = path.slice(1, -1);
// resolve relative paths
if (path[0] === '.') {
path = path_1.join(this.getSourceFile().fileName, path);
}
if (/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization"));
}
};
return NoStandaloneEditorRuleWalker;
}(Lint.RuleWalker));
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as ts from 'typescript';
import * as Lint from 'tslint';
import { join } from 'path';
export class Rule extends Lint.Rules.AbstractRule {
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
if (/vs(\/|\\)editor/.test(sourceFile.fileName)) {
// the vs/editor folder is allowed to use the standalone editor
return [];
}
return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
}
}
class NoStandaloneEditorRuleWalker extends Lint.RuleWalker {
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
super(file, opts);
}
protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void {
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
this._validateImport(node.moduleReference.expression.getText(), node);
}
}
protected visitImportDeclaration(node: ts.ImportDeclaration): void {
this._validateImport(node.moduleSpecifier.getText(), node);
}
protected visitCallExpression(node: ts.CallExpression): void {
super.visitCallExpression(node);
// import('foo') statements inside the code
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
const [path] = node.arguments;
this._validateImport(path.getText(), node);
}
}
private _validateImport(path: string, node: ts.Node): void {
// remove quotes
path = path.slice(1, -1);
// resolve relative paths
if (path[0] === '.') {
path = join(this.getSourceFile().fileName, path);
}
if (
/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)
) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`));
}
}
}
......@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/925295380addea5b27f419a423c708f421347c5c",
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/2904dae001939996c6a3484eac1b95716797ac41",
"name": "C#",
"scopeName": "source.cs",
"patterns": [
......@@ -3588,7 +3588,7 @@
]
},
"lambda-parameter": {
"match": "(?x)\n(?:\\b(ref|out|in)\\b)?\\s*\n(?<type-name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)?\n(\\g<identifier>)\\b\\s*\n(?=[,)])",
"match": "(?x)\n(?:\\b(ref|out|in)\\b)?\\s*\n(?:(?<type-name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+)?\n(\\g<identifier>)\\b\\s*\n(?=[,)])",
"captures": {
"1": {
"name": "storage.modifier.cs"
......
/*
https://raw.githubusercontent.com/isagalaev/highlight.js/master/src/styles/vs2015.css
*/
/*
* Visual Studio 2015 dark style
* Author: Nicolas LLOBERA <nllobera@gmail.com>
*/
.hljs-keyword,
.hljs-literal,
.hljs-symbol,
.hljs-name {
color: #569CD6;
}
.hljs-link {
color: #569CD6;
text-decoration: underline;
}
.hljs-built_in,
.hljs-type {
color: #4EC9B0;
}
.hljs-number,
.hljs-class {
color: #B8D7A3;
}
.hljs-string,
.hljs-meta-string {
color: #D69D85;
}
.hljs-regexp,
.hljs-template-tag {
color: #9A5334;
}
.hljs-subst,
.hljs-function,
.hljs-title,
.hljs-params,
.hljs-formula {
color: #DCDCDC;
}
.hljs-comment,
.hljs-quote {
color: #57A64A;
font-style: italic;
}
.hljs-doctag {
color: #608B4E;
}
.hljs-meta,
.hljs-meta-keyword,
.hljs-tag {
color: #9B9B9B;
}
.hljs-variable,
.hljs-template-variable {
color: #BD63C5;
}
.hljs-attr,
.hljs-attribute,
.hljs-builtin-name {
color: #9CDCFE;
}
.hljs-section {
color: gold;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
/*.hljs-code {
font-family:'Monospace';
}*/
.hljs-bullet,
.hljs-selector-tag,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #D7BA7D;
}
.hljs-addition {
background-color: #144212;
display: inline-block;
width: 100%;
}
.hljs-deletion {
background-color: #600;
display: inline-block;
width: 100%;
}
/*
From https://raw.githubusercontent.com/isagalaev/highlight.js/master/src/styles/vs.css
*/
/*
Visual Studio-like style based on original C# coloring by Jason Diamond <jason@diamond.name>
*/
.vscode-light .hljs-comment,
.vscode-light .hljs-quote,
.vscode-light .hljs-variable {
color: #008000;
}
.vscode-light .hljs-keyword,
.vscode-light .hljs-selector-tag,
.vscode-light .hljs-built_in,
.vscode-light .hljs-name,
.vscode-light .hljs-tag {
color: #00f;
}
.vscode-light .hljs-string,
.vscode-light .hljs-title,
.vscode-light .hljs-section,
.vscode-light .hljs-attribute,
.vscode-light .hljs-literal,
.vscode-light .hljs-template-tag,
.vscode-light .hljs-template-variable,
.vscode-light .hljs-type,
.vscode-light .hljs-addition {
color: #a31515;
}
.vscode-light .hljs-deletion,
.vscode-light .hljs-selector-attr,
.vscode-light .hljs-selector-pseudo,
.vscode-light .hljs-meta {
color: #2b91af;
}
.vscode-light .hljs-doctag {
color: #808080;
}
.vscode-light .hljs-attr {
color: #f00;
}
.vscode-light .hljs-symbol,
.vscode-light .hljs-bullet,
.vscode-light .hljs-link {
color: #00b0e8;
}
.vscode-light .hljs-emphasis {
font-style: italic;
}
.vscode-light .hljs-strong {
font-weight: bold;
}
\ No newline at end of file
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
color: #8e908c;
}
/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
color: #c82829;
}
/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
color: #f5871f;
}
/* Tomorrow Yellow */
.hljs-attribute {
color: #eab700;
}
/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
color: #718c00;
}
/* Tomorrow Blue */
.hljs-title,
.hljs-section {
color: #4271ae;
}
/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #8959a8;
}
.hljs {
display: block;
overflow-x: auto;
color: #4d4d4c;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
\ No newline at end of file
......@@ -278,7 +278,7 @@
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/tomorrow.css"
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
......
......@@ -116,6 +116,8 @@ export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
this.topmostLineMonitor,
this.contributions);
vscode.commands.executeCommand('setContext', MarkdownPreviewManager.markdownPreviewActiveContextKey, true);
return this.registerPreview(preview);
}
......
......@@ -471,16 +471,16 @@
"description": "%typescript.preferences.importModuleSpecifier%",
"scope": "resource"
},
"javascript.showUnused.enabled": {
"javascript.showUnused": {
"type": "boolean",
"default": true,
"description": "%typescript.showUnused.enabled%",
"description": "%typescript.showUnused%",
"scope": "resource"
},
"typescript.showUnused.enabled": {
"typescript.showUnused": {
"type": "boolean",
"default": true,
"description": "%typescript.showUnused.enabled%",
"description": "%typescript.showUnused%",
"scope": "resource"
},
"typescript.updateImportsOnFileMove.enabled": {
......
......@@ -55,6 +55,6 @@
"typescript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for TypeScript files in the editor. Requires TypeScript >= 2.8",
"typescript.preferences.quoteStyle": "Preferred quote style to use for quick fixes: 'single' quotes, 'double' quotes, or 'auto' infer quote type from existing imports. Requires TypeScript >= 2.9",
"typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports:\n- \"relative\" to the file location.\n- \"non-relative\" based on the 'baseUrl' configured in your 'jsconfig.json' / 'tsconfig.json'.\n- \"auto\" infer the shortest path type.\nRequires TypeScript >= 2.9",
"typescript.showUnused.enabled": "Enable/disable highlighting of unused variables in code. Requires TypeScript >= 2.9",
"typescript.showUnused": "Enable/disable highlighting of unused variables in code. Requires TypeScript >= 2.9",
"typescript.updateImportsOnFileMove.enabled": "Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Possible values are: 'prompt' on each rename, 'always' update paths automatically, and 'never' rename paths and don't prompt me. Requires TypeScript >= 2.9"
}
\ No newline at end of file
......@@ -114,6 +114,9 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
}
private static shouldInclueEntry(item: Proto.NavigationTree | Proto.NavigationBarItem): boolean {
if (item.kind === PConst.Kind.alias) {
return false;
}
return !!(item.text && item.text !== '<function>' && item.text !== '<class>');
}
}
......@@ -279,7 +279,7 @@ export default class LanguageProvider {
public diagnosticsReceived(diagnosticsKind: DiagnosticKind, file: Uri, diagnostics: (Diagnostic & { reportUnnecessary: any })[]): void {
const config = workspace.getConfiguration(this.id, file);
const reportUnnecessary = config.get<boolean>('showUnused.enabled', true);
const reportUnnecessary = config.get<boolean>('showUnused', true);
this.diagnosticsManager.diagnosticsReceived(diagnosticsKind, file, diagnostics.filter(diag => {
if (!reportUnnecessary) {
diag.customTags = undefined;
......
......@@ -33,13 +33,10 @@ export class HighlightedLabel implements IDisposable {
return this.domNode;
}
set(text: string, highlights: IHighlight[] = [], title?: string) {
set(text: string, highlights: IHighlight[] = [], title: string = '') {
if (!text) {
text = '';
}
if (!title) {
title = text;
}
if (this.didEverRender && this.text === text && this.title === title && objects.equals(this.highlights, highlights)) {
return;
}
......@@ -49,7 +46,7 @@ export class HighlightedLabel implements IDisposable {
}
this.text = text;
this.title = title || text;
this.title = title;
this.highlights = highlights;
this.render();
}
......
......@@ -5418,23 +5418,6 @@ declare module 'vscode' {
readonly webviewPanel: WebviewPanel;
}
/**
* Restore webview panels that have been persisted when vscode shuts down.
*/
interface WebviewPanelSerializer {
/**
* Restore a webview panel from its serialized `state`.
*
* Called when a serialized webview first becomes visible.
*
* @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel.
* @param state Persisted state. This state comes from the value set inside the webview by `acquireVsCodeApi().setState`.
*
* @return Thenable indicating that the webview has been fully restored.
*/
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable<void>;
}
/**
* Namespace describing the environment the editor runs in.
*/
......@@ -5929,19 +5912,6 @@ declare module 'vscode' {
*/
export function createWebviewPanel(viewType: string, title: string, showOptions: ViewColumn | { viewColumn: ViewColumn, preserveFocus?: boolean }, options?: WebviewPanelOptions & WebviewOptions): WebviewPanel;
/**
* Registers a [webview panel serializer](#WebviewPanelSerializer).
*
* Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation method and
* make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation.
*
* Only a single serializer may be registered at a time for a given `viewType`.
*
* @param viewType Type of the webview panel that can be serialized.
* @param serializer Webview serializer.
*/
export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable;
/**
* Set a message to the status bar. This is a short hand for the more powerful
* status bar [items](#window.createStatusBarItem).
......
......@@ -467,4 +467,40 @@ declare module 'vscode' {
//#endregion
//#region Matt: WebView Serializer
/**
* Restore webview panels that have been persisted when vscode shuts down.
*/
interface WebviewPanelSerializer {
/**
* Restore a webview panel from its seriailzed `state`.
*
* Called when a serialized webview first becomes visible.
*
* @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel.
* @param state Persisted state.
*
* @return Thanble indicating that the webview has been fully restored.
*/
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable<void>;
}
namespace window {
/**
* Registers a webview panel serializer.
*
* Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation method and
* make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation.
*
* Only a single serializer may be registered at a time for a given `viewType`.
*
* @param viewType Type of the webview panel that can be serialized.
* @param serializer Webview serializer.
*/
export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable;
}
//#endregion
}
......@@ -111,6 +111,16 @@ function getViewLocation(value: string): ViewLocation {
}
}
function showCollapsed(location: ViewLocation): boolean {
switch (location) {
case ViewLocation.Explorer:
case ViewLocation.SCM:
case ViewLocation.Debug:
return true;
}
return false;
}
ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyViewDescriptor[] }>('views', [viewsContainersExtensionPoint], schema.viewsContribution)
.setHandler((extensions) => {
for (let extension of extensions) {
......@@ -136,6 +146,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyV
location,
when: ContextKeyExpr.deserialize(item.when),
canToggleVisibility: true,
collapsed: showCollapsed(location),
treeView: true
};
......
......@@ -419,9 +419,6 @@ export function createApiFactory(
createWebviewPanel(viewType: string, title: string, showOptions: vscode.ViewColumn | { viewColumn: vscode.ViewColumn, preserveFocus?: boolean }, options: vscode.WebviewPanelOptions & vscode.WebviewOptions): vscode.WebviewPanel {
return extHostWebviews.createWebview(viewType, title, showOptions, options, extension.extensionLocation);
},
registerWebviewPanelSerializer(viewType: string, serializer: vscode.WebviewPanelSerializer) {
return extHostWebviews.registerWebviewPanelSerializer(viewType, serializer);
},
createTerminal(nameOrOptions: vscode.TerminalOptions | string, shellPath?: string, shellArgs?: string[]): vscode.Terminal {
if (typeof nameOrOptions === 'object') {
return extHostTerminalService.createTerminalFromOptions(<vscode.TerminalOptions>nameOrOptions);
......@@ -441,6 +438,9 @@ export function createApiFactory(
registerDecorationProvider: proposedApiFunction(extension, (provider: vscode.DecorationProvider) => {
return extHostDecorations.registerDecorationProvider(provider, extension.id);
}),
registerWebviewPanelSerializer: proposedApiFunction(extension, (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
return extHostWebviews.registerWebviewPanelSerializer(viewType, serializer);
}),
registerProtocolHandler: proposedApiFunction(extension, (handler: vscode.ProtocolHandler) => {
return extHostUrls.registerProtocolHandler(extension.id, handler);
})
......@@ -625,12 +625,12 @@ export function createApiFactory(
registerTaskProvider: (type: string, provider: vscode.TaskProvider) => {
return extHostTask.registerTaskProvider(extension, provider);
},
fetchTasks: proposedApiFunction(extension, (filter?: vscode.TaskFilter): Thenable<vscode.Task[]> => {
fetchTasks: (filter?: vscode.TaskFilter): Thenable<vscode.Task[]> => {
return extHostTask.fetchTasks(filter);
}),
executeTask: proposedApiFunction(extension, (task: vscode.Task): Thenable<vscode.TaskExecution> => {
},
executeTask: (task: vscode.Task): Thenable<vscode.TaskExecution> => {
return extHostTask.executeTask(extension, task);
}),
},
get taskExecutions(): vscode.TaskExecution[] {
return extHostTask.taskExecutions;
},
......
......@@ -129,12 +129,12 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
this.toUnbind.push(this.onDidPanelClose(panel => this.compositeBar.deactivateComposite(panel.getId())));
}
private _onDidPanelOpen(viewlet: IPanel): void {
this.activePanelContextKey.set(viewlet.getId());
private _onDidPanelOpen(panel: IPanel): void {
this.activePanelContextKey.set(panel.getId());
}
private _onDidPanelClose(viewlet: IPanel): void {
const id = viewlet.getId();
private _onDidPanelClose(panel: IPanel): void {
const id = panel.getId();
if (this.activePanelContextKey.get() === id) {
this.activePanelContextKey.reset();
......
......@@ -427,7 +427,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this.toUnbind.push(inputBox);
this.countContainer = dom.append(this.filterContainer, $('.quick-input-count'));
const count = new CountBadge(this.countContainer, { countFormat: localize('quickInput.countSelected', "{0} Selected") });
const count = new CountBadge(this.countContainer, { countFormat: localize({ key: 'quickInput.countSelected', comment: ['This tells the user how many items are selected in a list of items to select from. The items can be anything.'] }, "{0} Selected") });
this.toUnbind.push(attachBadgeStyler(count, this.themeService));
this.okContainer = dom.append(headerContainer, $('.quick-input-action'));
......@@ -625,10 +625,15 @@ export class QuickInputService extends Component implements IQuickInputService {
const d = token.onCancellationRequested(() => this.close());
this.controller.result.then(() => d.dispose(), () => d.dispose());
const wasController = this.controller;
const delay = TPromise.timeout(800);
delay.then(() => this.progressBar.infinite(), () => { /* ignore */ });
delay.then(() => {
if (this.controller === wasController) {
this.progressBar.infinite();
}
}, () => { /* ignore */ });
const wasController = this.controller;
this.controller.ready.then(() => {
delay.cancel();
if (this.controller !== wasController) {
......
......@@ -92,8 +92,9 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.updateScheduler = new RunOnceScheduler(() => {
const state = this.debugService.state;
const toolBarLocation = this.configurationService.getValue<IDebugConfiguration>('debug').toolBarLocation;
if (state === State.Inactive || this.configurationService.getValue<IDebugConfiguration>('debug').hideActionBar
|| this.configurationService.getValue<IDebugConfiguration>('debug').toolBarLocation !== 'floating') {
|| toolBarLocation === 'docked' || toolBarLocation === 'hidden') {
return this.hide();
}
......
......@@ -227,20 +227,20 @@ class GoToBreakpointAction extends EditorAction {
//Try to find breakpoint in current file
let moveBreakpoint =
this.isNext
? allEnabledBreakpoints.filter(bp => bp.uri.toString() === currentUri.toString() && bp.lineNumber > currentLine)[0]
: allEnabledBreakpoints.filter(bp => bp.uri.toString() === currentUri.toString() && bp.lineNumber < currentLine)[0];
? allEnabledBreakpoints.filter(bp => bp.uri.toString() === currentUri.toString() && bp.lineNumber > currentLine).shift()
: allEnabledBreakpoints.filter(bp => bp.uri.toString() === currentUri.toString() && bp.lineNumber < currentLine).pop();
//Try to find breakpoints in following files
if (!moveBreakpoint) {
moveBreakpoint =
this.isNext
? allEnabledBreakpoints.filter(bp => bp.uri.toString() > currentUri.toString())[0]
: allEnabledBreakpoints.filter(bp => bp.uri.toString() < currentUri.toString())[0];
? allEnabledBreakpoints.filter(bp => bp.uri.toString() > currentUri.toString()).shift()
: allEnabledBreakpoints.filter(bp => bp.uri.toString() < currentUri.toString()).pop();
}
//Move to first possible breakpoint
if (!moveBreakpoint) {
moveBreakpoint = allEnabledBreakpoints[0];
//Move to first or last possible breakpoint
if (!moveBreakpoint && allEnabledBreakpoints.length) {
moveBreakpoint = this.isNext ? allEnabledBreakpoints[0] : allEnabledBreakpoints[allEnabledBreakpoints.length - 1];
}
if (moveBreakpoint) {
......
......@@ -50,6 +50,7 @@ import { Schemas } from 'vs/base/common/network';
import { IDialogService, IConfirmationResult, IConfirmation, getConfirmMessage } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { Constants } from 'vs/editor/common/core/uint';
export interface IEditableData {
action: IAction;
......@@ -1057,12 +1058,16 @@ function findValidPasteFileTarget(targetFolder: ExplorerItem, fileToPaste: { res
export function incrementFileName(name: string, isFolder: boolean): string {
const separators = '[\\.\\-_]';
const maxNumber = Constants.MAX_SAFE_SMALL_INTEGER;
// file.1.txt=>file.2.txt
let suffixFileRegex = RegExp('(.*' + separators + ')(\\d+)(\\..*)$');
if (!isFolder && name.match(suffixFileRegex)) {
return name.replace(suffixFileRegex, (match, g1?, g2?, g3?) => {
return g1 + strings.pad(parseInt(g2) + 1, g2.length) + g3;
let number = parseInt(g2);
return number < maxNumber
? g1 + strings.pad(number + 1, g2.length) + g3
: strings.format('{0}{1}.1{2}', g1, g2, g3);
});
}
......@@ -1070,7 +1075,10 @@ export function incrementFileName(name: string, isFolder: boolean): string {
let prefixFileRegex = RegExp('(\\d+)(' + separators + '.*)(\\..*)$');
if (!isFolder && name.match(prefixFileRegex)) {
return name.replace(prefixFileRegex, (match, g1?, g2?, g3?) => {
return strings.pad(parseInt(g1) + 1, g1.length) + g2 + g3;
let number = parseInt(g1);
return number < maxNumber
? strings.pad(number + 1, g1.length) + g2 + g3
: strings.format('{0}{1}.1{2}', g1, g2, g3);
});
}
......@@ -1082,12 +1090,22 @@ export function incrementFileName(name: string, isFolder: boolean): string {
// folder.1=>folder.2
if (isFolder && name.match(/(\d+)$/)) {
return name.replace(/(\d+)$/, (match: string, ...groups: any[]) => { return strings.pad(parseInt(groups[0]) + 1, groups[0].length); });
return name.replace(/(\d+)$/, (match: string, ...groups: any[]) => {
let number = parseInt(groups[0]);
return number < maxNumber
? strings.pad(number + 1, groups[0].length)
: strings.format('{0}.1', groups[0]);
});
}
// 1.folder=>2.folder
if (isFolder && name.match(/^(\d+)/)) {
return name.replace(/^(\d+)/, (match: string, ...groups: any[]) => { return strings.pad(parseInt(groups[0]) + 1, groups[0].length); });
return name.replace(/^(\d+)(.*)$/, (match: string, ...groups: any[]) => {
let number = parseInt(groups[0]);
return number < maxNumber
? strings.pad(number + 1, groups[0].length) + groups[1]
: strings.format('{0}{1}.1', groups[0], groups[1]);
});
}
// file/folder=>file.1/folder.1
......
......@@ -88,6 +88,18 @@ suite('Files - Increment file name', () => {
assert.strictEqual(result, 'test_2');
});
test('Increment file name with suffix version, too big number', function () {
const name = 'test.9007199254740992.js';
const result = incrementFileName(name, false);
assert.strictEqual(result, 'test.9007199254740992.1.js');
});
test('Increment folder name with suffix version, too big number', function () {
const name = 'test.9007199254740992';
const result = incrementFileName(name, true);
assert.strictEqual(result, 'test.9007199254740992.1');
});
test('Increment file name with prefix version', function () {
const name = '1.test.js';
const result = incrementFileName(name, false);
......@@ -112,19 +124,31 @@ suite('Files - Increment file name', () => {
assert.strictEqual(result, '2_test.js');
});
test('Increment folder name with suffix version', function () {
test('Increment file name with prefix version, too big number', function () {
const name = '9007199254740992.test.js';
const result = incrementFileName(name, false);
assert.strictEqual(result, '9007199254740992.test.1.js');
});
test('Increment folder name with prefix version', function () {
const name = '1.test';
const result = incrementFileName(name, true);
assert.strictEqual(result, '2.test');
});
test('Increment folder name with suffix version, trailing zeros', function () {
test('Increment folder name with prefix version, too big number', function () {
const name = '9007199254740992.test';
const result = incrementFileName(name, true);
assert.strictEqual(result, '9007199254740992.test.1');
});
test('Increment folder name with prefix version, trailing zeros', function () {
const name = '001.test';
const result = incrementFileName(name, true);
assert.strictEqual(result, '002.test');
});
test('Increment folder name with suffix version with `-` as separator', function () {
test('Increment folder name with prefix version with `-` as separator', function () {
const name = '1-test';
const result = incrementFileName(name, true);
assert.strictEqual(result, '2-test');
......
......@@ -691,7 +691,7 @@ export class TerminalTaskSystem implements ITaskSystem {
return command;
}
let basename = path.parse(shellExecutable).name.toLowerCase();
let shellQuoteOptions = this.getOuotingOptions(basename, shellOptions);
let shellQuoteOptions = this.getQuotingOptions(basename, shellOptions);
function needsQuotes(value: string): boolean {
if (value.length >= 2) {
......@@ -784,7 +784,7 @@ export class TerminalTaskSystem implements ITaskSystem {
return commandLine;
}
private getOuotingOptions(shellBasename: string, shellOptions: ShellConfiguration): ShellQuotingOptions {
private getQuotingOptions(shellBasename: string, shellOptions: ShellConfiguration): ShellQuotingOptions {
if (shellOptions && shellOptions.quoting) {
return shellOptions.quoting;
}
......
......@@ -26,9 +26,8 @@ import { PANEL_BACKGROUND, PANEL_BORDER } from 'vs/workbench/common/theme';
import { TERMINAL_BACKGROUND_COLOR, TERMINAL_BORDER_COLOR } from 'vs/workbench/parts/terminal/common/terminalColorRegistry';
import { DataTransfers } from 'vs/base/browser/dnd';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { INotificationService, IPromptChoice } from 'vs/platform/notification/common/notification';
import { INotificationService, IPromptChoice, Severity } from 'vs/platform/notification/common/notification';
import { TerminalConfigHelper } from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
import { Severity } from 'vs/editor/editor.api';
export class TerminalPanel extends Panel {
......
......@@ -28,9 +28,8 @@ import { IWindowsService, IWindowService } from 'vs/platform/windows/common/wind
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IModelService } from 'vs/editor/common/services/modelService';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { getConfirmMessage, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { Severity } from 'vs/editor/common/standalone/standaloneBase';
export class TextFileService extends AbstractTextFileService {
......
......@@ -8,7 +8,7 @@ import { ContributableViewsModel } from 'vs/workbench/browser/parts/views/contri
import { ViewLocation, ViewsRegistry, IViewDescriptor } from 'vs/workbench/common/views';
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { move } from 'vs/base/common/arrays';
......@@ -35,7 +35,7 @@ suite('ContributableViewsModel', () => {
let contextKeyService: IContextKeyService;
setup(() => {
const configurationService = new SimpleConfigurationService();
const configurationService = new TestConfigurationService();
contextKeyService = new ContextKeyService(configurationService);
});
......
......@@ -26,7 +26,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { TPromise } from 'vs/base/common/winjs.base';
import URI from 'vs/base/common/uri';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { IModelService } from 'vs/editor/common/services/modelService';
......@@ -69,7 +69,7 @@ suite.skip('QuickOpen performance (integration)', () => {
const telemetryService = new TestTelemetryService();
const experimentService = new TestExperimentService();
const configurationService = new SimpleConfigurationService();
const configurationService = new TestConfigurationService();
const instantiationService = new InstantiationService(new ServiceCollection(
[ITelemetryService, telemetryService],
[IExperimentService, experimentService],
......
......@@ -24,7 +24,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { TPromise } from 'vs/base/common/winjs.base';
import URI from 'vs/base/common/uri';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { IModelService } from 'vs/editor/common/services/modelService';
......@@ -58,7 +58,7 @@ suite.skip('TextSearch performance (integration)', () => {
}
const telemetryService = new TestTelemetryService();
const configurationService = new SimpleConfigurationService();
const configurationService = new TestConfigurationService();
const instantiationService = new InstantiationService(new ServiceCollection(
[ITelemetryService, telemetryService],
[IConfigurationService, configurationService],
......
......@@ -3,16 +3,23 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as cp from 'child_process';
import { Application } from '../../application';
export function setup() {
describe('Search', () => {
after(function () {
const app = this.app as Application;
cp.execSync('git checkout .', { cwd: app.workspacePath });
cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath });
});
it('searches for body & checks for correct result number', async function () {
const app = this.app as Application;
await app.workbench.search.openSearchViewlet();
await app.workbench.search.searchFor('body');
await app.workbench.search.waitForResultText('14 results in 5 files');
await app.workbench.search.waitForResultText('21 results in 6 files');
});
it('searches only for *.js files & checks for correct result number', async function () {
......@@ -31,22 +38,22 @@ export function setup() {
const app = this.app as Application;
await app.workbench.search.searchFor('body');
await app.workbench.search.removeFileMatch(1);
await app.workbench.search.waitForResultText('10 results in 4 files');
await app.workbench.search.waitForResultText('17 results in 5 files');
});
// it('replaces first search result with a replace term', async function () {
// const app = this.app as Application;
it('replaces first search result with a replace term', async function () {
const app = this.app as Application;
// await app.workbench.search.searchFor('body');
// await app.workbench.search.expandReplace();
// await app.workbench.search.setReplaceText('ydob');
// await app.workbench.search.replaceFileMatch(1);
await app.workbench.search.searchFor('body');
await app.workbench.search.expandReplace();
await app.workbench.search.setReplaceText('ydob');
await app.workbench.search.replaceFileMatch(1);
// await app.workbench.search.waitForResultText('10 results in 4 files');
await app.workbench.search.waitForResultText('17 results in 5 files');
// await app.workbench.search.searchFor('ydob');
// await app.workbench.search.setReplaceText('body');
// await app.workbench.search.replaceFileMatch(1);
// });
await app.workbench.search.searchFor('ydob');
await app.workbench.search.setReplaceText('body');
await app.workbench.search.replaceFileMatch(1);
});
});
}
\ No newline at end of file
......@@ -189,7 +189,7 @@ async function setupRepository(): Promise<void> {
}
console.log('*** Running yarn...');
cp.execSync('yarn --verbose', { cwd: workspacePath, stdio: 'inherit' });
cp.execSync('yarn', { cwd: workspacePath, stdio: 'inherit' });
}
}
......
......@@ -459,7 +459,8 @@
}
],
"duplicate-imports": true,
"translation-remind": true
"translation-remind": true,
"no-standalone-editor": true
},
"defaultSeverity": "warning"
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册