diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-03-26 22:17:00 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-03-26 22:17:00 +0900 |
commit | b2a37b8fc3e273dd71e1e3558c58be8002aa3789 (patch) | |
tree | 9e6f0d354beca92e975dc97462b3860833112f81 /src/console/components/Console.tsx | |
parent | 6829e24c62c0291336502b3390905b57b81abd21 (diff) |
Query completions on open command by a completion source
Diffstat (limited to 'src/console/components/Console.tsx')
-rw-r--r-- | src/console/components/Console.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/console/components/Console.tsx b/src/console/components/Console.tsx index 0a102a0..7be073e 100644 --- a/src/console/components/Console.tsx +++ b/src/console/components/Console.tsx @@ -7,6 +7,7 @@ import Message from './console/Message'; import * as consoleActions from '../../console/actions/console'; import { State as AppState } from '../reducers'; import CommandLineParser, { InputPhase } from "../commandline/CommandLineParser"; +import { Command } from "../../shared/Command"; const COMPLETION_MAX_ITEMS = 33; @@ -163,7 +164,16 @@ class Console extends React.Component<Props> { if (phase === InputPhase.OnCommand) { return this.props.dispatch(consoleActions.getCommandCompletions(text)); } else { - this.props.dispatch(consoleActions.getCompletions(text)); + const cmd = this.commandLineParser.parse(text); + switch (cmd.command) { + case Command.Open: + case Command.TabOpen: + case Command.WindowOpen: + this.props.dispatch(consoleActions.getOpenCompletions(this.props.completionTypes, text, cmd.command, cmd.args)); + break; + default: + this.props.dispatch(consoleActions.getCompletions(text)); + } } } } |