提交 2986851a 编写于 作者: B Benjamin Pasero

Merge branch 'master' into ben/storagehint

...@@ -271,7 +271,7 @@ export class DropdownMenuActionItem extends BaseActionItem { ...@@ -271,7 +271,7 @@ export class DropdownMenuActionItem extends BaseActionItem {
private actionItemProvider: IActionItemProvider; private actionItemProvider: IActionItemProvider;
private keybindings: (action: IAction) => ResolvedKeybinding; private keybindings: (action: IAction) => ResolvedKeybinding;
private clazz: string; private clazz: string;
private anchorAlignmentProvider: () => AnchorAlignment; private anchorAlignmentProvider: (() => AnchorAlignment) | undefined;
constructor(action: IAction, menuActions: IAction[], contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string, anchorAlignmentProvider?: () => AnchorAlignment); constructor(action: IAction, menuActions: IAction[], contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string, anchorAlignmentProvider?: () => AnchorAlignment);
constructor(action: IAction, actionProvider: IActionProvider, contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string, anchorAlignmentProvider?: () => AnchorAlignment); constructor(action: IAction, actionProvider: IActionProvider, contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string, anchorAlignmentProvider?: () => AnchorAlignment);
...@@ -314,17 +314,24 @@ export class DropdownMenuActionItem extends BaseActionItem { ...@@ -314,17 +314,24 @@ export class DropdownMenuActionItem extends BaseActionItem {
this.dropdownMenu = this._register(new DropdownMenu(container, options)); this.dropdownMenu = this._register(new DropdownMenu(container, options));
const that = this;
this.dropdownMenu.menuOptions = { this.dropdownMenu.menuOptions = {
actionItemProvider: this.actionItemProvider, actionItemProvider: this.actionItemProvider,
actionRunner: this.actionRunner, actionRunner: this.actionRunner,
getKeyBinding: this.keybindings, getKeyBinding: this.keybindings,
context: this._context, context: this._context
};
if (this.anchorAlignmentProvider) {
const that = this;
this.dropdownMenu.menuOptions = {
...this.dropdownMenu.menuOptions,
get anchorAlignment(): AnchorAlignment { get anchorAlignment(): AnchorAlignment {
return that.anchorAlignmentProvider(); return that.anchorAlignmentProvider();
} }
}; };
} }
}
setActionContext(newContext: any): void { setActionContext(newContext: any): void {
super.setActionContext(newContext); super.setActionContext(newContext);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
.monaco-findInput .monaco-inputbox { .monaco-findInput .monaco-inputbox {
font-size: 13px; font-size: 13px;
width: 100%; width: 100%;
height: 25px;
} }
.monaco-findInput > .controls { .monaco-findInput > .controls {
......
...@@ -23,6 +23,7 @@ export interface IFindInputOptions extends IFindInputStyles { ...@@ -23,6 +23,7 @@ export interface IFindInputOptions extends IFindInputStyles {
readonly width?: number; readonly width?: number;
readonly validation?: IInputValidator; readonly validation?: IInputValidator;
readonly label: string; readonly label: string;
readonly flexibleHeight?: boolean;
readonly appendCaseSensitiveLabel?: string; readonly appendCaseSensitiveLabel?: string;
readonly appendWholeWordsLabel?: string; readonly appendWholeWordsLabel?: string;
...@@ -118,7 +119,7 @@ export class FindInput extends Widget { ...@@ -118,7 +119,7 @@ export class FindInput extends Widget {
this.domNode = null; this.domNode = null;
this.inputBox = null; this.inputBox = null;
this.buildDomNode(options.appendCaseSensitiveLabel || '', options.appendWholeWordsLabel || '', options.appendRegexLabel || '', options.history); this.buildDomNode(options.appendCaseSensitiveLabel || '', options.appendWholeWordsLabel || '', options.appendRegexLabel || '', options.history, options.flexibleHeight);
if (Boolean(parent)) { if (Boolean(parent)) {
parent.appendChild(this.domNode); parent.appendChild(this.domNode);
...@@ -287,7 +288,7 @@ export class FindInput extends Widget { ...@@ -287,7 +288,7 @@ export class FindInput extends Widget {
this.inputBox.width = w; this.inputBox.width = w;
} }
private buildDomNode(appendCaseSensitiveLabel: string, appendWholeWordsLabel: string, appendRegexLabel: string, history: string[]): void { private buildDomNode(appendCaseSensitiveLabel: string, appendWholeWordsLabel: string, appendRegexLabel: string, history: string[], flexibleHeight: boolean): void {
this.domNode = document.createElement('div'); this.domNode = document.createElement('div');
this.domNode.style.width = this.width + 'px'; this.domNode.style.width = this.width + 'px';
dom.addClass(this.domNode, 'monaco-findInput'); dom.addClass(this.domNode, 'monaco-findInput');
...@@ -310,7 +311,8 @@ export class FindInput extends Widget { ...@@ -310,7 +311,8 @@ export class FindInput extends Widget {
inputValidationErrorBackground: this.inputValidationErrorBackground, inputValidationErrorBackground: this.inputValidationErrorBackground,
inputValidationErrorForeground: this.inputValidationErrorForeground, inputValidationErrorForeground: this.inputValidationErrorForeground,
inputValidationErrorBorder: this.inputValidationErrorBorder, inputValidationErrorBorder: this.inputValidationErrorBorder,
history history,
flexibleHeight
})); }));
this.regex = this._register(new RegexCheckbox({ this.regex = this._register(new RegexCheckbox({
......
...@@ -291,6 +291,9 @@ export class InputBox extends Widget { ...@@ -291,6 +291,9 @@ export class InputBox extends Widget {
public set width(width: number) { public set width(width: number) {
this.input.style.width = width + 'px'; this.input.style.width = width + 'px';
if (this.mirror) {
this.mirror.style.width = width + 'px';
}
} }
public showMessage(message: IMessage, force?: boolean): void { public showMessage(message: IMessage, force?: boolean): void {
......
...@@ -202,13 +202,13 @@ function asTreeEvent<T>(event: IListEvent<ITreeNode<T, any>>): ITreeEvent<T> { ...@@ -202,13 +202,13 @@ function asTreeEvent<T>(event: IListEvent<ITreeNode<T, any>>): ITreeEvent<T> {
function asTreeMouseEvent<T>(event: IListMouseEvent<ITreeNode<T, any>>): ITreeMouseEvent<T> { function asTreeMouseEvent<T>(event: IListMouseEvent<ITreeNode<T, any>>): ITreeMouseEvent<T> {
return { return {
browserEvent: event.browserEvent, browserEvent: event.browserEvent,
element: event.element.element element: event.element && event.element.element
}; };
} }
function asTreeContextMenuEvent<T>(event: IListContextMenuEvent<ITreeNode<T, any>>): ITreeContextMenuEvent<T> { function asTreeContextMenuEvent<T>(event: IListContextMenuEvent<ITreeNode<T, any>>): ITreeContextMenuEvent<T> {
return { return {
element: event.element.element, element: event.element && event.element.element,
browserEvent: event.browserEvent, browserEvent: event.browserEvent,
anchor: event.anchor anchor: event.anchor
}; };
......
...@@ -92,21 +92,21 @@ class DataTreeRenderer<T, TFilterData, TTemplateData> implements ITreeRenderer<I ...@@ -92,21 +92,21 @@ class DataTreeRenderer<T, TFilterData, TTemplateData> implements ITreeRenderer<I
function asTreeEvent<T>(e: ITreeEvent<IDataTreeNode<T>>): ITreeEvent<T> { function asTreeEvent<T>(e: ITreeEvent<IDataTreeNode<T>>): ITreeEvent<T> {
return { return {
browserEvent: e.browserEvent, browserEvent: e.browserEvent,
elements: e.elements.map(e => e.element) elements: e.elements.map(e => e.element!)
}; };
} }
function asTreeMouseEvent<T>(e: ITreeMouseEvent<IDataTreeNode<T>>): ITreeMouseEvent<T> { function asTreeMouseEvent<T>(e: ITreeMouseEvent<IDataTreeNode<T>>): ITreeMouseEvent<T> {
return { return {
browserEvent: e.browserEvent, browserEvent: e.browserEvent,
element: e.element.element element: e.element && e.element.element!
}; };
} }
function asTreeContextMenuEvent<T>(e: ITreeContextMenuEvent<IDataTreeNode<T>>): ITreeContextMenuEvent<T> { function asTreeContextMenuEvent<T>(e: ITreeContextMenuEvent<IDataTreeNode<T>>): ITreeContextMenuEvent<T> {
return { return {
browserEvent: e.browserEvent, browserEvent: e.browserEvent,
element: e.element.element, element: e.element && e.element.element!,
anchor: e.anchor anchor: e.anchor
}; };
} }
......
...@@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log'; ...@@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { parseArgs } from 'vs/platform/environment/node/argv'; import { parseArgs } from 'vs/platform/environment/node/argv';
import product from 'vs/platform/node/product'; import product from 'vs/platform/node/product';
import { IWindowSettings, MenuBarVisibility, IWindowConfiguration, ReadyState, IRunActionInWindowRequest } from 'vs/platform/windows/common/windows'; import { IWindowSettings, MenuBarVisibility, IWindowConfiguration, ReadyState, IRunActionInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform'; import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import { ICodeWindow, IWindowState, WindowMode } from 'vs/platform/windows/electron-main/windows'; import { ICodeWindow, IWindowState, WindowMode } from 'vs/platform/windows/electron-main/windows';
...@@ -155,28 +155,11 @@ export class CodeWindow implements ICodeWindow { ...@@ -155,28 +155,11 @@ export class CodeWindow implements ICodeWindow {
} }
} }
let useNativeTabs = false;
if (isMacintosh && windowConfig && windowConfig.nativeTabs === true) { if (isMacintosh && windowConfig && windowConfig.nativeTabs === true) {
options.tabbingIdentifier = product.nameShort; // this opts in to sierra tabs options.tabbingIdentifier = product.nameShort; // this opts in to sierra tabs
useNativeTabs = true;
}
let useCustomTitleStyle = false;
if (isMacintosh) {
useCustomTitleStyle = !windowConfig || !windowConfig.titleBarStyle || windowConfig.titleBarStyle === 'custom'; // Default to custom on macOS
const isDev = !this.environmentService.isBuilt || !!config.extensionDevelopmentPath;
if (isDev) {
useCustomTitleStyle = false; // not enabled when developing due to https://github.com/electron/electron/issues/3647
}
} else {
useCustomTitleStyle = !windowConfig || !windowConfig.titleBarStyle || windowConfig.titleBarStyle === 'custom'; // Default to custom
}
if (useNativeTabs) {
useCustomTitleStyle = false; // native tabs on sierra do not work with custom title style
} }
const useCustomTitleStyle = getTitleBarStyle(this.configurationService, this.environmentService) === 'custom';
if (useCustomTitleStyle) { if (useCustomTitleStyle) {
options.titleBarStyle = 'hidden'; options.titleBarStyle = 'hidden';
this.hiddenTitleBarStyle = true; this.hiddenTitleBarStyle = true;
......
...@@ -21,11 +21,6 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie ...@@ -21,11 +21,6 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
export interface IPosition {
x: number;
y: number;
}
export class ContextMenuController implements IEditorContribution { export class ContextMenuController implements IEditorContribution {
private static readonly ID = 'editor.contrib.contextmenu'; private static readonly ID = 'editor.contrib.contextmenu';
...@@ -93,16 +88,16 @@ export class ContextMenuController implements IEditorContribution { ...@@ -93,16 +88,16 @@ export class ContextMenuController implements IEditorContribution {
} }
// Unless the user triggerd the context menu through Shift+F10, use the mouse position as menu position // Unless the user triggerd the context menu through Shift+F10, use the mouse position as menu position
let forcedPosition: IPosition; let anchor: IAnchor;
if (e.target.type !== MouseTargetType.TEXTAREA) { if (e.target.type !== MouseTargetType.TEXTAREA) {
forcedPosition = { x: e.event.posx + 2, y: e.event.posy + 1 }; anchor = { x: e.event.posx - 1, width: 2, y: e.event.posy - 1, height: 2 };
} }
// Show the context menu // Show the context menu
this.showContextMenu(forcedPosition); this.showContextMenu(anchor);
} }
public showContextMenu(forcedPosition?: IPosition): void { public showContextMenu(anchor?: IAnchor): void {
if (!this._editor.getConfiguration().contribInfo.contextmenu) { if (!this._editor.getConfiguration().contribInfo.contextmenu) {
return; // Context menu is turned off through configuration return; // Context menu is turned off through configuration
} }
...@@ -117,7 +112,7 @@ export class ContextMenuController implements IEditorContribution { ...@@ -117,7 +112,7 @@ export class ContextMenuController implements IEditorContribution {
// Show menu if we have actions to show // Show menu if we have actions to show
if (menuActions.length > 0) { if (menuActions.length > 0) {
this._doShowContextMenu(menuActions, forcedPosition); this._doShowContextMenu(menuActions, anchor);
} }
} }
...@@ -137,7 +132,7 @@ export class ContextMenuController implements IEditorContribution { ...@@ -137,7 +132,7 @@ export class ContextMenuController implements IEditorContribution {
return result; return result;
} }
private _doShowContextMenu(actions: IAction[], forcedPosition: IPosition | null = null): void { private _doShowContextMenu(actions: IAction[], anchor: IAnchor | null = null): void {
// Disable hover // Disable hover
const oldHoverSetting = this._editor.getConfiguration().contribInfo.hover; const oldHoverSetting = this._editor.getConfiguration().contribInfo.hover;
...@@ -147,7 +142,6 @@ export class ContextMenuController implements IEditorContribution { ...@@ -147,7 +142,6 @@ export class ContextMenuController implements IEditorContribution {
} }
}); });
let anchor: IAnchor = forcedPosition;
if (!anchor) { if (!anchor) {
// Ensure selection is visible // Ensure selection is visible
this._editor.revealPosition(this._editor.getPosition(), ScrollType.Immediate); this._editor.revealPosition(this._editor.getPosition(), ScrollType.Immediate);
......
...@@ -17,7 +17,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; ...@@ -17,7 +17,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { optional } from 'vs/platform/instantiation/common/instantiation'; import { optional } from 'vs/platform/instantiation/common/instantiation';
import { Choice, Placeholder, SnippetParser, Text, TextmateSnippet } from './snippetParser'; import { Choice, Placeholder, SnippetParser, Text, TextmateSnippet } from './snippetParser';
import { ClipboardBasedVariableResolver, CompositeSnippetVariableResolver, ModelBasedVariableResolver, SelectionBasedVariableResolver, TimeBasedVariableResolver } from './snippetVariables'; import { ClipboardBasedVariableResolver, CompositeSnippetVariableResolver, ModelBasedVariableResolver, SelectionBasedVariableResolver, TimeBasedVariableResolver, CommentBasedVariableResolver } from './snippetVariables';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import * as colors from 'vs/platform/theme/common/colorRegistry'; import * as colors from 'vs/platform/theme/common/colorRegistry';
...@@ -402,6 +402,7 @@ export class SnippetSession { ...@@ -402,6 +402,7 @@ export class SnippetSession {
modelBasedVariableResolver, modelBasedVariableResolver,
new ClipboardBasedVariableResolver(clipboardService, idx, indexedSelections.length), new ClipboardBasedVariableResolver(clipboardService, idx, indexedSelections.length),
new SelectionBasedVariableResolver(model, selection), new SelectionBasedVariableResolver(model, selection),
new CommentBasedVariableResolver(model),
new TimeBasedVariableResolver new TimeBasedVariableResolver
])); ]));
......
...@@ -8,6 +8,7 @@ import { basename, dirname } from 'vs/base/common/paths'; ...@@ -8,6 +8,7 @@ import { basename, dirname } from 'vs/base/common/paths';
import { ITextModel } from 'vs/editor/common/model'; import { ITextModel } from 'vs/editor/common/model';
import { Selection } from 'vs/editor/common/core/selection'; import { Selection } from 'vs/editor/common/core/selection';
import { VariableResolver, Variable, Text } from 'vs/editor/contrib/snippet/snippetParser'; import { VariableResolver, Variable, Text } from 'vs/editor/contrib/snippet/snippetParser';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { getLeadingWhitespace, commonPrefixLength, isFalsyOrWhitespace, pad } from 'vs/base/common/strings'; import { getLeadingWhitespace, commonPrefixLength, isFalsyOrWhitespace, pad } from 'vs/base/common/strings';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
...@@ -34,6 +35,9 @@ export const KnownSnippetVariableNames = Object.freeze({ ...@@ -34,6 +35,9 @@ export const KnownSnippetVariableNames = Object.freeze({
'TM_FILENAME_BASE': true, 'TM_FILENAME_BASE': true,
'TM_DIRECTORY': true, 'TM_DIRECTORY': true,
'TM_FILEPATH': true, 'TM_FILEPATH': true,
'BLOCK_COMMENT_START': true,
'BLOCK_COMMENT_END': true,
'LINE_COMMENT': true,
}); });
export class CompositeSnippetVariableResolver implements VariableResolver { export class CompositeSnippetVariableResolver implements VariableResolver {
...@@ -180,7 +184,29 @@ export class ClipboardBasedVariableResolver implements VariableResolver { ...@@ -180,7 +184,29 @@ export class ClipboardBasedVariableResolver implements VariableResolver {
} }
} }
} }
export class CommentBasedVariableResolver implements VariableResolver {
constructor(
private readonly _model: ITextModel
) {
//
}
resolve(variable: Variable): string | undefined {
const { name } = variable;
const language = this._model.getLanguageIdentifier();
const config = LanguageConfigurationRegistry.getComments(language.id);
if (!config) {
return undefined;
}
if (name === 'LINE_COMMENT') {
return config.lineCommentToken || undefined;
} else if (name === 'BLOCK_COMMENT_START') {
return config.blockCommentStartToken || undefined;
} else if (name === 'BLOCK_COMMENT_END') {
return config.blockCommentEndToken || undefined;
}
return undefined;
}
}
export class TimeBasedVariableResolver implements VariableResolver { export class TimeBasedVariableResolver implements VariableResolver {
private static readonly dayNames = [nls.localize('Sunday', "Sunday"), nls.localize('Monday', "Monday"), nls.localize('Tuesday', "Tuesday"), nls.localize('Wednesday', "Wednesday"), nls.localize('Thursday', "Thursday"), nls.localize('Friday', "Friday"), nls.localize('Saturday', "Saturday")]; private static readonly dayNames = [nls.localize('Sunday', "Sunday"), nls.localize('Monday', "Monday"), nls.localize('Tuesday', "Tuesday"), nls.localize('Wednesday', "Wednesday"), nls.localize('Thursday', "Thursday"), nls.localize('Friday', "Friday"), nls.localize('Saturday', "Saturday")];
......
...@@ -7,7 +7,7 @@ import * as nls from 'vs/nls'; ...@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import { isMacintosh, language } from 'vs/base/common/platform'; import { isMacintosh, language } from 'vs/base/common/platform';
import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { app, shell, Menu, MenuItem, BrowserWindow } from 'electron'; import { app, shell, Menu, MenuItem, BrowserWindow } from 'electron';
import { OpenContext, IRunActionInWindowRequest } from 'vs/platform/windows/common/windows'; import { OpenContext, IRunActionInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IUpdateService, StateType } from 'vs/platform/update/common/update'; import { IUpdateService, StateType } from 'vs/platform/update/common/update';
...@@ -70,7 +70,9 @@ export class Menubar { ...@@ -70,7 +70,9 @@ export class Menubar {
this.menubarMenus = Object.create(null); this.menubarMenus = Object.create(null);
this.keybindings = Object.create(null); this.keybindings = Object.create(null);
if (isMacintosh || getTitleBarStyle(this.configurationService, this.environmentService) === 'native') {
this.restoreCachedMenubarData(); this.restoreCachedMenubarData();
}
this.addFallbackHandlers(); this.addFallbackHandlers();
...@@ -396,7 +398,7 @@ export class Menubar { ...@@ -396,7 +398,7 @@ export class Menubar {
private shouldDrawMenu(menuId: string): boolean { private shouldDrawMenu(menuId: string): boolean {
// We need to draw an empty menu to override the electron default // We need to draw an empty menu to override the electron default
if (!isMacintosh && this.configurationService.getValue('window.titleBarStyle') === 'custom') { if (!isMacintosh && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
return false; return false;
} }
......
...@@ -7,8 +7,8 @@ import { TPromise } from 'vs/base/common/winjs.base'; ...@@ -7,8 +7,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { Event, latch, anyEvent } from 'vs/base/common/event'; import { Event, latch, anyEvent } from 'vs/base/common/event';
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { IProcessEnvironment } from 'vs/base/common/platform'; import { IProcessEnvironment, isMacintosh, isWindows } from 'vs/base/common/platform';
import { ParsedArgs } from 'vs/platform/environment/common/environment'; import { ParsedArgs, IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened } from 'vs/platform/history/common/history'; import { IRecentlyOpened } from 'vs/platform/history/common/history';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions'; import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
...@@ -16,6 +16,7 @@ import { ExportData } from 'vs/base/common/performance'; ...@@ -16,6 +16,7 @@ import { ExportData } from 'vs/base/common/performance';
import { LogLevel } from 'vs/platform/log/common/log'; import { LogLevel } from 'vs/platform/log/common/log';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { URI, UriComponents } from 'vs/base/common/uri'; import { URI, UriComponents } from 'vs/base/common/uri';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export const IWindowsService = createDecorator<IWindowsService>('windowsService'); export const IWindowsService = createDecorator<IWindowsService>('windowsService');
...@@ -244,6 +245,39 @@ export interface IWindowSettings { ...@@ -244,6 +245,39 @@ export interface IWindowSettings {
clickThroughInactive: boolean; clickThroughInactive: boolean;
} }
export function getTitleBarStyle(configurationService: IConfigurationService, environment: IEnvironmentService): 'native' | 'custom' {
const configuration = configurationService.getValue<IWindowSettings>('window');
const isDev = !environment.isBuilt || environment.isExtensionDevelopment;
if (isMacintosh && isDev) {
return 'native'; // not enabled when developing due to https://github.com/electron/electron/issues/3647
}
if (configuration) {
const useNativeTabs = isMacintosh && configuration.nativeTabs === true;
if (useNativeTabs) {
return 'native'; // native tabs on sierra do not work with custom title style
}
const useSimpleFullScreen = isMacintosh && configuration.nativeFullScreen === false;
if (useSimpleFullScreen) {
return 'native'; // simple fullscreen does not work well with custom title style (https://github.com/Microsoft/vscode/issues/63291)
}
const smoothScrollingWorkaround = isWindows && configuration.smoothScrollingWorkaround === true;
if (smoothScrollingWorkaround) {
return 'native'; // smooth scrolling workaround does not work with custom title style
}
const style = configuration.titleBarStyle;
if (style === 'native') {
return 'native';
}
}
return 'custom'; // default to custom on all OS
}
export const enum OpenContext { export const enum OpenContext {
// opening when running from the command line // opening when running from the command line
......
...@@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings'; ...@@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings';
import { IMenubarMenu, IMenubarMenuItemAction, IMenubarMenuItemSubmenu, IMenubarKeybinding, IMenubarService, IMenubarData } from 'vs/platform/menubar/common/menubar'; import { IMenubarMenu, IMenubarMenuItemAction, IMenubarMenuItemSubmenu, IMenubarKeybinding, IMenubarService, IMenubarData } from 'vs/platform/menubar/common/menubar';
import { IMenuService, MenuId, IMenu, SubmenuItemAction } from 'vs/platform/actions/common/actions'; import { IMenuService, MenuId, IMenu, SubmenuItemAction } from 'vs/platform/actions/common/actions';
import { registerThemingParticipant, ITheme, ICssStyleCollector, IThemeService } from 'vs/platform/theme/common/themeService'; import { registerThemingParticipant, ITheme, ICssStyleCollector, IThemeService } from 'vs/platform/theme/common/themeService';
import { IWindowService, MenuBarVisibility, IWindowsService } from 'vs/platform/windows/common/windows'; import { IWindowService, MenuBarVisibility, IWindowsService, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ActionRunner, IActionRunner, IAction, Action } from 'vs/base/common/actions'; import { ActionRunner, IActionRunner, IAction, Action } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
...@@ -35,6 +35,7 @@ import { attachMenuStyler } from 'vs/platform/theme/common/styler'; ...@@ -35,6 +35,7 @@ import { attachMenuStyler } from 'vs/platform/theme/common/styler';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
const $ = DOM.$; const $ = DOM.$;
...@@ -130,7 +131,8 @@ export class MenubarControl extends Disposable { ...@@ -130,7 +131,8 @@ export class MenubarControl extends Disposable {
@IUpdateService private updateService: IUpdateService, @IUpdateService private updateService: IUpdateService,
@IStorageService private storageService: IStorageService, @IStorageService private storageService: IStorageService,
@INotificationService private notificationService: INotificationService, @INotificationService private notificationService: INotificationService,
@IPreferencesService private preferencesService: IPreferencesService @IPreferencesService private preferencesService: IPreferencesService,
@IEnvironmentService private environmentService: IEnvironmentService
) { ) {
super(); super();
...@@ -214,7 +216,7 @@ export class MenubarControl extends Disposable { ...@@ -214,7 +216,7 @@ export class MenubarControl extends Disposable {
} }
private get currentTitlebarStyleSetting(): string { private get currentTitlebarStyleSetting(): string {
return this.configurationService.getValue<string>('window.titleBarStyle'); return getTitleBarStyle(this.configurationService, this.environmentService);
} }
private get focusState(): MenubarState { private get focusState(): MenubarState {
......
...@@ -8,7 +8,7 @@ import * as paths from 'vs/base/common/paths'; ...@@ -8,7 +8,7 @@ import * as paths from 'vs/base/common/paths';
import { Part } from 'vs/workbench/browser/part'; import { Part } from 'vs/workbench/browser/part';
import { ITitleService, ITitleProperties } from 'vs/workbench/services/title/common/titleService'; import { ITitleService, ITitleProperties } from 'vs/workbench/services/title/common/titleService';
import { getZoomFactor } from 'vs/base/browser/browser'; import { getZoomFactor } from 'vs/base/browser/browser';
import { IWindowService, IWindowsService, MenuBarVisibility } from 'vs/platform/windows/common/windows'; import { IWindowService, IWindowsService, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import * as errors from 'vs/base/common/errors'; import * as errors from 'vs/base/common/errors';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
...@@ -509,7 +509,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -509,7 +509,7 @@ export class TitlebarPart extends Part implements ITitleService {
} }
layout(dimension: Dimension): Dimension[] { layout(dimension: Dimension): Dimension[] {
if (this.configurationService.getValue<string>('window.titleBarStyle') === 'custom') { if (getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
// Only prevent zooming behavior on macOS or when the menubar is not visible // Only prevent zooming behavior on macOS or when the menubar is not visible
if (isMacintosh || this.configurationService.getValue<MenuBarVisibility>('window.menuBarVisibility') === 'hidden') { if (isMacintosh || this.configurationService.getValue<MenuBarVisibility>('window.menuBarVisibility') === 'hidden') {
this.title.style.zoom = `${1.0 / getZoomFactor()}`; this.title.style.zoom = `${1.0 / getZoomFactor()}`;
......
...@@ -835,7 +835,7 @@ configurationRegistry.registerConfiguration({ ...@@ -835,7 +835,7 @@ configurationRegistry.registerConfiguration({
'type': 'boolean', 'type': 'boolean',
'default': false, 'default': false,
'scope': ConfigurationScope.APPLICATION, 'scope': ConfigurationScope.APPLICATION,
'markdownDescription': nls.localize('window.smoothScrollingWorkaround', "Enable this workaround if scrolling is no longer smooth after restoring a minimized VS Code window. This is a workaround for an issue (https://github.com/Microsoft/vscode/issues/13612) where scrolling starts to lag on devices with precision trackpads like the Surface devices from Microsoft. Enabling this workaround can result in a little bit of layout flickering after restoring the window from minimized state but is otherwise harmless. Note: in order for this workaround to function, make sure to also set `#window.titleBarStyle#` to `native`."), 'markdownDescription': nls.localize('window.smoothScrollingWorkaround', "Enable this workaround if scrolling is no longer smooth after restoring a minimized VS Code window. This is a workaround for an issue (https://github.com/Microsoft/vscode/issues/13612) where scrolling starts to lag on devices with precision trackpads like the Surface devices from Microsoft. Enabling this workaround can result in a little bit of layout flickering after restoring the window from minimized state but is otherwise harmless."),
'included': isWindows 'included': isWindows
}, },
'window.clickThroughInactive': { 'window.clickThroughInactive': {
......
...@@ -75,7 +75,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService'; ...@@ -75,7 +75,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle'; import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
import { LifecycleService } from 'vs/platform/lifecycle/electron-browser/lifecycleService'; import { LifecycleService } from 'vs/platform/lifecycle/electron-browser/lifecycleService';
import { IWindowService, IWindowConfiguration as IWindowSettings, IWindowConfiguration, IPath, MenuBarVisibility } from 'vs/platform/windows/common/windows'; import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar'; import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { IMenuService, SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { IMenuService, SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { MenuService } from 'vs/platform/actions/common/menuService'; import { MenuService } from 'vs/platform/actions/common/menuService';
...@@ -357,7 +357,7 @@ export class Workbench extends Disposable implements IPartService { ...@@ -357,7 +357,7 @@ export class Workbench extends Disposable implements IPartService {
serviceCollection.set(IContextViewService, this.contextViewService); serviceCollection.set(IContextViewService, this.contextViewService);
// Use themable context menus when custom titlebar is enabled to match custom menubar // Use themable context menus when custom titlebar is enabled to match custom menubar
if (!isMacintosh && this.getCustomTitleBarStyle() === 'custom') { if (!isMacintosh && this.useCustomTitleBarStyle()) {
serviceCollection.set(IContextMenuService, new SyncDescriptor(HTMLContextMenuService, [null])); serviceCollection.set(IContextMenuService, new SyncDescriptor(HTMLContextMenuService, [null]));
} else { } else {
serviceCollection.set(IContextMenuService, new SyncDescriptor(NativeContextMenuService)); serviceCollection.set(IContextMenuService, new SyncDescriptor(NativeContextMenuService));
...@@ -522,8 +522,7 @@ export class Workbench extends Disposable implements IPartService { ...@@ -522,8 +522,7 @@ export class Workbench extends Disposable implements IPartService {
} }
// Changing fullscreen state of the window has an impact on custom title bar visibility, so we need to update // Changing fullscreen state of the window has an impact on custom title bar visibility, so we need to update
const hasCustomTitle = this.getCustomTitleBarStyle() === 'custom'; if (this.useCustomTitleBarStyle()) {
if (hasCustomTitle) {
this._onTitleBarVisibilityChange.fire(); this._onTitleBarVisibilityChange.fire();
this.layout(); // handle title bar when fullscreen changes this.layout(); // handle title bar when fullscreen changes
} }
...@@ -933,26 +932,8 @@ export class Workbench extends Disposable implements IPartService { ...@@ -933,26 +932,8 @@ export class Workbench extends Disposable implements IPartService {
this.panelPosition = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM; this.panelPosition = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM;
} }
private getCustomTitleBarStyle(): 'custom' { private useCustomTitleBarStyle(): boolean {
const isDev = !this.environmentService.isBuilt || this.environmentService.isExtensionDevelopment; return getTitleBarStyle(this.configurationService, this.environmentService) === 'custom';
if (isMacintosh && isDev) {
return null; // not enabled when developing due to https://github.com/electron/electron/issues/3647
}
const windowConfig = this.configurationService.getValue<IWindowSettings>();
if (windowConfig && windowConfig.window) {
const useNativeTabs = isMacintosh && windowConfig.window.nativeTabs;
if (useNativeTabs) {
return null; // native tabs on sierra do not work with custom title style
}
const style = windowConfig.window.titleBarStyle;
if (style === 'custom') {
return style;
}
}
return null;
} }
private setStatusBarHidden(hidden: boolean, skipLayout?: boolean): void { private setStatusBarHidden(hidden: boolean, skipLayout?: boolean): void {
...@@ -1039,7 +1020,7 @@ export class Workbench extends Disposable implements IPartService { ...@@ -1039,7 +1020,7 @@ export class Workbench extends Disposable implements IPartService {
// Menubar visibility changes // Menubar visibility changes
if ((isWindows || isLinux) && this.getCustomTitleBarStyle() === 'custom') { if ((isWindows || isLinux) && this.useCustomTitleBarStyle()) {
this.titlebarPart.onMenubarVisibilityChange()(e => this.onMenubarToggled(e)); this.titlebarPart.onMenubarVisibilityChange()(e => this.onMenubarToggled(e));
} }
...@@ -1205,7 +1186,7 @@ export class Workbench extends Disposable implements IPartService { ...@@ -1205,7 +1186,7 @@ export class Workbench extends Disposable implements IPartService {
isVisible(part: Parts): boolean { isVisible(part: Parts): boolean {
switch (part) { switch (part) {
case Parts.TITLEBAR_PART: case Parts.TITLEBAR_PART:
if (this.getCustomTitleBarStyle() !== 'custom') { if (!this.useCustomTitleBarStyle()) {
return false; return false;
} else if (!browser.isFullscreen()) { } else if (!browser.isFullscreen()) {
return true; return true;
......
...@@ -60,6 +60,7 @@ function createProxyAgent( ...@@ -60,6 +60,7 @@ function createProxyAgent(
extHostWorkspace.resolveProxy(url) extHostWorkspace.resolveProxy(url)
.then(proxy => { .then(proxy => {
callback(proxy); callback(proxy);
extHostLogService.info('ProxyResolver#resolveProxy', url, proxy);
}).then(() => { }).then(() => {
count++; count++;
duration = Date.now() - start + duration; duration = Date.now() - start + duration;
......
...@@ -29,9 +29,21 @@ ...@@ -29,9 +29,21 @@
margin-left: 17px; margin-left: 17px;
} }
.search-view .search-widget .input-box, .search-view .search-widget .monaco-inputbox > .wrapper {
.search-view .search-widget .input-box .monaco-inputbox { height: 100%;
height: 25px; }
.search-view .search-widget .monaco-inputbox > .wrapper > .mirror {
max-height: 134px;
}
.search-view .monaco-inputbox > .wrapper > textarea.input {
overflow: initial;
height: 26px; /* set initial height before measure */
}
.search-view .monaco-inputbox > .wrapper > textarea.input::-webkit-scrollbar {
display: none;
} }
.search-view .search-widget .monaco-findInput { .search-view .search-widget .monaco-findInput {
...@@ -39,6 +51,10 @@ ...@@ -39,6 +51,10 @@
vertical-align: middle; vertical-align: middle;
} }
.search-view .search-widget .monaco-findInput > .controls {
top: 4px; /* Adjust controls, search view input box is slighty taller than find widget due to measurement */
}
.search-view .search-widget .replace-container { .search-view .search-widget .replace-container {
margin-top: 6px; margin-top: 6px;
position: relative; position: relative;
......
...@@ -281,7 +281,8 @@ export class SearchWidget extends Widget { ...@@ -281,7 +281,8 @@ export class SearchWidget extends Widget {
appendCaseSensitiveLabel: appendKeyBindingLabel('', this.keyBindingService.lookupKeybinding(Constants.ToggleCaseSensitiveCommandId), this.keyBindingService), appendCaseSensitiveLabel: appendKeyBindingLabel('', this.keyBindingService.lookupKeybinding(Constants.ToggleCaseSensitiveCommandId), this.keyBindingService),
appendWholeWordsLabel: appendKeyBindingLabel('', this.keyBindingService.lookupKeybinding(Constants.ToggleWholeWordCommandId), this.keyBindingService), appendWholeWordsLabel: appendKeyBindingLabel('', this.keyBindingService.lookupKeybinding(Constants.ToggleWholeWordCommandId), this.keyBindingService),
appendRegexLabel: appendKeyBindingLabel('', this.keyBindingService.lookupKeybinding(Constants.ToggleRegexCommandId), this.keyBindingService), appendRegexLabel: appendKeyBindingLabel('', this.keyBindingService.lookupKeybinding(Constants.ToggleRegexCommandId), this.keyBindingService),
history: options.searchHistory history: options.searchHistory,
flexibleHeight: true
}; };
let searchInputContainer = dom.append(parent, dom.$('.search-container.input-box')); let searchInputContainer = dom.append(parent, dom.$('.search-container.input-box'));
...@@ -329,7 +330,8 @@ export class SearchWidget extends Widget { ...@@ -329,7 +330,8 @@ export class SearchWidget extends Widget {
this.replaceInput = this._register(new ContextScopedHistoryInputBox(replaceBox, this.contextViewService, { this.replaceInput = this._register(new ContextScopedHistoryInputBox(replaceBox, this.contextViewService, {
ariaLabel: nls.localize('label.Replace', 'Replace: Type replace term and press Enter to preview or Escape to cancel'), ariaLabel: nls.localize('label.Replace', 'Replace: Type replace term and press Enter to preview or Escape to cancel'),
placeholder: nls.localize('search.replace.placeHolder', "Replace"), placeholder: nls.localize('search.replace.placeHolder', "Replace"),
history: options.replaceHistory || [] history: options.replaceHistory || [],
flexibleHeight: true
}, this.contextKeyService)); }, this.contextKeyService));
this._register(attachInputBoxStyler(this.replaceInput, this.themeService)); this._register(attachInputBoxStyler(this.replaceInput, this.themeService));
this.onkeydown(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyDown(keyboardEvent)); this.onkeydown(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyDown(keyboardEvent));
...@@ -376,6 +378,7 @@ export class SearchWidget extends Widget { ...@@ -376,6 +378,7 @@ export class SearchWidget extends Widget {
if (currentState !== newState) { if (currentState !== newState) {
this.replaceActive.set(newState); this.replaceActive.set(newState);
this._onReplaceStateChange.fire(newState); this._onReplaceStateChange.fire(newState);
this.replaceInput.layout();
} }
} }
...@@ -429,6 +432,20 @@ export class SearchWidget extends Widget { ...@@ -429,6 +432,20 @@ export class SearchWidget extends Widget {
} }
keyboardEvent.preventDefault(); keyboardEvent.preventDefault();
} }
else if (keyboardEvent.equals(KeyCode.UpArrow)) {
const ta = this.searchInput.domNode.querySelector('textarea');
if (ta && ta.selectionStart > 0) {
keyboardEvent.stopPropagation();
}
}
else if (keyboardEvent.equals(KeyCode.DownArrow)) {
const ta = this.searchInput.domNode.querySelector('textarea');
if (ta && ta.selectionEnd < ta.value.length) {
keyboardEvent.stopPropagation();
}
}
} }
private onCaseSensitiveKeyDown(keyboardEvent: IKeyboardEvent) { private onCaseSensitiveKeyDown(keyboardEvent: IKeyboardEvent) {
...@@ -466,6 +483,20 @@ export class SearchWidget extends Widget { ...@@ -466,6 +483,20 @@ export class SearchWidget extends Widget {
this.searchInput.focus(); this.searchInput.focus();
keyboardEvent.preventDefault(); keyboardEvent.preventDefault();
} }
else if (keyboardEvent.equals(KeyCode.UpArrow)) {
const ta = this.searchInput.domNode.querySelector('textarea');
if (ta && ta.selectionStart > 0) {
keyboardEvent.stopPropagation();
}
}
else if (keyboardEvent.equals(KeyCode.DownArrow)) {
const ta = this.searchInput.domNode.querySelector('textarea');
if (ta && ta.selectionEnd < ta.value.length) {
keyboardEvent.stopPropagation();
}
}
} }
private onReplaceActionbarKeyDown(keyboardEvent: IKeyboardEvent) { private onReplaceActionbarKeyDown(keyboardEvent: IKeyboardEvent) {
......
...@@ -67,10 +67,8 @@ export class QueryBuilder { ...@@ -67,10 +67,8 @@ export class QueryBuilder {
) { } ) { }
text(contentPattern: IPatternInfo, folderResources?: uri[], options: ITextQueryBuilderOptions = {}): ITextQuery { text(contentPattern: IPatternInfo, folderResources?: uri[], options: ITextQueryBuilderOptions = {}): ITextQuery {
contentPattern.isCaseSensitive = this.isCaseSensitive(contentPattern); contentPattern = this.getContentPattern(contentPattern);
contentPattern.isMultiline = this.isMultiline(contentPattern);
const searchConfig = this.configurationService.getValue<ISearchConfiguration>(); const searchConfig = this.configurationService.getValue<ISearchConfiguration>();
contentPattern.wordSeparators = searchConfig.editor.wordSeparators;
const fallbackToPCRE = folderResources && folderResources.some(folder => { const fallbackToPCRE = folderResources && folderResources.some(folder => {
const folderConfig = this.configurationService.getValue<ISearchConfiguration>({ resource: folder }); const folderConfig = this.configurationService.getValue<ISearchConfiguration>({ resource: folder });
...@@ -91,6 +89,28 @@ export class QueryBuilder { ...@@ -91,6 +89,28 @@ export class QueryBuilder {
}; };
} }
/**
* Adjusts input pattern for config
*/
private getContentPattern(inputPattern: IPatternInfo): IPatternInfo {
const searchConfig = this.configurationService.getValue<ISearchConfiguration>();
const newPattern = {
...inputPattern,
wordSeparators: searchConfig.editor.wordSeparators
};
if (this.isCaseSensitive(inputPattern)) {
newPattern.isCaseSensitive = true;
}
if (this.isMultiline(inputPattern)) {
newPattern.isMultiline = true;
}
return newPattern;
}
file(folderResources: uri[] | undefined, options: IFileQueryBuilderOptions = {}): IFileQuery { file(folderResources: uri[] | undefined, options: IFileQueryBuilderOptions = {}): IFileQuery {
const commonQuery = this.commonQuery(folderResources, options); const commonQuery = this.commonQuery(folderResources, options);
return <IFileQuery>{ return <IFileQuery>{
...@@ -165,6 +185,10 @@ export class QueryBuilder { ...@@ -165,6 +185,10 @@ export class QueryBuilder {
return true; return true;
} }
if (contentPattern.pattern.indexOf('\n') >= 0) {
return true;
}
return false; return false;
} }
......
...@@ -7,7 +7,7 @@ import * as cp from 'child_process'; ...@@ -7,7 +7,7 @@ import * as cp from 'child_process';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import * as path from 'path'; import * as path from 'path';
import { NodeStringDecoder, StringDecoder } from 'string_decoder'; import { NodeStringDecoder, StringDecoder } from 'string_decoder';
import { createRegExp, startsWith, startsWithUTF8BOM, stripUTF8BOM } from 'vs/base/common/strings'; import { createRegExp, startsWith, startsWithUTF8BOM, stripUTF8BOM, escapeRegExpCharacters } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { IExtendedExtensionSearchOptions, SearchError, SearchErrorCode, serializeSearchError } from 'vs/platform/search/common/search'; import { IExtendedExtensionSearchOptions, SearchError, SearchErrorCode, serializeSearchError } from 'vs/platform/search/common/search';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
...@@ -343,6 +343,11 @@ function getRgArgs(query: vscode.TextSearchQuery, options: vscode.TextSearchOpti ...@@ -343,6 +343,11 @@ function getRgArgs(query: vscode.TextSearchQuery, options: vscode.TextSearchOpti
pattern = '\\-\\-'; pattern = '\\-\\-';
} }
if (query.isMultiline && !query.isRegExp) {
query.pattern = escapeRegExpCharacters(query.pattern);
query.isRegExp = true;
}
if ((<IExtendedExtensionSearchOptions>options).usePCRE2) { if ((<IExtendedExtensionSearchOptions>options).usePCRE2) {
args.push('--pcre2'); args.push('--pcre2');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册