mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 14:34:54 +00:00
lint
This commit is contained in:
@@ -211,7 +211,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
|
||||
async buildContextMenu (): Promise<Electron.MenuItemConstructorOptions[]> {
|
||||
let items: Electron.MenuItemConstructorOptions[] = []
|
||||
for (let section of await Promise.all(this.contextMenuProviders.map(x => x.getItems(this)))) {
|
||||
for (const section of await Promise.all(this.contextMenuProviders.map(x => x.getItems(this)))) {
|
||||
items = items.concat(section)
|
||||
items.push({ type: 'separator' })
|
||||
}
|
||||
@@ -220,7 +220,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
}
|
||||
|
||||
protected detachTermContainerHandlers () {
|
||||
for (let subscription of this.termContainerSubscriptions) {
|
||||
for (const subscription of this.termContainerSubscriptions) {
|
||||
subscription.unsubscribe()
|
||||
}
|
||||
this.termContainerSubscriptions = []
|
||||
@@ -277,7 +277,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
}
|
||||
} else if (event.altKey) {
|
||||
event.preventDefault()
|
||||
let delta = Math.round(wheelDeltaY / 50)
|
||||
const delta = Math.round(wheelDeltaY / 50)
|
||||
this.sendInput(((delta > 0) ? '\u001bOA' : '\u001bOB').repeat(Math.abs(delta)))
|
||||
}
|
||||
}
|
||||
@@ -316,9 +316,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
||||
* Feeds input into the terminal frontend
|
||||
*/
|
||||
write (data: string) {
|
||||
let percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
|
||||
const percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
|
||||
if (percentageMatch) {
|
||||
let percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
|
||||
const percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
|
||||
if (percentage > 0 && percentage <= 100) {
|
||||
this.setProgress(percentage)
|
||||
this.logger.debug('Detected progress:', percentage)
|
||||
|
@@ -18,8 +18,8 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
super()
|
||||
if (!electron.remote.process.env.TERMINUS_DEV) {
|
||||
setImmediate(async () => {
|
||||
let argv: string[] = electron.remote.process.argv
|
||||
for (let arg of argv.slice(1).concat([electron.remote.process.argv0])) {
|
||||
const argv: string[] = electron.remote.process.argv
|
||||
for (const arg of argv.slice(1).concat([electron.remote.process.argv0])) {
|
||||
if (await fs.exists(arg)) {
|
||||
if ((await fs.stat(arg)).isDirectory()) {
|
||||
this.terminal.openTab(null, arg)
|
||||
@@ -44,7 +44,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
icon: this.domSanitizer.bypassSecurityTrustHtml(require('./icons/profiles.svg')),
|
||||
title: 'New terminal with profile',
|
||||
submenu: async () => {
|
||||
let profiles = await this.terminal.getProfiles()
|
||||
const profiles = await this.terminal.getProfiles()
|
||||
return profiles.map(profile => ({
|
||||
icon: profile.icon,
|
||||
title: profile.name,
|
||||
|
@@ -8,15 +8,15 @@ import { ITerminalColorScheme } from './api/interfaces'
|
||||
@Injectable()
|
||||
export class HyperColorSchemes extends TerminalColorSchemeProvider {
|
||||
async getSchemes (): Promise<ITerminalColorScheme[]> {
|
||||
let pluginsPath = path.join(process.env.HOME, '.hyper_plugins', 'node_modules')
|
||||
const pluginsPath = path.join(process.env.HOME, '.hyper_plugins', 'node_modules')
|
||||
if (!(await fs.exists(pluginsPath))) return []
|
||||
let plugins = await fs.readdir(pluginsPath)
|
||||
const plugins = await fs.readdir(pluginsPath)
|
||||
|
||||
let themes: ITerminalColorScheme[] = []
|
||||
const themes: ITerminalColorScheme[] = []
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
try {
|
||||
let module = (global as any).require(path.join(pluginsPath, plugin))
|
||||
const module = (global as any).require(path.join(pluginsPath, plugin))
|
||||
if (module.decorateConfig) {
|
||||
let config: any
|
||||
try {
|
||||
|
@@ -31,7 +31,7 @@ export class AppearanceSettingsTabComponent {
|
||||
|
||||
async ngOnInit () {
|
||||
if (this.hostApp.platform === Platform.Windows || this.hostApp.platform === Platform.macOS) {
|
||||
let fonts = await new Promise<any[]>((resolve) => fontManager.findFonts({ monospace: true }, resolve))
|
||||
const fonts = await new Promise<any[]>((resolve) => fontManager.findFonts({ monospace: true }, resolve))
|
||||
this.fonts = fonts.map(x => (x.family + ' ' + x.style).trim())
|
||||
this.fonts.sort()
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ export class ColorPickerComponent {
|
||||
if (!this.isOpen) {
|
||||
return
|
||||
}
|
||||
let windowRef = (this.popover as any)._windowRef
|
||||
const windowRef = (this.popover as any)._windowRef
|
||||
if (!windowRef) {
|
||||
return
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@ export class EnvironmentEditorComponent {
|
||||
}
|
||||
|
||||
getModel () {
|
||||
let model = {}
|
||||
for (let pair of this.vars) {
|
||||
const model = {}
|
||||
for (const pair of this.vars) {
|
||||
model[pair.key] = pair.value
|
||||
}
|
||||
return model
|
||||
|
@@ -51,8 +51,8 @@ export class ShellSettingsTabComponent {
|
||||
}
|
||||
|
||||
pickWorkingDirectory () {
|
||||
let shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
|
||||
let paths = this.electron.dialog.showOpenDialog(
|
||||
const shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
|
||||
const paths = this.electron.dialog.showOpenDialog(
|
||||
this.hostApp.getWindow(),
|
||||
{
|
||||
defaultPath: shell.fsBase,
|
||||
@@ -65,7 +65,7 @@ export class ShellSettingsTabComponent {
|
||||
}
|
||||
|
||||
newProfile (shell: IShell) {
|
||||
let profile: Profile = {
|
||||
const profile: Profile = {
|
||||
name: shell.name,
|
||||
sessionOptions: this.terminalService.optionsFromShell(shell),
|
||||
}
|
||||
@@ -75,7 +75,7 @@ export class ShellSettingsTabComponent {
|
||||
}
|
||||
|
||||
editProfile (profile: Profile) {
|
||||
let modal = this.ngbModal.open(EditProfileModalComponent)
|
||||
const modal = this.ngbModal.open(EditProfileModalComponent)
|
||||
modal.componentInstance.profile = Object.assign({}, profile)
|
||||
modal.result.then(result => {
|
||||
Object.assign(profile, result)
|
||||
|
@@ -22,7 +22,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
|
||||
this.logger = this.log.create('terminalTab')
|
||||
this.session = new Session(this.config)
|
||||
|
||||
let isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
|
||||
const isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
|
||||
|
||||
this.homeEndSubscription = this.hotkeys.matchedHotkey.subscribe(hotkey => {
|
||||
if (!this.hasFocus) {
|
||||
@@ -58,7 +58,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
|
||||
}
|
||||
|
||||
async getRecoveryToken (): Promise<any> {
|
||||
let cwd = this.session ? await this.session.getWorkingDirectory() : null
|
||||
const cwd = this.session ? await this.session.getWorkingDirectory() : null
|
||||
return {
|
||||
type: 'app:terminal-tab',
|
||||
sessionOptions: {
|
||||
@@ -69,7 +69,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
|
||||
}
|
||||
|
||||
async getCurrentProcess (): Promise<BaseTabProcess> {
|
||||
let children = await this.session.getChildProcesses()
|
||||
const children = await this.session.getChildProcesses()
|
||||
if (!children.length) {
|
||||
return null
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
|
||||
}
|
||||
|
||||
async canClose (): Promise<boolean> {
|
||||
let children = await this.session.getChildProcesses()
|
||||
const children = await this.session.getChildProcesses()
|
||||
if (children.length === 0) {
|
||||
return true
|
||||
}
|
||||
|
@@ -21,9 +21,9 @@ export class NewTabContextMenu extends TerminalContextMenuItemProvider {
|
||||
}
|
||||
|
||||
async getItems (tab: BaseTerminalTabComponent): Promise<Electron.MenuItemConstructorOptions[]> {
|
||||
let profiles = await this.terminalService.getProfiles()
|
||||
const profiles = await this.terminalService.getProfiles()
|
||||
|
||||
let items: Electron.MenuItemConstructorOptions[] = [
|
||||
const items: Electron.MenuItemConstructorOptions[] = [
|
||||
{
|
||||
label: 'New terminal',
|
||||
click: () => this.zone.run(() => {
|
||||
|
@@ -43,7 +43,7 @@ export abstract class Frontend {
|
||||
detach (host: HTMLElement): void { } // tslint:disable-line
|
||||
|
||||
destroy (): void {
|
||||
for (let o of [
|
||||
for (const o of [
|
||||
this.ready,
|
||||
this.title,
|
||||
this.alternateScreenActive,
|
||||
|
@@ -46,7 +46,7 @@ hterm.lib.wc.charWidthDisregardAmbiguous = codepoint => {
|
||||
}
|
||||
|
||||
hterm.hterm.Terminal.prototype.applyCursorShape = function () {
|
||||
let modes = [
|
||||
const modes = [
|
||||
[hterm.hterm.Terminal.cursorShape.BLOCK, true],
|
||||
[this.defaultCursorShape || hterm.hterm.Terminal.cursorShape.BLOCK, false],
|
||||
[hterm.hterm.Terminal.cursorShape.BLOCK, false],
|
||||
@@ -55,7 +55,7 @@ hterm.hterm.Terminal.prototype.applyCursorShape = function () {
|
||||
[hterm.hterm.Terminal.cursorShape.BEAM, true],
|
||||
[hterm.hterm.Terminal.cursorShape.BEAM, false],
|
||||
]
|
||||
let modeNumber = this.cursorMode || 1
|
||||
const modeNumber = this.cursorMode || 1
|
||||
if (modeNumber >= modes.length) {
|
||||
console.warn('Unknown cursor style: ' + modeNumber)
|
||||
return
|
||||
@@ -76,14 +76,14 @@ hterm.hterm.VT.CSI[' q'] = function (parseState) {
|
||||
}
|
||||
|
||||
hterm.hterm.VT.OSC['4'] = function (parseState) {
|
||||
let args = parseState.args[0].split(';')
|
||||
const args = parseState.args[0].split(';')
|
||||
|
||||
let pairCount = args.length / 2
|
||||
let colorPalette = this.terminal.getTextAttributes().colorPalette
|
||||
let responseArray = []
|
||||
const pairCount = args.length / 2
|
||||
const colorPalette = this.terminal.getTextAttributes().colorPalette
|
||||
const responseArray = []
|
||||
|
||||
for (let pairNumber = 0; pairNumber < pairCount; ++pairNumber) {
|
||||
let colorIndex = parseInt(args[pairNumber * 2])
|
||||
const colorIndex = parseInt(args[pairNumber * 2])
|
||||
let colorValue = args[pairNumber * 2 + 1]
|
||||
|
||||
if (colorIndex >= colorPalette.length) {
|
||||
|
@@ -54,7 +54,7 @@ export class HTermFrontend extends Frontend {
|
||||
}
|
||||
|
||||
configure (): void {
|
||||
let config = this.configService.store
|
||||
const config = this.configService.store
|
||||
|
||||
this.configuredFontSize = config.terminal.fontSize
|
||||
this.configuredLinePadding = config.terminal.linePadding
|
||||
@@ -157,7 +157,7 @@ export class HTermFrontend extends Frontend {
|
||||
}
|
||||
|
||||
private setFontSize () {
|
||||
let size = this.configuredFontSize * Math.pow(1.1, this.zoom)
|
||||
const size = this.configuredFontSize * Math.pow(1.1, this.zoom)
|
||||
preferenceManager.set('font-size', size)
|
||||
if (this.term) {
|
||||
setTimeout(() => {
|
||||
@@ -229,7 +229,7 @@ export class HTermFrontend extends Frontend {
|
||||
|
||||
this.term.ringBell = () => this.bell.next()
|
||||
|
||||
for (let screen of [this.term.primaryScreen_, this.term.alternateScreen_]) {
|
||||
for (const screen of [this.term.primaryScreen_, this.term.alternateScreen_]) {
|
||||
const _insertString = screen.insertString.bind(screen)
|
||||
screen.insertString = (data) => {
|
||||
_insertString(data)
|
||||
@@ -238,7 +238,7 @@ export class HTermFrontend extends Frontend {
|
||||
|
||||
const _deleteChars = screen.deleteChars.bind(screen)
|
||||
screen.deleteChars = (count) => {
|
||||
let ret = _deleteChars(count)
|
||||
const ret = _deleteChars(count)
|
||||
this.contentUpdated.next()
|
||||
return ret
|
||||
}
|
||||
@@ -246,7 +246,7 @@ export class HTermFrontend extends Frontend {
|
||||
const _expandSelection = screen.expandSelection.bind(screen)
|
||||
screen.expandSelection = (selection) => {
|
||||
// Drop whitespace at the end of selection
|
||||
let range = selection.getRangeAt(0)
|
||||
const range = selection.getRangeAt(0)
|
||||
if (range.endOffset > 0 && range.endContainer.nodeType === 3 && range.endContainer.textContent !== '') {
|
||||
while (/[\s\S]+\s$/.test(range.endContainer.textContent.substr(0,range.endOffset))) {
|
||||
range.setEnd(range.endContainer, range.endOffset - 1)
|
||||
@@ -258,7 +258,7 @@ export class HTermFrontend extends Frontend {
|
||||
|
||||
const _measureCharacterSize = this.term.scrollPort_.measureCharacterSize.bind(this.term.scrollPort_)
|
||||
this.term.scrollPort_.measureCharacterSize = () => {
|
||||
let size = _measureCharacterSize()
|
||||
const size = _measureCharacterSize()
|
||||
size.height += this.configuredLinePadding
|
||||
return size
|
||||
}
|
||||
|
@@ -123,7 +123,7 @@ export class XTermFrontend extends Frontend {
|
||||
host.addEventListener('mouseup', event => this.mouseEvent.next(event as MouseEvent))
|
||||
host.addEventListener('mousewheel', event => this.mouseEvent.next(event as MouseEvent))
|
||||
|
||||
let ro = new window['ResizeObserver'](() => this.resizeHandler())
|
||||
const ro = new window['ResizeObserver'](() => this.resizeHandler())
|
||||
ro.observe(host)
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ export class XTermFrontend extends Frontend {
|
||||
}
|
||||
|
||||
configure (): void {
|
||||
let config = this.configService.store
|
||||
const config = this.configService.store
|
||||
|
||||
setImmediate(() => {
|
||||
if (this.xterm.cols && this.xterm.rows && this.xtermCore.charMeasure) {
|
||||
@@ -194,7 +194,7 @@ export class XTermFrontend extends Frontend {
|
||||
|
||||
this.copyOnSelect = config.terminal.copyOnSelect
|
||||
|
||||
let theme: ITheme = {
|
||||
const theme: ITheme = {
|
||||
foreground: config.terminal.colorScheme.foreground,
|
||||
background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : (config.appearance.vibrancy ? 'transparent' : this.themesService.findCurrentTheme().terminalBackground),
|
||||
cursor: config.terminal.colorScheme.cursor,
|
||||
@@ -252,7 +252,7 @@ export class XTermFrontend extends Frontend {
|
||||
|
||||
private getHexColor (mode: number, color: number): string {
|
||||
if (mode === Attributes.CM_RGB) {
|
||||
let rgb = AttributeData.toColorRGB(color)
|
||||
const rgb = AttributeData.toColorRGB(color)
|
||||
return rgb.map(x => x.toString(16).padStart(2, '0')).join('')
|
||||
}
|
||||
if (mode === Attributes.CM_P16 || mode === Attributes.CM_P256) {
|
||||
@@ -265,7 +265,7 @@ export class XTermFrontend extends Frontend {
|
||||
let html = '<div>'
|
||||
let lastStyle = null
|
||||
const line = (this.xterm.buffer.getLine(y) as any)._line
|
||||
let cell = new CellData()
|
||||
const cell = new CellData()
|
||||
for (let i = start; i < end; i++) {
|
||||
line.loadCell(i, cell)
|
||||
const fg = this.getHexColor(cell.getFgColorMode(), cell.getFgColor())
|
||||
|
@@ -74,7 +74,7 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
|
||||
) { super() }
|
||||
|
||||
async provide (): Promise<IHotkeyDescription[]> {
|
||||
let profiles = await this.terminal.getProfiles()
|
||||
const profiles = await this.terminal.getProfiles()
|
||||
return [
|
||||
...this.hotkeys,
|
||||
...profiles.map(profile => ({
|
||||
|
@@ -131,7 +131,7 @@ export default class TerminalModule {
|
||||
hostApp: HostAppService,
|
||||
dockMenu: DockMenuService,
|
||||
) {
|
||||
let events = [
|
||||
const events = [
|
||||
{
|
||||
name: 'keydown',
|
||||
htermHandler: 'onKeyDown_',
|
||||
@@ -142,7 +142,7 @@ export default class TerminalModule {
|
||||
},
|
||||
]
|
||||
events.forEach((event) => {
|
||||
let oldHandler = hterm.hterm.Keyboard.prototype[event.htermHandler]
|
||||
const oldHandler = hterm.hterm.Keyboard.prototype[event.htermHandler]
|
||||
hterm.hterm.Keyboard.prototype[event.htermHandler] = function (nativeEvent) {
|
||||
hotkeys.pushKeystroke(event.name, nativeEvent)
|
||||
if (hotkeys.getCurrentPartiallyMatchedHotkeys().length === 0) {
|
||||
@@ -169,8 +169,8 @@ export default class TerminalModule {
|
||||
hostApp.newWindow()
|
||||
}
|
||||
if (hotkey.startsWith('profile.')) {
|
||||
let profiles = await terminal.getProfiles()
|
||||
let profile = profiles.find(x => slug(x.name).toLowerCase() === hotkey.split('.')[1])
|
||||
const profiles = await terminal.getProfiles()
|
||||
const profile = profiles.find(x => slug(x.name).toLowerCase() === hotkey.split('.')[1])
|
||||
if (profile) {
|
||||
terminal.openTabWithOptions(profile.sessionOptions)
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export default class TerminalModule {
|
||||
})
|
||||
|
||||
hostApp.cliOpenProfile$.subscribe(async profileName => {
|
||||
let profile = config.store.terminal.profiles.find(x => x.name === profileName)
|
||||
const profile = config.store.terminal.profiles.find(x => x.name === profileName)
|
||||
if (!profile) {
|
||||
console.error('Requested profile', profileName, 'not found')
|
||||
return
|
||||
|
@@ -15,7 +15,7 @@ export class PathDropDecorator extends TerminalDecorator {
|
||||
event.preventDefault()
|
||||
}),
|
||||
terminal.frontend.drop$.subscribe(event => {
|
||||
for (let file of event.dataTransfer.files as any) {
|
||||
for (const file of event.dataTransfer.files as any) {
|
||||
this.injectPath(terminal, file.path)
|
||||
}
|
||||
event.preventDefault()
|
||||
@@ -32,8 +32,8 @@ export class PathDropDecorator extends TerminalDecorator {
|
||||
terminal.sendInput(path + ' ')
|
||||
}
|
||||
|
||||
detach (terminal: TerminalTabComponent): void {
|
||||
for (let s of this.subscriptions) {
|
||||
detach (_terminal: TerminalTabComponent): void {
|
||||
for (const s of this.subscriptions) {
|
||||
s.unsubscribe()
|
||||
}
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ export class Session extends BaseSession {
|
||||
start (options: SessionOptions) {
|
||||
this.name = options.name
|
||||
|
||||
let env = {
|
||||
const env = {
|
||||
...process.env,
|
||||
TERM: 'xterm-256color',
|
||||
TERM_PROGRAM: 'Terminus',
|
||||
@@ -103,7 +103,7 @@ export class Session extends BaseSession {
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin' && !process.env.LC_ALL) {
|
||||
let locale = process.env.LC_CTYPE || 'en_US.UTF-8'
|
||||
const locale = process.env.LC_CTYPE || 'en_US.UTF-8'
|
||||
Object.assign(env, {
|
||||
LANG: locale,
|
||||
LC_ALL: locale,
|
||||
@@ -175,9 +175,9 @@ export class Session extends BaseSession {
|
||||
|
||||
processOSC1337 (data) {
|
||||
if (data.includes(OSC1337Prefix)) {
|
||||
let preData = data.substring(0, data.indexOf(OSC1337Prefix))
|
||||
const preData = data.substring(0, data.indexOf(OSC1337Prefix))
|
||||
let params = data.substring(data.indexOf(OSC1337Prefix) + OSC1337Prefix.length)
|
||||
let postData = params.substring(params.indexOf(OSC1337Suffix) + OSC1337Suffix.length)
|
||||
const postData = params.substring(params.indexOf(OSC1337Suffix) + OSC1337Suffix.length)
|
||||
params = params.substring(0, params.indexOf(OSC1337Suffix))
|
||||
|
||||
if (params.startsWith('CurrentDir=')) {
|
||||
@@ -216,7 +216,7 @@ export class Session extends BaseSession {
|
||||
return []
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
let processes = await macOSNativeProcessList.getProcessList()
|
||||
const processes = await macOSNativeProcessList.getProcessList()
|
||||
return processes.filter(x => x.ppid === this.truePID).map(p => ({
|
||||
pid: p.pid,
|
||||
ppid: p.ppid,
|
||||
@@ -304,7 +304,7 @@ export class Session extends BaseSession {
|
||||
}
|
||||
|
||||
private guessWindowsCWD (data: string) {
|
||||
let match = windowsDirectoryRegex.exec(data)
|
||||
const match = windowsDirectoryRegex.exec(data)
|
||||
if (match) {
|
||||
this.guessedCWD = match[0]
|
||||
}
|
||||
|
@@ -35,12 +35,12 @@ export class TerminalService {
|
||||
}
|
||||
|
||||
private async getShells (): Promise<IShell[]> {
|
||||
let shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
|
||||
const shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
|
||||
return shellLists.reduce((a, b) => a.concat(b), [])
|
||||
}
|
||||
|
||||
async getProfiles (includeHidden?: boolean): Promise<Profile[]> {
|
||||
let shells = await this.shells$.toPromise()
|
||||
const shells = await this.shells$.toPromise()
|
||||
return [
|
||||
...this.config.store.terminal.profiles,
|
||||
...shells.filter(x => includeHidden || !x.hidden).map(shell => ({
|
||||
@@ -54,7 +54,7 @@ export class TerminalService {
|
||||
|
||||
private async reloadShells () {
|
||||
this.shells = new AsyncSubject<IShell[]>()
|
||||
let shells = await this.getShells()
|
||||
const shells = await this.getShells()
|
||||
this.logger.debug('Shells list:', shells)
|
||||
this.shells.next(shells)
|
||||
this.shells.complete()
|
||||
@@ -66,7 +66,7 @@ export class TerminalService {
|
||||
*/
|
||||
async openTab (profile?: Profile, cwd?: string, pause?: boolean): Promise<TerminalTabComponent> {
|
||||
if (!profile) {
|
||||
let profiles = await this.getProfiles(true)
|
||||
const profiles = await this.getProfiles(true)
|
||||
profile = profiles.find(x => slug(x.name).toLowerCase() === this.config.store.terminal.profile) || profiles[0]
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export class TerminalService {
|
||||
cwd = await this.app.activeTab.session.getWorkingDirectory()
|
||||
}
|
||||
if (this.app.activeTab instanceof SplitTabComponent) {
|
||||
let focusedTab = this.app.activeTab.getFocusedTab()
|
||||
const focusedTab = this.app.activeTab.getFocusedTab()
|
||||
|
||||
if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
|
||||
cwd = await focusedTab.session.getWorkingDirectory()
|
||||
@@ -93,7 +93,7 @@ export class TerminalService {
|
||||
}
|
||||
|
||||
this.logger.info(`Starting profile ${profile.name}`, profile)
|
||||
let sessionOptions = {
|
||||
const sessionOptions = {
|
||||
...profile.sessionOptions,
|
||||
pauseAfterExit: pause,
|
||||
cwd,
|
||||
|
@@ -18,7 +18,7 @@ export class TerminalFrontendService {
|
||||
|
||||
getFrontend (session?: BaseSession): Frontend {
|
||||
if (!session) {
|
||||
let frontend: Frontend = new ({
|
||||
const frontend: Frontend = new ({
|
||||
'xterm': XTermFrontend,
|
||||
'xterm-webgl': XTermWebGLFrontend,
|
||||
'hterm': HTermFrontend,
|
||||
|
@@ -33,7 +33,7 @@ export class UACService {
|
||||
)
|
||||
}
|
||||
|
||||
let options = { ...sessionOptions }
|
||||
const options = { ...sessionOptions }
|
||||
options.args = [options.command, ...options.args]
|
||||
options.command = helperPath
|
||||
return options
|
||||
|
@@ -14,7 +14,7 @@ export class CustomShellProvider extends ShellProvider {
|
||||
}
|
||||
|
||||
async provide (): Promise<IShell[]> {
|
||||
let args = this.config.store.terminal.customShell.split(' ')
|
||||
const args = this.config.store.terminal.customShell.split(' ')
|
||||
return [{
|
||||
id: 'custom',
|
||||
name: 'Custom shell',
|
||||
|
@@ -25,7 +25,7 @@ export class Cygwin32ShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
|
||||
const cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
|
||||
|
||||
if (!cygwinPath) {
|
||||
return []
|
||||
|
@@ -25,7 +25,7 @@ export class Cygwin64ShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\Cygwin\\setup', 'rootdir')
|
||||
const cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\Cygwin\\setup', 'rootdir')
|
||||
|
||||
if (!cygwinPath) {
|
||||
return []
|
||||
|
@@ -22,7 +22,7 @@ export class LinuxDefaultShellProvider extends ShellProvider {
|
||||
if (this.hostApp.platform !== Platform.Linux) {
|
||||
return []
|
||||
}
|
||||
let line = (await fs.readFile('/etc/passwd', { encoding: 'utf-8' }))
|
||||
const line = (await fs.readFile('/etc/passwd', { encoding: 'utf-8' }))
|
||||
.split('\n').find(x => x.startsWith(process.env.LOGNAME + ':'))
|
||||
if (!line) {
|
||||
this.logger.warn('Could not detect user shell')
|
||||
|
@@ -18,7 +18,7 @@ export class MacOSDefaultShellProvider extends ShellProvider {
|
||||
if (this.hostApp.platform !== Platform.macOS) {
|
||||
return []
|
||||
}
|
||||
let shellEntry = (await exec(`/usr/bin/dscl . -read /Users/${process.env.LOGNAME} UserShell`))[0].toString()
|
||||
const shellEntry = (await exec(`/usr/bin/dscl . -read /Users/${process.env.LOGNAME} UserShell`))[0].toString()
|
||||
return [{
|
||||
id: 'default',
|
||||
name: 'User default',
|
||||
|
@@ -32,10 +32,10 @@ export class WindowsDefaultShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
// Figure out a sensible default
|
||||
let shellLists = await Promise.all(this.providers.map(x => x.provide()))
|
||||
for (let list of shellLists) {
|
||||
const shellLists = await Promise.all(this.providers.map(x => x.provide()))
|
||||
for (const list of shellLists) {
|
||||
if (list.length) {
|
||||
let shell = list[list.length - 1]
|
||||
const shell = list[list.length - 1]
|
||||
|
||||
return [{
|
||||
...shell,
|
||||
|
@@ -29,7 +29,7 @@ export class WSLShellProvider extends ShellProvider {
|
||||
const bashPath = `${process.env.windir}\\system32\\bash.exe`
|
||||
const wslPath = `${process.env.windir}\\system32\\wsl.exe`
|
||||
|
||||
let shells: IShell[] = [{
|
||||
const shells: IShell[] = [{
|
||||
id: 'wsl',
|
||||
name: 'WSL / Default distro',
|
||||
command: wslPath,
|
||||
@@ -40,7 +40,7 @@ export class WSLShellProvider extends ShellProvider {
|
||||
}]
|
||||
|
||||
const lxssPath = 'Software\\Microsoft\\Windows\\CurrentVersion\\Lxss'
|
||||
let lxss = wnr.getRegistryKey(wnr.HK.CU, lxssPath)
|
||||
const lxss = wnr.getRegistryKey(wnr.HK.CU, lxssPath)
|
||||
if (!lxss || !lxss.DefaultDistribution || !isWindowsBuild(WIN_BUILD_WSL_EXE_DISTRO_FLAG)) {
|
||||
if (await fs.exists(bashPath)) {
|
||||
return [{
|
||||
@@ -56,12 +56,12 @@ export class WSLShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
}
|
||||
for (let child of wnr.listRegistrySubkeys(wnr.HK.CU, lxssPath)) {
|
||||
let childKey = wnr.getRegistryKey(wnr.HK.CU, lxssPath + '\\' + child)
|
||||
for (const child of wnr.listRegistrySubkeys(wnr.HK.CU, lxssPath)) {
|
||||
const childKey = wnr.getRegistryKey(wnr.HK.CU, lxssPath + '\\' + child)
|
||||
if (!childKey.DistributionName) {
|
||||
continue
|
||||
}
|
||||
let name = childKey.DistributionName.value
|
||||
const name = childKey.DistributionName.value
|
||||
shells.push({
|
||||
id: `wsl-${slug(name)}`,
|
||||
name: `WSL / ${name}`,
|
||||
|
@@ -22,7 +22,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
||||
{
|
||||
label: 'Save as profile',
|
||||
click: () => this.zone.run(async () => {
|
||||
let profile = {
|
||||
const profile = {
|
||||
sessionOptions: {
|
||||
...tab.sessionOptions,
|
||||
cwd: (await tab.session.getWorkingDirectory()) || tab.sessionOptions.cwd,
|
||||
|
Reference in New Issue
Block a user