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

jdaddy chokes on large JSON objects when cursor is at the top. #7

Open
adamtaylor13 opened this issue Mar 27, 2018 · 4 comments
Open

Comments

@adamtaylor13
Copy link

I was using this plugin with a really large JSON object (48k) and jdaddy would not work if I had my cursor anywhere near the beginning. I tried it on the opening bracket, and on the first key—both times it simply wouldn't run.

Through a fluke, I tried it on the end bracket and it worked. Not sure if this is a known limitation with large files. Also I was working on a sensitive work-related JSON object so I can't paste the actual object I was using. :( Sorry!

Steps to reproduce:

  1. Get large JSON object (>=48k?)
  2. Have it all ugly and not parsed. (It was also on one line.. Not sure if that mattered)
  3. Try to run gqaj on first bracket, or near beginning of line.
  4. Try to run gqaj on ending bracket

If I can help debug this in any way please let me know! I'm a novice Vim user, so I'm not familiar with Vimscript in anyway currently.

Thanks!

@tpope
Copy link
Owner

tpope commented Mar 27, 2018

You can start by checking if the text object works. See if vaj selects the object.

@adamtaylor13
Copy link
Author

It appears to work if I type vaj from the back of the line. If I type if from the beginning of the line, it doesn't. Not sure if that's the correct behavior. But it seems that would explain why the jdaddy would only work from the end of the line.

Should vaj select the whole line from both the start and the end?
If so, any tips on where I could start debugging this behavior?

Thanks the help!

@tpope
Copy link
Owner

tpope commented Mar 27, 2018

Try debugging the lines and columns returned by :echo jdaddy#outer_pos(). Afraid I can't offer much more help than that.

@adamtaylor13
Copy link
Author

Looks like from the beginning of the object it returns [0, 0, 0, 0] but from the end of the object it returns [1, 1, 1, 65099]. Also, it seems like it affects the behavior if it's on a single line, perhaps?

Anyway, this seems like quite an edge case, but seeing as how it was my first time using it, I figured I'd open an issue to log it. I may try to get into the Vimscript and see if I can't open a PR to help fix it.

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

No branches or pull requests

2 participants