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

option to choose/disable textobjects-move module adding to jumplist #50

Closed
ranjithshegde opened this issue Apr 13, 2021 · 12 comments
Closed
Labels
enhancement New feature or request

Comments

@ranjithshegde
Copy link
Contributor

ranjithshegde commented Apr 13, 2021

Is your feature request related to a problem? Please describe.
I'm always frustrated when [not a problem exactly, but when textobject/move adds to jumplist.]

Describe the solution you'd like
I would like to just move away to my hearts content around the code and not worry about populating the jumplist with textobject@loop.outer, etc..

Additional context
Textobjects/move is a great feature. it makes navigating through code so much more intuitive, especially in large pages. But I would like to keep the jumplist separate so I can navigate back only to places where I have some edits instead of revisiting random "inspection" jumps from the past. It would make the move module even more necessary and good to use.

Goes without saying, thanks for this plugin, for me personally this and playground are the most important tree-sitter modules to be!

@ranjithshegde ranjithshegde added the enhancement New feature or request label Apr 13, 2021
theHamsta added a commit to theHamsta/nvim-treesitter-textobjects that referenced this issue Apr 13, 2021
@theHamsta
Copy link
Member

Could you try #51? This only applies to the textobject.move module right?

@ranjithshegde
Copy link
Contributor Author

ranjithshegde commented Apr 13, 2021

yes, it is for textobject.move

Thank you so much not only for the PR but also the speed of it!

EDIT:---
@theHamsta I was wrong. Now it still does add to jumps (even with set_jumps = false) just does not add it immediately

@theHamsta
Copy link
Member

theHamsta commented Apr 13, 2021

What do you mean by immediatelly? Maybe there is something that implicitly sets jumps.

The PR only avoids to call https://github.com/theHamsta/nvim-treesitter/blob/06a6510637352251b1d43a1e81d3a9d951cfd0a5/lua/nvim-treesitter/utils.lua#L132-L134 explicitly. Can you check whether this line still gets called on your machine?

We use nvim_win_set_cursor which does not set jump on my machine (at least does not consider the textobject.move commands). Would :h setpos here (https://github.com/theHamsta/nvim-treesitter/blob/06a6510637352251b1d43a1e81d3a9d951cfd0a5/lua/nvim-treesitter/ts_utils.lua#L302) change the behavior for you that has in its doc that it does not set jumps.

@ranjithshegde
Copy link
Contributor Author

By immediately I mean the "normal" jump lists are set as and when the jumps happen. But with the feature of the PR, (textobject.move with set_jumps=false), the jumplist for the move is updated only when I exit the buffer, not until then.

I will check for the call in a few hours!

@ranjithshegde
Copy link
Contributor Author

ranjithshegde commented Apr 13, 2021

Can you check whether this line still gets called on your machine?

Just added an echo to it to see whether it gets called. With the set_jumps set to false, it does not call the function! and it calls when set to true! so it is working as desired.

It is strange that it still updates the jump list, only on buffer exit

@theHamsta
Copy link
Member

I'm really not an expert on how this works. Is there a sequence of commands on how o can reproduce this so I can ask about it (nvim_set_cursor) at Nvim gitter?

Do you have the same problem when you just call nvim_set_cursor instead of the text object movements?

@ranjithshegde
Copy link
Contributor Author

ranjithshegde commented Apr 13, 2021

I'm really not an expert on how this works. Is there a sequence of commands on how o can reproduce this so I can ask about it (nvim_set_cursor) at Nvim gitter?

I honestly dont know how to reproduce it as its not always consistent. For what its worth, I would do these:

  1. Open a buffer with lots of functions/classes/symbols to jump around in
  2. execute the textobject.move jumps
  3. check :jumps to see if these are added (it wont have)
  4. exit session
  5. open vim, same or different session/buffer and check :jumps. good chance it would have updated the said jumps

Do you have the same problem when you just call nvim_set_cursor instead of the text object movements?

Sorry but i dont know how to call nvim_win_set_cursor(opts). if you mean the default vim jumps such as ]], ]} etc.. then they dont have this problem. they update/add to jump list immediately when called/jumped

@theHamsta
Copy link
Member

This is the only move related function that we are calling (second argument cursor pos)

:lua vim.api.nvim_win_set_cursor(0, {2,2})

When you can reproduce your issue only by calling this function then it's likely a Neovim issue.

I can't reproduce your issue. I never see any jumps with :jumps when set_jumps = false. For me it only sets a jump at the exact position where you exited nvim

@ranjithshegde
Copy link
Contributor Author

you are right! I can reproduce calling the _set_cursor(args) function.
I suppose its a neovim issue.

Then your PR works wonderfully!
Thank you

@theHamsta
Copy link
Member

theHamsta commented Apr 14, 2021

Maybe you open an issue at Neovim. I'm sure they can help you much more than I. I'll ask on gitter whether this function is supposed to set any jumps.

@ranjithshegde
Copy link
Contributor Author

Thank you for the help with gitter! I will create an issue on neovim later today. Also for this feature!

Shall I close?

theHamsta added a commit to theHamsta/nvim-treesitter-textobjects that referenced this issue Apr 14, 2021
@theHamsta
Copy link
Member

It will be automatically closed once the PR is merged.

@stsewd stsewd closed this as completed in e3020dc Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants