Skip to content
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

bug: Neovim not spawned in appropriate directory (fixes #2482) #2522

Merged
merged 5 commits into from
Apr 13, 2018

Conversation

Chillee
Copy link
Member

@Chillee Chillee commented Apr 9, 2018

This makes the neovim process spawn in the directory of the file it's opened in.

@TravisBuddy
Copy link

Travis tests have failed

Hey @Chillee,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 8

if [[ $(git diff-index HEAD --) ]]; then git diff; echo "Prettier Failed. Run `gulp` or `gulp forceprettier`"; exit 1; fi
diff --git a/src/neovim/neovim.ts b/src/neovim/neovim.ts
index ed17d4c..84b61c2 100644
--- a/src/neovim/neovim.ts
+++ b/src/neovim/neovim.ts
@@ -17,7 +17,7 @@ export class Neovim implements vscode.Disposable {
   async initialize() {
     const dir = dirname(vscode.window.activeTextEditor!.document.fileName);
     this.process = spawn(configuration.neovimPath, ['-u', 'NONE', '-N', '--embed'], {
-      cwd: dir
+      cwd: dir,
     });
     this.process.on('error', err => {
       console.log(err);
Warning: The 'no-use-before-declare' rule requires type information.
Prettier Failed. Run [14:42:16] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[14:42:16] Starting 'prettier'...
[14:42:16] Starting 'tslint'...
[14:42:16] Starting 'compile'...
[14:42:17] Finished 'prettier' after 1.04 s
[14:42:20] Finished 'tslint' after 4.51 s
[14:42:28] Finished 'compile' after 12 s
[14:42:28] Starting 'default'...
[14:42:28] Finished 'default' after 38 μs or [14:42:29] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[14:42:29] Starting 'forceprettier'...
[14:42:38] Finished 'forceprettier' after 9.61 s

@@ -14,8 +15,9 @@ export class Neovim implements vscode.Disposable {
private nvim: Nvim;

async initialize() {
const dir = dirname(vscode.window.activeTextEditor!.document.fileName);
Copy link
Member

Choose a reason for hiding this comment

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

I think what you want is this vscode.window.activeTextEditor!.document.uri.fsPath

Copy link
Member Author

Choose a reason for hiding this comment

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

In the documentation, it said that this is

		/**
		 * The file system path of the associated resource. Shorthand
		 * notation for [TextDocument.uri.fsPath](#TextDocument.uri). Independent of the uri scheme.
		 */

so I didn't think there was a difference.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, that's confusing. Generally, I would understand things named as fileName to be just the file name (source.ts), whereas filePath would be a file path (/my/dir/source.ts)

@Chillee Chillee merged commit db241e7 into VSCodeVim:master Apr 13, 2018
@jpoon jpoon changed the title Fixes #2482: Neovim not spawned in appropriate directory bug: Neovim not spawned in appropriate directory (fixes #2482) Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants