-
Notifications
You must be signed in to change notification settings - Fork 306
Fix cwd
issues when using Neomake
#261
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @chris-morgan (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
cwd
issues when using Neomakecwd
issues when using Neomake
autoload/rustfmt.vim
Outdated
call writefile(l:content, expand('%')) | ||
silent edit! | ||
normal! ggdG | ||
call setline(1, l:content) | ||
let &syntax = &syntax |
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.
The let &syntax = &syntax
is also not necessary anymore likely (if it ever was, but maybe due to the edit
that was used previously).
TLDR of the investigation: the problem is that expand('%')
here might be relative, but it was :lcd
ed before.
An alternative might be to use the full buffer name (save it before cd
ing), but I think just setting the lines is better than writing from outside.
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.
Actually expand('%')
should be the relative path after :lcd
- so there is some other reason for this (maybe a bug in Vim/Neovim even (NVIM v0.3.1 used by the reporter)).
Anyway, the cd
ing back should be done in a try … finally
block, because otherwise it might not change it back.
btw: as can be seen in neomake/neomake#2080 (comment) the error/issue shows up immediately when not using |
autoload/rustfmt.vim
Outdated
@@ -146,8 +146,8 @@ function! s:RunRustfmt(command, tmpname, fail_silently) | |||
let l:content = readfile(a:tmpname) | |||
endif | |||
|
|||
call writefile(l:content, expand('%')) | |||
silent edit! | |||
normal! ggdG |
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.
Just noticed that this should become normal! "_ggdG
to not mess with registers.
Please remove the mentioning of me before merging it, otherwise it will show up in notifications all over the place. Use |
ef7bb15
to
2cecf06
Compare
All credit to `@blueyed`. This fixes rust-lang#260 The investigation is in the corresponding Neomake issue: neomake/neomake#2080 This is also related to: rust-lang#259
2cecf06
to
8a17725
Compare
Thanks for trying - I was still notified of the new commits though.. :/ |
@da-x |
@blueyed I've seen you landed something in |
@dpc I suggest closing this for now - it can get re-opened later. |
@dpc @blueyed Looking over neoformat, I pushed 4c21791 to master. It should do something similar this PR, but without regressing over #236. The existing |
@da-x |
I've updated all vim plugins to latest and will keep working on my workspace-enabled project. I'll report any issues. Thanks everyone for looking into this! |
All credit to @blueyed .
This fixes #260
The investigation is in the corresponding Neomake issue:
neomake/neomake#2080
This is also related to: #259