Skip to content

Commit

Permalink
Autocomplete all elements whose exection argument is a valid filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Jun 7, 2018
1 parent 9c72513 commit 47f1e95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,11 @@ ipcMain.on(IpcChannels.openFileLocation, (event: any, arg: string): void => {
}
});

ipcMain.on(IpcChannels.autoComplete, (event: any, arg: string[]): void => {
const userInput = arg[0];
let executionArgument = arg[1];
ipcMain.on(IpcChannels.autoComplete, (event: any, executionArgument: string): void => {
const dirSeparator = Injector.getDirectorySeparator(platform());
const validator = new FilePathExecutionArgumentValidator();

if (new FilePathExecutionArgumentValidator().isValidForExecution(userInput)) {
if (validator.isValidForExecution(executionArgument)) {
if (!executionArgument.endsWith(dirSeparator) && fs.lstatSync(executionArgument).isDirectory()) {
executionArgument = `${executionArgument}${dirSeparator}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ts/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function handleAutoCompletion(): void {
const activeItem = getActiveItem();

if (activeItem !== undefined) {
ipcRenderer.send(IpcChannels.autoComplete, [vue.userInput, activeItem.executionArgument]);
ipcRenderer.send(IpcChannels.autoComplete, activeItem.executionArgument);
}
}

Expand Down

0 comments on commit 47f1e95

Please sign in to comment.