mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 16:50:30 -04:00
Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5
This commit is contained in:
@@ -51,7 +51,7 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
|
||||
return;
|
||||
}
|
||||
if (this._terminal.buffer.cursorX >= MINIMUM_PROMPT_LENGTH) {
|
||||
this._terminal.addMarker(0);
|
||||
this._terminal.registerMarker(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,13 +233,13 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
|
||||
}
|
||||
|
||||
if (this._currentMarker === Boundary.Bottom) {
|
||||
this._currentMarker = xterm.addMarker(this._getOffset(xterm) - 1);
|
||||
this._currentMarker = xterm.registerMarker(this._getOffset(xterm) - 1);
|
||||
} else {
|
||||
const offset = this._getOffset(xterm);
|
||||
if (this._isDisposable) {
|
||||
this._currentMarker.dispose();
|
||||
}
|
||||
this._currentMarker = xterm.addMarker(offset - 1);
|
||||
this._currentMarker = xterm.registerMarker(offset - 1);
|
||||
}
|
||||
this._isDisposable = true;
|
||||
this._scrollToMarker(this._currentMarker, scrollPosition);
|
||||
@@ -256,13 +256,13 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
|
||||
}
|
||||
|
||||
if (this._currentMarker === Boundary.Top) {
|
||||
this._currentMarker = xterm.addMarker(this._getOffset(xterm) + 1);
|
||||
this._currentMarker = xterm.registerMarker(this._getOffset(xterm) + 1);
|
||||
} else {
|
||||
const offset = this._getOffset(xterm);
|
||||
if (this._isDisposable) {
|
||||
this._currentMarker.dispose();
|
||||
}
|
||||
this._currentMarker = xterm.addMarker(offset + 1);
|
||||
this._currentMarker = xterm.registerMarker(offset + 1);
|
||||
}
|
||||
this._isDisposable = true;
|
||||
this._scrollToMarker(this._currentMarker, scrollPosition);
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 9.9 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 9.9 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 9.9 KiB |
@@ -155,15 +155,3 @@
|
||||
.xterm.xterm-cursor-pointer {
|
||||
cursor: pointer!important;
|
||||
}
|
||||
|
||||
.monaco-workbench .quick-open-terminal-configure {
|
||||
background-image: url('configure-light.svg');
|
||||
}
|
||||
|
||||
.vs-dark .monaco-workbench .quick-open-terminal-configure {
|
||||
background-image: url('configure-dark.svg');
|
||||
}
|
||||
|
||||
.hc-black .monaco-workbench .quick-open-terminal-configure {
|
||||
background-image: url('configure-hc.svg');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'vs/css!./media/terminal';
|
||||
import 'vs/css!./media/widgets';
|
||||
import 'vs/css!./media/xterm';
|
||||
import * as nls from 'vs/nls';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { SyncActionDescriptor, registerAction2 } from 'vs/platform/actions/common/actions';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
@@ -20,7 +20,7 @@ import * as panel from 'vs/workbench/browser/panel';
|
||||
import { getQuickNavigateHandler } from 'vs/workbench/browser/parts/quickopen/quickopen';
|
||||
import { Extensions as QuickOpenExtensions, IQuickOpenRegistry, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
|
||||
import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
|
||||
import { ClearSelectionTerminalAction, ClearTerminalAction, CopyTerminalSelectionAction, CreateNewInActiveWorkspaceTerminalAction, CreateNewTerminalAction, DeleteToLineStartTerminalAction, DeleteWordLeftTerminalAction, DeleteWordRightTerminalAction, FindNext, FindPrevious, FocusActiveTerminalAction, FocusNextPaneTerminalAction, FocusNextTerminalAction, FocusPreviousPaneTerminalAction, FocusPreviousTerminalAction, FocusTerminalFindWidgetAction, HideTerminalFindWidgetAction, KillTerminalAction, MoveToLineEndTerminalAction, MoveToLineStartTerminalAction, QuickOpenActionTermContributor, QuickOpenTermAction, RenameTerminalAction, ResizePaneDownTerminalAction, ResizePaneLeftTerminalAction, ResizePaneRightTerminalAction, ResizePaneUpTerminalAction, RunActiveFileInTerminalAction, RunSelectedTextInTerminalAction, ScrollDownPageTerminalAction, ScrollDownTerminalAction, ScrollToBottomTerminalAction, ScrollToNextCommandAction, ScrollToPreviousCommandAction, ScrollToTopTerminalAction, ScrollUpPageTerminalAction, ScrollUpTerminalAction, SelectAllTerminalAction, SelectDefaultShellWindowsTerminalAction, SelectToNextCommandAction, SelectToNextLineAction, SelectToPreviousCommandAction, SelectToPreviousLineAction, SendSequenceTerminalCommand, SplitInActiveWorkspaceTerminalAction, SplitTerminalAction, TerminalPasteAction, TERMINAL_PICKER_PREFIX, ToggleCaseSensitiveCommand, ToggleEscapeSequenceLoggingAction, ToggleRegexCommand, ToggleTerminalAction, ToggleWholeWordCommand, NavigationModeFocusPreviousTerminalAction, NavigationModeFocusNextTerminalAction, NavigationModeExitTerminalAction, ManageWorkspaceShellPermissionsTerminalCommand, CreateNewWithCwdTerminalCommand, RenameWithArgTerminalCommand } from 'vs/workbench/contrib/terminal/browser/terminalActions';
|
||||
import { ClearSelectionTerminalAction, ClearTerminalAction, CopyTerminalSelectionAction, CreateNewInActiveWorkspaceTerminalAction, CreateNewTerminalAction, DeleteToLineStartTerminalAction, DeleteWordLeftTerminalAction, DeleteWordRightTerminalAction, FindNext, FindPrevious, FocusActiveTerminalAction, FocusNextPaneTerminalAction, FocusNextTerminalAction, FocusPreviousPaneTerminalAction, FocusPreviousTerminalAction, FocusTerminalFindWidgetAction, HideTerminalFindWidgetAction, KillTerminalAction, MoveToLineEndTerminalAction, MoveToLineStartTerminalAction, QuickOpenActionTermContributor, QuickOpenTermAction, RenameTerminalAction, ResizePaneDownTerminalAction, ResizePaneLeftTerminalAction, ResizePaneRightTerminalAction, ResizePaneUpTerminalAction, RunActiveFileInTerminalAction, RunSelectedTextInTerminalAction, ScrollDownPageTerminalAction, ScrollDownTerminalAction, ScrollToBottomTerminalAction, ScrollToNextCommandAction, ScrollToPreviousCommandAction, ScrollToTopTerminalAction, ScrollUpPageTerminalAction, ScrollUpTerminalAction, SelectAllTerminalAction, SelectDefaultShellWindowsTerminalAction, SelectToNextCommandAction, SelectToNextLineAction, SelectToPreviousCommandAction, SelectToPreviousLineAction, SplitInActiveWorkspaceTerminalAction, SplitTerminalAction, TerminalPasteAction, TERMINAL_PICKER_PREFIX, ToggleCaseSensitiveCommand, ToggleEscapeSequenceLoggingAction, ToggleRegexCommand, ToggleTerminalAction, ToggleWholeWordCommand, NavigationModeFocusPreviousTerminalAction, NavigationModeFocusNextTerminalAction, NavigationModeExitTerminalAction, ManageWorkspaceShellPermissionsTerminalCommand, CreateNewWithCwdTerminalAction, RenameWithArgTerminalAction, SendSequenceTerminalAction } from 'vs/workbench/contrib/terminal/browser/terminalActions';
|
||||
import { TerminalPanel } from 'vs/workbench/contrib/terminal/browser/terminalPanel';
|
||||
import { TerminalPickerHandler } from 'vs/workbench/contrib/terminal/browser/terminalQuickOpen';
|
||||
import { KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_NOT_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, TerminalCursorStyle, TERMINAL_ACTION_CATEGORY, KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS, TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
@@ -343,6 +343,16 @@ configurationRegistry.registerConfiguration({
|
||||
description: nls.localize('terminal.integrated.enableFileLinks', "Whether to enable file links in the terminal. Links can be slow when working on a network drive in particular because each file link is verified against the file system."),
|
||||
type: 'boolean',
|
||||
default: true
|
||||
},
|
||||
'terminal.integrated.unicodeVersion': {
|
||||
type: 'string',
|
||||
enum: ['6', '11'],
|
||||
enumDescriptions: [
|
||||
nls.localize('terminal.integrated.unicodeVersion.six', "Version 6 of unicode, this is an older version which should work better on older systems."),
|
||||
nls.localize('terminal.integrated.unicodeVersion.eleven', "Version 11 of unicode, this version provides better support on modern systems that use modern versions of unicode.")
|
||||
],
|
||||
default: '11',
|
||||
description: nls.localize('terminal.integrated.unicodeVersion', "Controls what version of unicode to use when evaluating the width of characters in the terminal. If you experience emoji or other wide characters not taking up the right amount of space or backspace either deleting too much or too little then you may want to try tweaking this setting.")
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -588,66 +598,77 @@ if (BrowserFeatures.clipboard.readText) {
|
||||
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_V }
|
||||
}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Paste into Active Terminal', category);
|
||||
}
|
||||
(new SendSequenceTerminalCommand({
|
||||
id: SendSequenceTerminalCommand.ID,
|
||||
precondition: undefined,
|
||||
description: {
|
||||
description: SendSequenceTerminalCommand.LABEL,
|
||||
args: [{
|
||||
name: 'args',
|
||||
schema: {
|
||||
type: 'object',
|
||||
required: ['text'],
|
||||
properties: {
|
||||
text: { type: 'string' }
|
||||
},
|
||||
}
|
||||
}]
|
||||
}
|
||||
})).register();
|
||||
|
||||
(new CreateNewWithCwdTerminalCommand({
|
||||
id: CreateNewWithCwdTerminalCommand.ID,
|
||||
precondition: undefined,
|
||||
description: {
|
||||
description: CreateNewWithCwdTerminalCommand.LABEL,
|
||||
args: [{
|
||||
name: 'args',
|
||||
schema: {
|
||||
type: 'object',
|
||||
required: ['cwd'],
|
||||
properties: {
|
||||
cwd: {
|
||||
description: CreateNewWithCwdTerminalCommand.CWD_ARG_LABEL,
|
||||
type: 'string'
|
||||
registerAction2(class extends SendSequenceTerminalAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: SendSequenceTerminalAction.ID,
|
||||
title: SendSequenceTerminalAction.LABEL,
|
||||
description: {
|
||||
description: SendSequenceTerminalAction.LABEL,
|
||||
args: [{
|
||||
name: 'args',
|
||||
schema: {
|
||||
type: 'object',
|
||||
required: ['text'],
|
||||
properties: {
|
||||
text: { type: 'string' }
|
||||
},
|
||||
}
|
||||
},
|
||||
}]
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
})).register();
|
||||
|
||||
(new RenameWithArgTerminalCommand({
|
||||
id: RenameWithArgTerminalCommand.ID,
|
||||
precondition: undefined,
|
||||
description: {
|
||||
description: RenameWithArgTerminalCommand.LABEL,
|
||||
args: [{
|
||||
name: 'args',
|
||||
schema: {
|
||||
type: 'object',
|
||||
required: ['name'],
|
||||
properties: {
|
||||
name: {
|
||||
description: RenameWithArgTerminalCommand.NAME_ARG_LABEL,
|
||||
type: 'string',
|
||||
minLength: 1
|
||||
});
|
||||
registerAction2(class extends CreateNewWithCwdTerminalAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: CreateNewWithCwdTerminalAction.ID,
|
||||
title: CreateNewWithCwdTerminalAction.LABEL,
|
||||
description: {
|
||||
description: CreateNewWithCwdTerminalAction.LABEL,
|
||||
args: [{
|
||||
name: 'args',
|
||||
schema: {
|
||||
type: 'object',
|
||||
required: ['cwd'],
|
||||
properties: {
|
||||
cwd: {
|
||||
description: CreateNewWithCwdTerminalAction.CWD_ARG_LABEL,
|
||||
type: 'string'
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
})).register();
|
||||
});
|
||||
registerAction2(class extends RenameWithArgTerminalAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: RenameWithArgTerminalAction.ID,
|
||||
title: RenameWithArgTerminalAction.LABEL,
|
||||
description: {
|
||||
description: RenameWithArgTerminalAction.LABEL,
|
||||
args: [{
|
||||
name: 'args',
|
||||
schema: {
|
||||
type: 'object',
|
||||
required: ['name'],
|
||||
properties: {
|
||||
name: {
|
||||
description: RenameWithArgTerminalAction.NAME_ARG_LABEL,
|
||||
type: 'string',
|
||||
minLength: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
setupTerminalCommands();
|
||||
setupTerminalMenu();
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Terminal as XTermTerminal } from 'xterm';
|
||||
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
|
||||
import { Unicode11Addon as XTermUnicode11Addon } from 'xterm-addon-unicode11';
|
||||
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl';
|
||||
import { IWindowsShellHelper, ITerminalConfigHelper, ITerminalChildProcess, IShellLaunchConfig, IDefaultShellAndArgsRequest, ISpawnExtHostProcessRequest, IStartExtensionTerminalRequest, IAvailableShellsRequest, ITerminalProcessExtHostProxy, ICommandTracker, INavigationMode, TitleEventSource, ITerminalDimensions } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -30,8 +31,9 @@ export interface ITerminalInstanceService {
|
||||
onRequestDefaultShellAndArgs?: Event<IDefaultShellAndArgsRequest>;
|
||||
|
||||
getXtermConstructor(): Promise<typeof XTermTerminal>;
|
||||
getXtermWebLinksConstructor(): Promise<typeof XTermWebLinksAddon>;
|
||||
getXtermSearchConstructor(): Promise<typeof XTermSearchAddon>;
|
||||
getXtermUnicode11Constructor(): Promise<typeof XTermUnicode11Addon>;
|
||||
getXtermWebLinksConstructor(): Promise<typeof XTermWebLinksAddon>;
|
||||
getXtermWebglConstructor(): Promise<typeof XTermWebglAddon>;
|
||||
createWindowsShellHelper(shellProcessId: number, instance: ITerminalInstance, xterm: XTermTerminal): IWindowsShellHelper;
|
||||
createTerminalProcess(shellLaunchConfig: IShellLaunchConfig, cwd: string, cols: number, rows: number, env: IProcessEnvironment, windowsEnableConpty: boolean): ITerminalChildProcess;
|
||||
|
||||
@@ -24,7 +24,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { Command } from 'vs/editor/browser/editorExtensions';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
|
||||
import { ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
@@ -35,6 +34,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { ITerminalInstance, ITerminalService, Direction } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { Action2 } from 'vs/platform/actions/common/actions';
|
||||
|
||||
export const TERMINAL_PICKER_PREFIX = 'term ';
|
||||
|
||||
@@ -278,11 +278,11 @@ export class MoveToLineEndTerminalAction extends BaseSendTextTerminalAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class SendSequenceTerminalCommand extends Command {
|
||||
export class SendSequenceTerminalAction extends Action2 {
|
||||
public static readonly ID = TERMINAL_COMMAND_ID.SEND_SEQUENCE;
|
||||
public static readonly LABEL = nls.localize('workbench.action.terminal.sendSequence', "Send Custom Sequence To Terminal");
|
||||
|
||||
public runCommand(accessor: ServicesAccessor, args: any): void {
|
||||
public run(accessor: ServicesAccessor, args: any): void {
|
||||
const terminalInstance = accessor.get(ITerminalService).getActiveInstance();
|
||||
if (!terminalInstance) {
|
||||
return;
|
||||
@@ -298,12 +298,12 @@ export class SendSequenceTerminalCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
export class CreateNewWithCwdTerminalCommand extends Command {
|
||||
export class CreateNewWithCwdTerminalAction extends Action2 {
|
||||
public static readonly ID = TERMINAL_COMMAND_ID.NEW_WITH_CWD;
|
||||
public static readonly LABEL = nls.localize('workbench.action.terminal.newWithCwd', "Create New Integrated Terminal Starting in a Custom Working Directory");
|
||||
public static readonly CWD_ARG_LABEL = nls.localize('workbench.action.terminal.newWithCwd.cwd', "The directory to start the terminal at");
|
||||
|
||||
public runCommand(accessor: ServicesAccessor, args: { cwd: string } | undefined): Promise<void> {
|
||||
public run(accessor: ServicesAccessor, args: { cwd: string } | undefined): Promise<void> {
|
||||
const terminalService = accessor.get(ITerminalService);
|
||||
const instance = terminalService.createTerminal({ cwd: args?.cwd });
|
||||
if (!instance) {
|
||||
@@ -1055,12 +1055,12 @@ export class RenameTerminalAction extends Action {
|
||||
});
|
||||
}
|
||||
}
|
||||
export class RenameWithArgTerminalCommand extends Command {
|
||||
export class RenameWithArgTerminalAction extends Action2 {
|
||||
public static readonly ID = TERMINAL_COMMAND_ID.RENAME_WITH_ARG;
|
||||
public static readonly LABEL = nls.localize('workbench.action.terminal.renameWithArg', "Rename the Currently Active Terminal");
|
||||
public static readonly NAME_ARG_LABEL = nls.localize('workbench.action.terminal.renameWithArg.name', "The new name for the terminal");
|
||||
|
||||
public runCommand(
|
||||
public run(
|
||||
accessor: ServicesAccessor,
|
||||
args?: { name?: string }
|
||||
): void {
|
||||
@@ -1165,7 +1165,7 @@ export class RenameTerminalQuickOpenAction extends RenameTerminalAction {
|
||||
@ITerminalService terminalService: ITerminalService
|
||||
) {
|
||||
super(id, label, quickOpenService, quickInputService, terminalService);
|
||||
this.class = 'quick-open-terminal-configure';
|
||||
this.class = 'codicon codicon-gear';
|
||||
}
|
||||
|
||||
public run(): Promise<any> {
|
||||
|
||||
@@ -35,6 +35,7 @@ import { ITerminalInstanceService, ITerminalInstance, TerminalShellType } from '
|
||||
import { TerminalProcessManager } from 'vs/workbench/contrib/terminal/browser/terminalProcessManager';
|
||||
import { Terminal as XTermTerminal, IBuffer, ITerminalAddon } from 'xterm';
|
||||
import { SearchAddon, ISearchOptions } from 'xterm-addon-search';
|
||||
import { Unicode11Addon } from 'xterm-addon-unicode11';
|
||||
import { CommandTrackerAddon } from 'vs/workbench/contrib/terminal/browser/addons/commandTrackerAddon';
|
||||
import { NavigationModeAddon } from 'vs/workbench/contrib/terminal/browser/addons/navigationModeAddon';
|
||||
import { XTermCore } from 'vs/workbench/contrib/terminal/browser/xterm-private';
|
||||
@@ -148,7 +149,9 @@ export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [
|
||||
'workbench.action.openNextRecentlyUsedEditorInGroup',
|
||||
'workbench.action.openPreviousRecentlyUsedEditorInGroup',
|
||||
'workbench.action.quickOpenPreviousRecentlyUsedEditor',
|
||||
'workbench.action.quickOpenLeastRecentlyUsedEditor',
|
||||
'workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup',
|
||||
'workbench.action.quickOpenLeastRecentlyUsedEditorInGroup',
|
||||
'workbench.action.focusActiveEditorGroup',
|
||||
'workbench.action.focusFirstEditorGroup',
|
||||
'workbench.action.focusLastEditorGroup',
|
||||
@@ -198,6 +201,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
private _xterm: XTermTerminal | undefined;
|
||||
private _xtermCore: XTermCore | undefined;
|
||||
private _xtermSearch: SearchAddon | undefined;
|
||||
private _xtermUnicode11: Unicode11Addon | undefined;
|
||||
private _xtermElement: HTMLDivElement | undefined;
|
||||
private _terminalHasTextContextKey: IContextKey<boolean>;
|
||||
private _terminalA11yTreeFocusContextKey: IContextKey<boolean>;
|
||||
@@ -326,6 +330,9 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
// supported.
|
||||
this.setVisible(this._isVisible);
|
||||
}
|
||||
if (e.affectsConfiguration('terminal.integrated.unicodeVersion')) {
|
||||
this._updateUnicodeVersion();
|
||||
}
|
||||
if (e.affectsConfiguration('editor.accessibilitySupport')) {
|
||||
this.updateAccessibilitySupport();
|
||||
}
|
||||
@@ -482,6 +489,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
});
|
||||
this._xterm = xterm;
|
||||
this._xtermCore = (xterm as any)._core as XTermCore;
|
||||
this._updateUnicodeVersion();
|
||||
this.updateAccessibilitySupport();
|
||||
this._terminalInstanceService.getXtermSearchConstructor().then(Addon => {
|
||||
this._xtermSearch = new Addon();
|
||||
@@ -509,7 +517,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
// Force line data to be sent when the cursor is moved, the main purpose for
|
||||
// this is because ConPTY will often not do a line feed but instead move the
|
||||
// cursor, in which case we still want to send the current line's data to tasks.
|
||||
xterm.parser.addCsiHandler({ final: 'H' }, () => {
|
||||
xterm.parser.registerCsiHandler({ final: 'H' }, () => {
|
||||
this._onCursorMove();
|
||||
return false;
|
||||
});
|
||||
@@ -793,9 +801,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
|
||||
dispose(this._windowsShellHelper);
|
||||
this._windowsShellHelper = undefined;
|
||||
this._linkHandler = dispose(this._linkHandler);
|
||||
this._commandTrackerAddon = dispose(this._commandTrackerAddon);
|
||||
this._widgetManager = dispose(this._widgetManager);
|
||||
dispose(this._linkHandler);
|
||||
this._linkHandler = undefined;
|
||||
dispose(this._commandTrackerAddon);
|
||||
this._commandTrackerAddon = undefined;
|
||||
dispose(this._widgetManager);
|
||||
this._widgetManager = undefined;
|
||||
|
||||
if (this._xterm && this._xterm.element) {
|
||||
this._hadFocusOnExit = dom.hasClass(this._xterm.element, 'focus');
|
||||
@@ -1237,6 +1248,18 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
}
|
||||
}
|
||||
|
||||
private async _updateUnicodeVersion(): Promise<void> {
|
||||
if (!this._xterm) {
|
||||
throw new Error('Cannot update unicode version before xterm has been initialized');
|
||||
}
|
||||
if (!this._xtermUnicode11 && this._configHelper.config.unicodeVersion === '11') {
|
||||
const Addon = await this._terminalInstanceService.getXtermUnicode11Constructor();
|
||||
this._xtermUnicode11 = new Addon();
|
||||
this._xterm.loadAddon(this._xtermUnicode11);
|
||||
}
|
||||
this._xterm.unicode.activeVersion = this._configHelper.config.unicodeVersion;
|
||||
}
|
||||
|
||||
public updateAccessibilitySupport(): void {
|
||||
const isEnabled = this._accessibilityService.isScreenReaderOptimized();
|
||||
if (isEnabled) {
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { IWindowsShellHelper, ITerminalChildProcess, IDefaultShellAndArgsRequest } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { Terminal as XTermTerminal } from 'xterm';
|
||||
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
|
||||
import { Unicode11Addon as XTermUnicode11Addon } from 'xterm-addon-unicode11';
|
||||
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
||||
let Terminal: typeof XTermTerminal;
|
||||
let WebLinksAddon: typeof XTermWebLinksAddon;
|
||||
let SearchAddon: typeof XTermSearchAddon;
|
||||
let Unicode11Addon: typeof XTermUnicode11Addon;
|
||||
let WebLinksAddon: typeof XTermWebLinksAddon;
|
||||
let WebglAddon: typeof XTermWebglAddon;
|
||||
|
||||
export class TerminalInstanceService implements ITerminalInstanceService {
|
||||
@@ -31,13 +33,6 @@ export class TerminalInstanceService implements ITerminalInstanceService {
|
||||
return Terminal;
|
||||
}
|
||||
|
||||
public async getXtermWebLinksConstructor(): Promise<typeof XTermWebLinksAddon> {
|
||||
if (!WebLinksAddon) {
|
||||
WebLinksAddon = (await import('xterm-addon-web-links')).WebLinksAddon;
|
||||
}
|
||||
return WebLinksAddon;
|
||||
}
|
||||
|
||||
public async getXtermSearchConstructor(): Promise<typeof XTermSearchAddon> {
|
||||
if (!SearchAddon) {
|
||||
SearchAddon = (await import('xterm-addon-search')).SearchAddon;
|
||||
@@ -45,6 +40,20 @@ export class TerminalInstanceService implements ITerminalInstanceService {
|
||||
return SearchAddon;
|
||||
}
|
||||
|
||||
public async getXtermUnicode11Constructor(): Promise<typeof XTermUnicode11Addon> {
|
||||
if (!Unicode11Addon) {
|
||||
Unicode11Addon = (await import('xterm-addon-unicode11')).Unicode11Addon;
|
||||
}
|
||||
return Unicode11Addon;
|
||||
}
|
||||
|
||||
public async getXtermWebLinksConstructor(): Promise<typeof XTermWebLinksAddon> {
|
||||
if (!WebLinksAddon) {
|
||||
WebLinksAddon = (await import('xterm-addon-web-links')).WebLinksAddon;
|
||||
}
|
||||
return WebLinksAddon;
|
||||
}
|
||||
|
||||
public async getXtermWebglConstructor(): Promise<typeof XTermWebglAddon> {
|
||||
if (!WebglAddon) {
|
||||
WebglAddon = (await import('xterm-addon-webgl')).WebglAddon;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IOpenFileRequest } from 'vs/platform/windows/common/windows';
|
||||
import { ITerminalNativeService, LinuxDistro } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
||||
export class TerminalNativeService implements ITerminalNativeService {
|
||||
public _serviceBrand: undefined;
|
||||
|
||||
public get linuxDistro(): LinuxDistro { return LinuxDistro.Unknown; }
|
||||
|
||||
private readonly _onOpenFileRequest = new Emitter<IOpenFileRequest>();
|
||||
public get onOpenFileRequest(): Event<IOpenFileRequest> { return this._onOpenFileRequest.event; }
|
||||
private readonly _onOsResume = new Emitter<void>();
|
||||
public get onOsResume(): Event<void> { return this._onOsResume.event; }
|
||||
|
||||
public whenFileDeleted(): Promise<void> {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
public getWslPath(): Promise<string> {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
public getWindowsBuildNumber(): number {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(ITerminalNativeService, TerminalNativeService, true);
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { TERMINAL_PANEL_ID, IShellLaunchConfig, ITerminalConfigHelper, ITerminalNativeService, ISpawnExtHostProcessRequest, IStartExtensionTerminalRequest, IAvailableShellsRequest, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, ITerminalProcessExtHostProxy, IShellDefinition } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { TERMINAL_PANEL_ID, IShellLaunchConfig, ITerminalConfigHelper, ITerminalNativeService, ISpawnExtHostProcessRequest, IStartExtensionTerminalRequest, IAvailableShellsRequest, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, ITerminalProcessExtHostProxy, IShellDefinition, LinuxDistro } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
@@ -12,7 +12,7 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { TerminalPanel } from 'vs/workbench/contrib/terminal/browser/terminalPanel';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { TerminalTab } from 'vs/workbench/contrib/terminal/browser/terminalTab';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { TerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminalInstance';
|
||||
@@ -86,6 +86,8 @@ export class TerminalService implements ITerminalService {
|
||||
protected readonly _onRequestAvailableShells = new Emitter<IAvailableShellsRequest>();
|
||||
public get onRequestAvailableShells(): Event<IAvailableShellsRequest> { return this._onRequestAvailableShells.event; }
|
||||
|
||||
private readonly _terminalNativeService: ITerminalNativeService | undefined;
|
||||
|
||||
constructor(
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
@IPanelService private _panelService: IPanelService,
|
||||
@@ -96,20 +98,25 @@ export class TerminalService implements ITerminalService {
|
||||
@IExtensionService private _extensionService: IExtensionService,
|
||||
@IFileService private _fileService: IFileService,
|
||||
@IRemoteAgentService private _remoteAgentService: IRemoteAgentService,
|
||||
@ITerminalNativeService private _terminalNativeService: ITerminalNativeService,
|
||||
@IQuickInputService private _quickInputService: IQuickInputService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@optional(ITerminalNativeService) terminalNativeService: ITerminalNativeService
|
||||
) {
|
||||
// @optional could give undefined and properly typing it breaks service registration
|
||||
this._terminalNativeService = terminalNativeService as ITerminalNativeService | undefined;
|
||||
|
||||
this._activeTabIndex = 0;
|
||||
this._isShuttingDown = false;
|
||||
this._findState = new FindReplaceState();
|
||||
lifecycleService.onBeforeShutdown(event => event.veto(this._onBeforeShutdown()));
|
||||
lifecycleService.onShutdown(() => this._onShutdown());
|
||||
this._terminalNativeService.onOpenFileRequest(e => this._onOpenFileRequest(e));
|
||||
this._terminalNativeService.onOsResume(() => this._onOsResume());
|
||||
if (this._terminalNativeService) {
|
||||
this._terminalNativeService.onOpenFileRequest(e => this._onOpenFileRequest(e));
|
||||
this._terminalNativeService.onOsResume(() => this._onOsResume());
|
||||
}
|
||||
this._terminalFocusContextKey = KEYBINDING_CONTEXT_TERMINAL_FOCUS.bindTo(this._contextKeyService);
|
||||
this._findWidgetVisible = KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE.bindTo(this._contextKeyService);
|
||||
this._configHelper = this._instantiationService.createInstance(TerminalConfigHelper, this._terminalNativeService.linuxDistro);
|
||||
this._configHelper = this._instantiationService.createInstance(TerminalConfigHelper, this._terminalNativeService?.linuxDistro || LinuxDistro.Unknown);
|
||||
this.onTabDisposed(tab => this._removeTab(tab));
|
||||
this.onActiveTabChanged(() => {
|
||||
const instance = this.getActiveInstance();
|
||||
@@ -201,7 +208,7 @@ export class TerminalService implements ITerminalService {
|
||||
// marker file to get deleted and then focus back to the integrated terminal.
|
||||
if (request.termProgram === 'vscode' && request.filesToWait) {
|
||||
const waitMarkerFileUri = URI.revive(request.filesToWait.waitMarkerFileUri);
|
||||
this._terminalNativeService.whenFileDeleted(waitMarkerFileUri).then(() => {
|
||||
this._terminalNativeService?.whenFileDeleted(waitMarkerFileUri).then(() => {
|
||||
if (this.terminalInstances.length > 0) {
|
||||
const terminal = this.getActiveInstance();
|
||||
if (terminal) {
|
||||
@@ -413,10 +420,10 @@ export class TerminalService implements ITerminalService {
|
||||
}
|
||||
|
||||
public showPanel(focus?: boolean): Promise<void> {
|
||||
return new Promise<void>((complete) => {
|
||||
return new Promise<void>(async (complete) => {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
if (!panel || panel.getId() !== TERMINAL_PANEL_ID) {
|
||||
this._panelService.openPanel(TERMINAL_PANEL_ID, focus);
|
||||
await this._panelService.openPanel(TERMINAL_PANEL_ID, focus);
|
||||
if (focus) {
|
||||
// Do the focus call asynchronously as going through the
|
||||
// command palette will force editor focus
|
||||
@@ -533,7 +540,7 @@ export class TerminalService implements ITerminalService {
|
||||
return;
|
||||
}
|
||||
else if (shellType === WindowsShellType.Wsl) {
|
||||
if (this._terminalNativeService.getWindowsBuildNumber() >= 17063) {
|
||||
if (this._terminalNativeService && this._terminalNativeService.getWindowsBuildNumber() >= 17063) {
|
||||
c(this._terminalNativeService.getWslPath(originalPath));
|
||||
} else {
|
||||
c(originalPath.replace(/\\/g, '/'));
|
||||
@@ -548,7 +555,7 @@ export class TerminalService implements ITerminalService {
|
||||
}
|
||||
} else {
|
||||
const lowerExecutable = executable.toLowerCase();
|
||||
if (this._terminalNativeService.getWindowsBuildNumber() >= 17063 &&
|
||||
if (this._terminalNativeService && this._terminalNativeService.getWindowsBuildNumber() >= 17063 &&
|
||||
(lowerExecutable.indexOf('wsl') !== -1 || (lowerExecutable.indexOf('bash.exe') !== -1 && lowerExecutable.toLowerCase().indexOf('git') === -1))) {
|
||||
c(this._terminalNativeService.getWslPath(originalPath));
|
||||
return;
|
||||
|
||||
@@ -122,6 +122,7 @@ export interface ITerminalConfiguration {
|
||||
experimentalRefreshOnResume: boolean;
|
||||
experimentalUseTitleEvent: boolean;
|
||||
enableFileLinks: boolean;
|
||||
unicodeVersion: '6' | '11';
|
||||
}
|
||||
|
||||
export interface ITerminalConfigHelper {
|
||||
|
||||
@@ -186,7 +186,7 @@ export function getCwd(
|
||||
if (shell.cwd) {
|
||||
const unresolved = (typeof shell.cwd === 'object') ? shell.cwd.fsPath : shell.cwd;
|
||||
const resolved = _resolveCwd(unresolved, lastActiveWorkspace, configurationResolverService);
|
||||
return resolved || unresolved;
|
||||
return _sanitizeCwd(resolved || unresolved);
|
||||
}
|
||||
|
||||
let cwd: string | undefined;
|
||||
|
||||
@@ -11,8 +11,9 @@ import { IProcessEnvironment, platform, Platform } from 'vs/base/common/platform
|
||||
import { TerminalProcess } from 'vs/workbench/contrib/terminal/node/terminalProcess';
|
||||
import { getSystemShell } from 'vs/workbench/contrib/terminal/node/terminal';
|
||||
import { Terminal as XTermTerminal } from 'xterm';
|
||||
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
|
||||
import { Unicode11Addon as XTermUnicode11Addon } from 'xterm-addon-unicode11';
|
||||
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
|
||||
import { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { getDefaultShell, getDefaultShellArgs } from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
|
||||
@@ -24,8 +25,9 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
let Terminal: typeof XTermTerminal;
|
||||
let WebLinksAddon: typeof XTermWebLinksAddon;
|
||||
let SearchAddon: typeof XTermSearchAddon;
|
||||
let Unicode11Addon: typeof XTermUnicode11Addon;
|
||||
let WebLinksAddon: typeof XTermWebLinksAddon;
|
||||
let WebglAddon: typeof XTermWebglAddon;
|
||||
|
||||
export class TerminalInstanceService implements ITerminalInstanceService {
|
||||
@@ -63,6 +65,13 @@ export class TerminalInstanceService implements ITerminalInstanceService {
|
||||
return SearchAddon;
|
||||
}
|
||||
|
||||
public async getXtermUnicode11Constructor(): Promise<typeof XTermUnicode11Addon> {
|
||||
if (!Unicode11Addon) {
|
||||
Unicode11Addon = (await import('xterm-addon-unicode11')).Unicode11Addon;
|
||||
}
|
||||
return Unicode11Addon;
|
||||
}
|
||||
|
||||
public async getXtermWebglConstructor(): Promise<typeof XTermWebglAddon> {
|
||||
if (!WebglAddon) {
|
||||
WebglAddon = (await import('xterm-addon-webgl')).WebglAddon;
|
||||
|
||||
@@ -40,12 +40,15 @@ class MockTerminalInstanceService implements ITerminalInstanceService {
|
||||
getXtermConstructor(): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
async getXtermWebLinksConstructor(): Promise<any> {
|
||||
return (await import('xterm-addon-web-links')).WebLinksAddon;
|
||||
}
|
||||
getXtermSearchConstructor(): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getXtermUnicode11Constructor(): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
async getXtermWebLinksConstructor(): Promise<any> {
|
||||
return (await import('xterm-addon-web-links')).WebLinksAddon;
|
||||
}
|
||||
getXtermWebglConstructor(): Promise<any> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user