Skip to content

Add terminal quick picker - #30968

Merged
roblourens merged 3 commits into
masterfrom
amqi/terminal-quickopen
Jul 20, 2017
Merged

roblourens merged 3 commits into
masterfrom
amqi/terminal-quickopen

Conversation

@Lixire

@Lixire Amy Qiu (Lixire) commented Jul 19, 2017 •

Copy link
Copy Markdown
Contributor
  • If you type in term␣ in quick picker, you get a list of active terminals

image

This is like viewPickerHandler, but only for terminal.

Addresses #29879 . Doesn't have a command attached to it yet for a keybinding.

@mention-bot

Copy link
Copy Markdown

Amy Qiu (@Lixire), thanks for your PR! By analyzing the history of the files in this pull request, we identified Daniel Imms (@Tyriar) and Benjamin Pasero (@bpasero) to be potential reviewers.

'TerminalPickerHandler',
'term ',
'inTerminalPicker',
nls.localize('quickOpen.terminal', "Quickpick Terminal")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what shows up when you use ? in quickopen, so maybe something like "Open terminal"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Show All Opened Terminals" would be consistent with the editor one: "Show All Opened Editors"

@roblourens

Copy link
Copy Markdown
Member

This looks awesome!

import 'vs/css!./media/terminal';
import 'vs/css!./media/xterm';
import 'vs/css!./media/widgets';
import 'vs/workbench/parts/terminal/browser/terminalQuickOpen';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to move this to workbench.main.ts

'TerminalPickerHandler',
'term ',
'inTerminalPicker',
nls.localize('quickOpen.terminal', "Quickpick Terminal")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Show All Opened Terminals" would be consistent with the editor one: "Show All Opened Editors"

new QuickOpenHandlerDescriptor(
'vs/workbench/parts/terminal/browser/terminalQuickOpen',
'TerminalPickerHandler',
'term ',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'vs/workbench/parts/terminal/browser/terminalQuickOpen',
'TerminalPickerHandler',
'term ',
'inTerminalPicker',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



});
return termninalEntries.concat(taskEntries);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concerned about the inconsistency of how the terminal select dropdown is sequential but the quick open is out of order due to terminal/task separation. Why not keep the exact same naming structure as the dropdown?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of me likes this since the original idea was that mixing user terminals and task terminals together is confusing. What if they were separated in the dropdown?

@roblourens roblourens Jul 19, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then maybe "next terminal" and "previous terminal" are confusing if they don't work by when the terminal was created, or if their order doesn't match the dropdown order?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah right now they're numbered in the order in which they were created, and that influences the next/prev terminal commands.


public getAutoFocus(searchValue: string, context: { model: IModel<QuickOpenEntry>, quickNavigateConfiguration?: IQuickNavigateConfiguration }): IAutoFocus {
return {
autoFocusFirstEntry: !!searchValue || !!context.quickNavigateConfiguration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be: searchValue || context.quickNavigateConfiguration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can't be assigned as a boolean though

e.setGroupLabel(lastCategory);
} else {
e.setShowBorder(false);
e.setGroupLabel(void 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this to void 0 looks a bit weird, let's just use null.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why people use void 0 instead of undefined so much in our codebase

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly just use it for void promises as it looks better imo.

return TPromise.as(new QuickOpenModel(entries));
}

private getTerminals(): TerminalEntry[] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan when tasks go into a new panel to create one of these specifically for tasks? Or will they be merged into the existing 'task ' one or something?

private category: string,
private open: () => void
) {
super();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is redundant?

@roblourens roblourens Jul 19, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to call super()

import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';

export const TERMINAL_PICKER_PREFIX = 'term ';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to terminal.ts as it should be shared

terminals.forEach((terminal, index) => {
const terminalsCategory = nls.localize('terminals', "Terminal");
const taskCategory = nls.localize('task', "Task");
if (terminal.title.indexOf('Task') >= 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to tell whether a terminal belongs to the task runner?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just not do the categories for now

const termninalEntries: TerminalEntry[] = [];
const terminals = this.terminalService.getInstanceLabels();

terminals.forEach((terminal, index) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

terminalEntries = terminals.map(terminal => {
  ...
  return new TerminalEntry(...);
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, termnial typo :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@Lixire
Amy Qiu (Lixire) force-pushed the amqi/terminal-quickopen branch from fa39449 to 3a184ab Compare July 20, 2017 00:57
@roblourens
roblourens merged commit 224467e into master Jul 20, 2017
@Tyriar
Daniel Imms (Tyriar) deleted the amqi/terminal-quickopen branch July 20, 2017 03:10
@Tyriar Daniel Imms (Tyriar) added this to the July 2017 milestone Jul 20, 2017
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants