mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 13:43:07 +00:00
Clean up termianl imports
This commit is contained in:
parent
2dcccf7cc8
commit
6d3e6cd313
5 changed files with 41 additions and 41 deletions
|
@ -7,9 +7,10 @@ import 'vs/css!./media/scrollbar';
|
|||
import 'vs/css!./media/terminal';
|
||||
import 'vs/css!./media/xterm';
|
||||
import 'vs/css!./media/widgets';
|
||||
import * as debugActions from 'vs/workbench/parts/debug/browser/debugActions';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as panel from 'vs/workbench/browser/panel';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import nls = require('vs/nls');
|
||||
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { GlobalQuickOpenAction } from 'vs/workbench/browser/parts/quickopen/quickopen.contribution';
|
||||
import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, TERMINAL_DEFAULT_RIGHT_CLICK_COPY_PASTE, TerminalCursorStyle } from 'vs/workbench/parts/terminal/common/terminal';
|
||||
|
@ -24,7 +25,6 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
|||
import { TerminalService } from 'vs/workbench/parts/terminal/electron-browser/terminalService';
|
||||
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import debugActions = require('vs/workbench/parts/debug/browser/debugActions');
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { OpenNextRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditorInGroupAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction } from 'vs/workbench/browser/parts/editor/editorActions';
|
||||
import { EDITOR_FONT_DEFAULTS } from "vs/editor/common/config/editorOptions";
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import os = require('os');
|
||||
import * as nls from 'vs/nls';
|
||||
import * as os from 'os';
|
||||
import { Action, IAction } from 'vs/base/common/actions';
|
||||
import { EndOfLinePreference } from 'vs/editor/common/editorCommon';
|
||||
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { registerColor, ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
|
||||
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import DOM = require('vs/base/browser/dom');
|
||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import cp = require('child_process');
|
||||
import lifecycle = require('vs/base/common/lifecycle');
|
||||
import nls = require('vs/nls');
|
||||
import os = require('os');
|
||||
import platform = require('vs/base/common/platform');
|
||||
import Uri from 'vs/base/common/uri';
|
||||
import xterm = require('xterm');
|
||||
import { Dimension } from 'vs/base/browser/builder';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
@ -39,7 +39,7 @@ class StandardTerminalProcessFactory implements ITerminalProcessFactory {
|
|||
public create(env: { [key: string]: string }): cp.ChildProcess {
|
||||
return cp.fork('./terminalProcess', [], {
|
||||
env,
|
||||
cwd: URI.parse(path.dirname(require.toUrl('./terminalProcess'))).fsPath
|
||||
cwd: Uri.parse(path.dirname(require.toUrl('./terminalProcess'))).fsPath
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
|
||||
this._container = container;
|
||||
this._wrapperElement = document.createElement('div');
|
||||
DOM.addClass(this._wrapperElement, 'terminal-wrapper');
|
||||
dom.addClass(this._wrapperElement, 'terminal-wrapper');
|
||||
this._xtermElement = document.createElement('div');
|
||||
|
||||
this._xterm.open(this._xtermElement, false);
|
||||
|
@ -242,7 +242,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
}
|
||||
return undefined;
|
||||
});
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'mouseup', (event: KeyboardEvent) => {
|
||||
this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'mouseup', (event: KeyboardEvent) => {
|
||||
// Wait until mouseup has propogated through the DOM before evaluating the new selection
|
||||
// state.
|
||||
setTimeout(() => {
|
||||
|
@ -251,7 +251,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
}));
|
||||
|
||||
// xterm.js currently drops selection on keyup as we need to handle this case.
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'keyup', (event: KeyboardEvent) => {
|
||||
this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'keyup', (event: KeyboardEvent) => {
|
||||
// Wait until keyup has propogated through the DOM before evaluating the new selection
|
||||
// state.
|
||||
setTimeout(() => {
|
||||
|
@ -262,10 +262,10 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
const xtermHelper: HTMLElement = this._xterm.element.querySelector('.xterm-helpers');
|
||||
const focusTrap: HTMLElement = document.createElement('div');
|
||||
focusTrap.setAttribute('tabindex', '0');
|
||||
DOM.addClass(focusTrap, 'focus-trap');
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(focusTrap, 'focus', (event: FocusEvent) => {
|
||||
dom.addClass(focusTrap, 'focus-trap');
|
||||
this._instanceDisposables.push(dom.addDisposableListener(focusTrap, 'focus', (event: FocusEvent) => {
|
||||
let currentElement = focusTrap;
|
||||
while (!DOM.hasClass(currentElement, 'part')) {
|
||||
while (!dom.hasClass(currentElement, 'part')) {
|
||||
currentElement = currentElement.parentElement;
|
||||
}
|
||||
const hidePanelElement = <HTMLElement>currentElement.querySelector('.hide-panel-action');
|
||||
|
@ -273,17 +273,17 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
}));
|
||||
xtermHelper.insertBefore(focusTrap, this._xterm.textarea);
|
||||
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.textarea, 'focus', (event: KeyboardEvent) => {
|
||||
this._instanceDisposables.push(dom.addDisposableListener(this._xterm.textarea, 'focus', (event: KeyboardEvent) => {
|
||||
this._terminalFocusContextKey.set(true);
|
||||
}));
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.textarea, 'blur', (event: KeyboardEvent) => {
|
||||
this._instanceDisposables.push(dom.addDisposableListener(this._xterm.textarea, 'blur', (event: KeyboardEvent) => {
|
||||
this._terminalFocusContextKey.reset();
|
||||
this._refreshSelectionContextKey();
|
||||
}));
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'focus', (event: KeyboardEvent) => {
|
||||
this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'focus', (event: KeyboardEvent) => {
|
||||
this._terminalFocusContextKey.set(true);
|
||||
}));
|
||||
this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'blur', (event: KeyboardEvent) => {
|
||||
this._instanceDisposables.push(dom.addDisposableListener(this._xterm.element, 'blur', (event: KeyboardEvent) => {
|
||||
this._terminalFocusContextKey.reset();
|
||||
this._refreshSelectionContextKey();
|
||||
}));
|
||||
|
@ -336,7 +336,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
this._linkHandler.dispose();
|
||||
}
|
||||
if (this._xterm && this._xterm.element) {
|
||||
this._hadFocusOnExit = DOM.hasClass(this._xterm.element, 'focus');
|
||||
this._hadFocusOnExit = dom.hasClass(this._xterm.element, 'focus');
|
||||
}
|
||||
if (this._wrapperElement) {
|
||||
this._container.removeChild(this._wrapperElement);
|
||||
|
@ -389,7 +389,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
public setVisible(visible: boolean): void {
|
||||
this._isVisible = visible;
|
||||
if (this._wrapperElement) {
|
||||
DOM.toggleClass(this._wrapperElement, 'active', visible);
|
||||
dom.toggleClass(this._wrapperElement, 'active', visible);
|
||||
}
|
||||
if (visible && this._xterm) {
|
||||
// Trigger a manual scroll event which will sync the viewport and scroll bar. This is
|
||||
|
@ -473,9 +473,9 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
}
|
||||
const env = TerminalInstance.createTerminalEnv(process.env, shell, this._getCwd(shell, workspace), locale, this._cols, this._rows);
|
||||
this._title = shell.name || '';
|
||||
this._process = cp.fork(URI.parse(require.toUrl('bootstrap')).fsPath, ['--type=terminal'], {
|
||||
this._process = cp.fork(Uri.parse(require.toUrl('bootstrap')).fsPath, ['--type=terminal'], {
|
||||
env,
|
||||
cwd: URI.parse(path.dirname(require.toUrl('../node/terminalProcess'))).fsPath
|
||||
cwd: Uri.parse(path.dirname(require.toUrl('../node/terminalProcess'))).fsPath
|
||||
});
|
||||
if (!shell.name) {
|
||||
// Only listen for process title changes when a name is not provided
|
||||
|
@ -559,7 +559,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
}
|
||||
|
||||
private _attachPressAnyKeyToCloseListener() {
|
||||
this._processDisposables.push(DOM.addDisposableListener(this._xterm.textarea, 'keypress', (event: KeyboardEvent) => {
|
||||
this._processDisposables.push(dom.addDisposableListener(this._xterm.textarea, 'keypress', (event: KeyboardEvent) => {
|
||||
this.dispose();
|
||||
event.preventDefault();
|
||||
}));
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import DOM = require('vs/base/browser/dom');
|
||||
import nls = require('vs/nls');
|
||||
import platform = require('vs/base/common/platform');
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { Action, IAction } from 'vs/base/common/actions';
|
||||
import { Builder, Dimension } from 'vs/base/browser/builder';
|
||||
import { IActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
|
@ -51,12 +51,12 @@ export class TerminalPanel extends Panel {
|
|||
public create(parent: Builder): TPromise<any> {
|
||||
super.create(parent);
|
||||
this._parentDomElement = parent.getHTMLElement();
|
||||
DOM.addClass(this._parentDomElement, 'integrated-terminal');
|
||||
dom.addClass(this._parentDomElement, 'integrated-terminal');
|
||||
this._themeStyleElement = document.createElement('style');
|
||||
this._fontStyleElement = document.createElement('style');
|
||||
|
||||
this._terminalContainer = document.createElement('div');
|
||||
DOM.addClass(this._terminalContainer, 'terminal-outer-container');
|
||||
dom.addClass(this._terminalContainer, 'terminal-outer-container');
|
||||
this._parentDomElement.appendChild(this._themeStyleElement);
|
||||
this._parentDomElement.appendChild(this._fontStyleElement);
|
||||
this._parentDomElement.appendChild(this._terminalContainer);
|
||||
|
@ -152,7 +152,7 @@ export class TerminalPanel extends Panel {
|
|||
}
|
||||
|
||||
private _attachEventListeners(): void {
|
||||
this._register(DOM.addDisposableListener(this._parentDomElement, 'mousedown', (event: MouseEvent) => {
|
||||
this._register(dom.addDisposableListener(this._parentDomElement, 'mousedown', (event: MouseEvent) => {
|
||||
if (this._terminalService.terminalInstances.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ export class TerminalPanel extends Panel {
|
|||
}
|
||||
}
|
||||
}));
|
||||
this._register(DOM.addDisposableListener(this._parentDomElement, 'contextmenu', (event: MouseEvent) => {
|
||||
this._register(dom.addDisposableListener(this._parentDomElement, 'contextmenu', (event: MouseEvent) => {
|
||||
if (!this._cancelContextMenu) {
|
||||
const standardEvent = new StandardMouseEvent(event);
|
||||
let anchor: { x: number, y: number } = { x: standardEvent.posx, y: standardEvent.posy };
|
||||
|
@ -196,7 +196,7 @@ export class TerminalPanel extends Panel {
|
|||
}
|
||||
this._cancelContextMenu = false;
|
||||
}));
|
||||
this._register(DOM.addDisposableListener(this._parentDomElement, 'click', (event) => {
|
||||
this._register(dom.addDisposableListener(this._parentDomElement, 'click', (event) => {
|
||||
if (this._terminalService.terminalInstances.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -205,14 +205,14 @@ export class TerminalPanel extends Panel {
|
|||
this._terminalService.getActiveInstance().focus();
|
||||
}
|
||||
}));
|
||||
this._register(DOM.addDisposableListener(this._parentDomElement, 'keyup', (event: KeyboardEvent) => {
|
||||
this._register(dom.addDisposableListener(this._parentDomElement, 'keyup', (event: KeyboardEvent) => {
|
||||
if (event.keyCode === 27) {
|
||||
// Keep terminal open on escape
|
||||
event.stopPropagation();
|
||||
}
|
||||
}));
|
||||
this._register(DOM.addDisposableListener(this._parentDomElement, DOM.EventType.DROP, (e: DragEvent) => {
|
||||
if (e.target === this._parentDomElement || DOM.isAncestor(e.target as HTMLElement, this._parentDomElement)) {
|
||||
this._register(dom.addDisposableListener(this._parentDomElement, dom.EventType.DROP, (e: DragEvent) => {
|
||||
if (e.target === this._parentDomElement || dom.isAncestor(e.target as HTMLElement, this._parentDomElement)) {
|
||||
if (!e.dataTransfer) {
|
||||
return;
|
||||
}
|
||||
|
@ -269,8 +269,8 @@ export class TerminalPanel extends Panel {
|
|||
return;
|
||||
}
|
||||
let newFont = this._terminalService.configHelper.getFont();
|
||||
DOM.toggleClass(this._parentDomElement, 'enable-ligatures', this._terminalService.configHelper.config.fontLigatures);
|
||||
DOM.toggleClass(this._parentDomElement, 'disable-bold', !this._terminalService.configHelper.config.enableBold);
|
||||
dom.toggleClass(this._parentDomElement, 'enable-ligatures', this._terminalService.configHelper.config.fontLigatures);
|
||||
dom.toggleClass(this._parentDomElement, 'disable-bold', !this._terminalService.configHelper.config.enableBold);
|
||||
if (!this._font || this._fontsDiffer(this._font, newFont)) {
|
||||
this._fontStyleElement.innerHTML = '.monaco-workbench .panel.integrated-terminal .xterm {' +
|
||||
`font-family: ${newFont.fontFamily};` +
|
||||
|
|
Loading…
Reference in a new issue