-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix :tabe {file} only relative to current file (#1162) #2400
Fix :tabe {file} only relative to current file (#1162) #2400
Conversation
VSCodeVim#1162 :tabe {file} will now search through the first folder in your workspace (if available) to try to open {file}. If you are not in a workspace, :tabe {file} will search relative to your current file.
Travis tests have failedHey Russell Kennington, Node.js: 8gulp forceprettier
|
@@ -43,7 +43,7 @@ export class TabCommand extends node.CommandBase { | |||
} | |||
} | |||
|
|||
execute(): void { | |||
async execute(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that we should make this async
. However, can you update the other return paths to also return a promise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpoon I await
ed everything I could with the following two exceptions:
await vscode.commands.executeCommand('workbench.action.openEditorAtIndex1');
never resolves. I think it may be a bug with VSCode, so I should reproduce it in a small extension and open an issue on the VSCode repo.vscode.commands.executeCommand('activeEditorMove')
needs to be updated tovscode.commands.executeCommand('moveActiveEditor')
. It isn't quite a simple name replacement, so it should probably be done in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #2401 for the refactoring.
Thanks @arussellk |
Fixes #1162
What this PR does / why we need it
This PR extends the logic for
:tabe
to better match user expectation.:tabe
now handles the following situations::tabe {file}
when you have a workspace open will try to open{file}
relative to the root of your first workspace folder:tabe {file}
when you do not have a workspace will fall back to open{file}
relative to your current document:tabe
will open an untitled document:tabe {absolutePath}
will open{absolutePath}
Which issue(s) this PR fixes
Fixes #1162
Special notes for your reviewer
fs.mkdir
to make a folder because I kept getting aEACCES: permission denied, mkdir
error. Because of that, I did not add tests for when a user is in a workspace. I did add tests for the other cases that:tabe
handles.export
ingtestUtils.ts function createRandomFile
for use in my tests.