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
feat: allow vscode sync viewport with neovim #919
feat: allow vscode sync viewport with neovim #919
Conversation
Thanks for this PR!! It seems to work really well and also makes #885 work great! One thing I noticed is that when I do the lightspeed jump, it seems to consistently think the viewport is 1-1.5 lines smaller than it actually is: https://user-images.githubusercontent.com/16546293/170319389-f75da218-d496-46ea-ad13-229cb258d3ca.png |
Also, could you try to remove vscode-neovim/src/main_controller.ts Line 58 in 5491cbb
vscode-neovim/src/main_controller.ts Line 186 in 5491cbb
It would be ideal if the nvim window could be created with the correct height. |
I've found another bug with this PR: "jump to definition" or using the outline panel causes the viewport to jump to the new position and then instantly jump back. |
remove neovimViewPortHeight
src/cursor_manager.ts
Outdated
// ); | ||
// private commitScrollingFast = throttle(this.updateScreenRowFromScrolling, 200, { leading: false }); | ||
private onDidChangeVisibleRange = async (e: TextEditorVisibleRangesChangeEvent): Promise<void> => { | ||
if (e.textEditor !== window.activeTextEditor || !this.modeManager.isNormalMode) { |
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.
Should this be expanded to also include visual mode? Why is this check needed?
Unfortnately I'm not sure if the new commit solved the problem with navigating in the outline. It has to trigger a scroll for the issue to appear. Additionaly, would it be possible to rebase your commits on #775? I'm planning on merging it soon and it greatly simplifies the cursor setting logic. There is an obvious place to put |
you can merge it to master and I will rebase from the master. I click on the outline panel and it works. |
I think this is a timing problem. For me the issue is not from For me it happens about 80% of the time, especially on big files and big jumps. It jumps to the new position and then instantly jumps back. |
i just fix it. sorry, i am not using vscode daily. thank for helping me test |
Thanks! It seems to work for me now, I'll use it at work today and then merge if everything seems fine. |
Sorry for the long delay, got busy with work. Unfortunately, the new changes are pretty buggy, but I'm not sure how to fully reproduce the issue. Essentially, when I navigate around using lightspeed, and I jump to the botton of the file, and then jump in reverse, it doesn't make the whole screen grey, and I can't jump to the top ~5 lines. Moving the cursor does not fix this, only scrolling the viewport works. |
It seems as though the test, shown in the PR description, works perfectly. However, it seems the problem is somehow caused by lightspeed. |
sometimes, vscode emits a range changed event that contains one line. This might be caused by vscode-neovim, not sure. This ignores it.
if you scroll a editor without having the cursor inside, this will make it update when you switch back
all new buffers are created with the same height, and then are synced later. It does not make sense to create all new buffers with the height of the first open editor
Thanks @windwp for the initial work! I think this works very well now. |
@theol0403 nice work 👍 |
@windwp @theol0403 Please take a look at #993 (comment), this PR is causing that issue. |
This reverts commit 3036a5a.
…)" This reverts commit 3036a5a.
Problem:
Currently, the neovim viewport is always 200 and it uses scrolloff=100 to make the cursor always on center.
Solution:
this PR remove scrolloff=100 . It resize the height and scroll the neovim viewport.
PS: i use it for test.