Open idbrii opened 9 years ago
This may be related to #38. If I remove the deletion from the test, then it passes:
Given clojure (simple valid function):
(defn say-hello
([name] (println (str "Hello " name
Do (add string and brace, check syn):
# Jump to end
j$
# Add string and brace and check syntax
a "!")\<C-r>=synIDattr(synID(line("."), col(".")-1, 0), "name")\<CR>
Expect clojure (Now passes: Append clojureParen.):
(defn say-hello
([name] (println (str "Hello " name "!")clojureParen
However, using the <Esc>a
insert-breaking trick does not work.
How does your vader report look like? For me, the first set of tests passes as long as I disable clojure-related plugins, namely rainbow parentheses and paredit.
Starting Vader: 1 suite(s), 2 case(s)
Starting Vader: /Users/jg/tmp/a.vader
(1/2) [ GIVEN] simple valid function
(1/2) [ DO] remove trailing braces, add brace, check syn
(1/2) [ EXPECT] Append clojureParen. Works fine for word-parens.
(2/2) [ GIVEN] simple valid function
(2/2) [ DO] remove trailing braces, add string and brace, check syn
(2/2) [ EXPECT] FIXME: Append clojureParen. Vader fails for quote-paren, but this works in vim.
Success/Total: 2/2
Success/Total: 2/2 (assertions: 0/0)
Elapsed time: 0.051618 sec.
But understandably, it fails with paredit and rainbow parens
Starting Vader: 1 suite(s), 2 case(s)
Starting Vader: /Users/jg/tmp/a.vader
(1/2) [ GIVEN] simple valid function
(1/2) [ DO] remove trailing braces, add brace, check syn
(1/2) [ EXPECT] (X) Append clojureParen. Works fine for word-parens.
- Expected:
(defn say-hello
([name] (println (str "Hello " name)clojureParen
- Got:
(defn say-hello
([name] (println (str "Hello " name))rainbowParensShell14))
(2/2) [ GIVEN] simple valid function
(2/2) [ DO] remove trailing braces, add string and brace, check syn
(2/2) [ EXPECT] (X) FIXME: Append clojureParen. Vader fails for quote-paren, but this works in vim.
- Expected:
(defn say-hello
([name] (println (str "Hello " name "!")clojureParen
- Got:
(defn say-hello
([name] (println (str "Hello " name) "!")rainbowParensShell14))
Success/Total: 0/2
Success/Total: 0/2 (assertions: 0/0)
Elapsed time: 0.088968 sec.
I expect clojureParen, but I get clojureError.
Using:
gvim -N -U NONE -u ~/vader.vimrc +Vader*
with ~/vader.vimrc:
filetype off
set rtp+=~/.vim/bundle/vader
filetype plugin indent on
syntax enable
And the above test as ~/bug.vader, I get these results:
Starting Vader: 1 suite(s), 2 case(s)
Starting Vader: ~/bug.vader
(1/2) [ GIVEN] simple valid function
(1/2) [ DO] remove trailing braces, add brace, check syn
(1/2) [ EXPECT] Append clojureParen. Works fine for word-parens.
(2/2) [ GIVEN] simple valid function
(2/2) [ DO] remove trailing braces, add string and brace, check syn
(2/2) [ EXPECT] (X) FIXME: Append clojureParen. Vader fails for quote-paren, but this works in vim.
- Expected:
(defn say-hello
([name] (println (str "Hello " name "!")clojureParen
- Got:
(defn say-hello
([name] (println (str "Hello " name "!")clojureError
Success/Total: 1/2
Success/Total: 1/2 (assertions: 0/0)
Elapsed time: 0.118564 sec.
Here's the output of :scriptnames
1: ~/vader.vimrc 2: C:/apps/Vim/vim74/ftoff.vim 3: C:/apps/Vim/vim74/filetype.vim 4: ~/.vim/bundle/vader/ftdetect/vader.vim 5: C:/apps/Vim/vim74/menu.vim 6: C:/apps/Vim/vim74/autoload/paste.vim 7: C:/apps/Vim/vim74/ftplugin.vim 8: C:/apps/Vim/vim74/indent.vim 9: C:/apps/Vim/vim74/syntax/syntax.vim 10: C:/apps/Vim/vim74/syntax/synload.vim 11: C:/apps/Vim/vim74/syntax/syncolor.vim 12: C:/apps/Vim/vim74/plugin/getscriptPlugin.vim 13: C:/apps/Vim/vim74/plugin/gzip.vim 14: C:/apps/Vim/vim74/plugin/matchparen.vim 15: C:/apps/Vim/vim74/plugin/netrwPlugin.vim 16: C:/apps/Vim/vim74/plugin/rrhelper.vim 17: C:/apps/Vim/vim74/plugin/spellfile.vim 18: C:/apps/Vim/vim74/plugin/tarPlugin.vim 19: C:/apps/Vim/vim74/plugin/tohtml.vim 20: C:/apps/Vim/vim74/plugin/vimballPlugin.vim 21: C:/apps/Vim/vim74/plugin/zipPlugin.vim 22: ~/.vim/bundle/vader/plugin/vader.vim 23: C:/apps/Vim/vim74/ftplugin/clojure.vim 24: C:/apps/Vim/vim74/indent/clojure.vim 25: C:/apps/Vim/vim74/syntax/clojure.vim
This is on gvim 7.4.52 on Windows downloaded from vim.org. (I believe this issue also occurred on Ubuntu with whatever is in the repos, but I haven't tried this minimized test.)
Hmm, okay, I can reproduce the same situation on GVim (in my case MacVim, to be precise), but not on terminal Vim. Have you tried it on a terminal Vim?
I wanted to see what's happening when the test is running on GVim, so I injected \<C-o>:redraw | normal! gs\<cr>
to the failing Do block, and suddenly it's working. :confused:
Do (remove trailing braces, add string and brace, check syn):
# Clear out the trailing braces
jf)D
# Add string and brace and check syntax
a "!")
\<C-o>:redraw | normal! gs\<cr>
\<C-r>=synIDattr(synID(line("."), col(".")-1, 0), "name")\<CR>
Sorry for resurrecting this zombie but I have similar issue for puppet syntax.
System Ubuntu 16.04 Vim 7.4 with extra patches: 8.0.0056 Neovim v0.2.3-dev Plugins:
set nocompatible
filetype off
set runtimepath+=vader.vim
set runtimepath+=.
set runtimepath+=after
filetype plugin indent on
syntax enable
I have this test for puppet comments with todo's tags https://github.com/mandos/vim-puppet/blob/vader-issue/test/syntax/comment.vader
First tests (space after todo) passed, in second one failing (no space after todo), it look like in line 35
I checked it in opened vim and syntax coloring looks fine and I got correct ID:
hi<puppetTodo> trans<puppetTodo> lo<Todo> systack<vaderGiven, vader_puppet, puppetComment, puppetTodo>
How to reproduce: Repo https://github.com/mandos/vim-puppet.git Branch vader-issue All commands should be run from project root folder:
TESTVIM=vim test/run-tests.sh test/syntax/comment.vader
vim -u test/init.vim test/syntax/comment.vader
@mandos FYI, you're using the new SyntaxAt
which didn't exist when I reported this (I think). Possibly SyntaxAt
should use the above redraw trick. Can you try that?
I'm using the clojure syntax files that come with my version of vim: 7.4.52. Using vader ad7f1b70ebcf76de86d1991732146f2ebabe3ba4.
When I write a test that tests clojure syntax, I get different results from vader and manually stepping through the test. (My project idbrii/vim-endoscope uses syntax ids to determine if something is a string as described in
:help searchpair()
.)Here's an example of a passing and failing test where the difference is that the line ends in a quote.
Inside my vader file, the syntax for embedded clojure is all messed up (it shows most trailing parens as errors -- even for balanced parens) and that also applies to my Do blocks.
Not sure if you can fix this. I also tried using ;-terminated blocks, but that doesn't help.