-
Notifications
You must be signed in to change notification settings - Fork 135
Create tests for bugs reported about empty lines in strings vs indentation (#159) #160
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
base: master
Are you sure you want to change the base?
Conversation
…ation (rodjek#159) Those are all of the examples that match the reported indentation errors. The very strange thing is that all of the new tests fail, but they fail differently in vader than how they do in an interactive (n)vim session. The result that we get in those tests is usually that the string contents get wrongly moved to fit indentation. However, when I run the indentation command in the editor, the string contents don't change but things afterwards get indented at the wrong level. I'm not sure why the tests don't behave in the same way.
|
@alexjfisher fyi I've created new tests with the reproducing examples you reported in #159 like I described in the commit message vader.vim is failing on all of these, but not in the same way that we've both seen :( I wonder if I got something wrong. but if I run indentation with |
|
For the life of me, I can't work out what's going on in the tests, and why it's different. |
|
Now I have even less of a clue as to what's going on. --- a/indent/puppet.vim
+++ b/indent/puppet.vim
@@ -47,6 +47,7 @@ function! s:OpenBrace(lnum)
endfunction
function! s:InsideMultilineString(lnum)
+ let g:wtf = synID(line("$"), 1, 0)
return synIDattr(synID(a:lnum, 1, 0), 'name') =~? 'string'
endfunctionWith this simple test: without my seemingly pointless change... But with the dumb patch |
|
wat.. I'm thouroughly confused as to what the unit test plugin is doing here :( it's too bad since it was working fine for most other tests. also from what I've seen so far, it's pretty much the only one that lets us test what (n)vim is doing when running actual commands on a test buffer. I've also tried to load nvim with the test vimrc file with we may have stumbled upon a vader.vim bug there |
|
I think it's just a race condition. The syntax hasn't been evaluated by the time |
Try and wait for syntax to be fully evaluated before running the indexing command Co-authored-by: Alexander Fisher <[email protected]>
Things really did change with the addition of the wait for the syntax. Apparently as @alexjfisher said, the format function needs its calls to get the correct syntax ID so we need the syntax file to be fully loaded before trying to format things.
|
@alexjfisher nice that seems to help, thanks! and your reasoning for the need to call that sync to wait for syntax is sound. it's been a long while since I touched the code in this module.. I've implemented the same thing on all tests. now the new mystery is ... well all of the tests are now passing which is not what we were expecting so far: the tests are not replicating the odd removals of spaces on empty lines and the odd indentation after a string with an empty line 🤔 Note: the vim 8 tests that fail seem to be unrelated to this MR. |
Those are all of the examples that match the reported indentation errors.
The very strange thing is that all of the new tests fail, but they fail differently in vader than how they do in an interactive (n)vim session. The result that we get in those tests is usually that the string contents get wrongly moved to fit indentation. However, when I run the indentation command in the editor, the string contents don't change but things afterwards get indented at the wrong level. I'm not sure why the tests don't behave in the same way.