Describe the bug
When I edit a Groovy file Vim throws an error:
"foo.groovy" [New]
Error detected while processing BufNewFile Autocommands for "*.groovy"..FileType Autocommands for "*"..Syntax Autocommands for "*"..function <SNR>6_SynSet[25]..script /opt/local/share/vim/vim82/syntax/groovy.vim:
line 256:
E945: Range too large in character class
Press ENTER or type command to continue
To Reproduce
Just run: vim foo.groovy
Expected behavior
Nice syntax highlighting and no errors :)
Environment:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 2 2020 14:07:35)
macOS version
Included patches: 1-1719
Compiled by MacPorts
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 -perl +title
-clientserver +job +persistent_undo -toolbar
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak +python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
-cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape +lua -ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval -mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "/opt/local/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -DMACOS_X -DMACOS_X_DARWIN -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64 -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/opt/local/lib -llua -L/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G6032
Built in OS X Terminal Version 2.9.5 (421.2)
Additional context
I installed Vim via MacPorts: vim @8.2.1719_0+huge+lua+python37
The version information given at the head of the /opt/local/share/vim/vim82/syntax/groovy.vim is as follows:
" Vim syntax file
" Language: Groovy
" Original Author: Alessio Pace <billy.corgan AT tiscali.it>
" Maintainer: Tobias Rapp <yahuxo+vim AT mailbox.org>
" Version: 0.1.17
" URL: http://www.vim.org/scripts/script.php?script_id=945
" Last Change: 2020 May 26
Commenting out line 256 fixes the issue. However, I'm guessing that someone who knows what they are doing could provide a better fix!!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
can you please contact the maintainer of the syntax file for this error?
Just run: vim foo.groovy
Can't reproduce.
Just saying that you can't reproduce without giving some more info about your environments is not especially helpful.
I CAN reproduce this error running vim foo.groovy using Vim 8.2 on OS X
I CANNOT reproduce this error running vim foo.groovy using Vim 8.1 on Debian 10
If you cannot reproduce this and are using Vim 8.2 on OS X then that would of course be something worth knowing...
Just saying that you can't reproduce without giving some more info about your environments is not especially helpful.
Well, now we know that you have no problem in debian 10 using vim 8.1. :)
Now the question whether this because you have different vim config there or the vim version or OS? Have you tried it with vim --clean?
PS, I have no issue opening vim foo.groovy:
Both have vim version 8.2.1975
Can you please also check your encoding?
Just saying that you can't reproduce without giving some more info about your environments is not especially helpful.
It is helpful; it lets you know that you didn't post a minimal working example, which the issue template asked for:
To Reproduce
Detailed steps to reproduce the behavior:
- Run
vim --clean(orgvim --clean, etc.)
I can't reproduce on Vim 8.2.1973 and Ubuntu 16.04.
At first I could not reproduce it either, but then I managed to reproduce using:
:set re=1
:e /tmp/foo.groovy
And I got:
Error detected while processing BufNewFile Autocommands for "*.groovy"..FileType
Autocommands for "*"..Syntax Autocommands for "*"..function <SNR>10_SynSet[25].
.script /usr/local/share/vim/vim82/syntax/groovy.vim:
line 256:
E945: Range too large in character class
Somehow the regexp works with the new engine but not the old one.
This reproduces it:
$ vim --clean -c 'set re=0' -c '/[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE0-9_.]\?'
(no error)
$ vim --clean -c 'set re=1' -c '/[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE0-9_.]\?'
Error detected while processing command line:
E945: Range too large in character class
This is on Linux x86-64, Vim-8.2.1975 (huge).
A workaround should be have this in your ~/.vimrc:
set re=0
A workaround should be have this in your ~/.vimrc:
set re=0
Isn't it default value?
@habamax wrote:
set re=0
Isn't it default value?
Yes, but I suppose that the bug submitter is not using the default value i.e. he has set re=1 (or set regexpengine=1) in his ~/.vimrc.
so perhaps insert an \%#=2 before that pattern? Like this:
diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index 9bc1bd6d8..ad4538da5 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -253,7 +253,7 @@ if exists("groovy_regex_strings") endif " syn region groovyELExpr start=+${+ end=+}+ keepend contained syn match groovyELExpr /\${.\{-}}/ contained -syn match groovyELExpr /\$[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE_][a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE0-9_.]*/ contained +syn match groovyELExpr /\%#=2\$[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE_][a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE0-9_.]*/ contained hi def link groovyELExpr Identifier " TODO: better matching. I am waiting to understand how it really works in groovy
Anybody wants to notify the maintainer?
Yes, but I suppose that the bug submitter is not using the default value i.e. he has
set re=1(orset regexpengine=1) in his~/.vimrc.
Which would probably be clear if OP used vim --clean I guess? :)
Apologies - I missed the vim --clean instruction.
@dpelle is right. Thank you for finding the cause.
I have set regexpengine=1 in my .vimrc. I had this set as using the old regex engine was supposedly faster with Ruby files.
As @habamax pointed out the default is set regexpengine=0. Commenting out set regexpengine=1 or explicitly setting set regexpengine=0 fixes the issue.
I have the exact same setting in my .vimrc on my Debian box. However, this has a different version of the groovy Vim syntax file (0.1.16) - without the troublesome regexp.
so perhaps insert an %#=2 before that pattern?
I've just tried that (with set re=1 in my .vimrc) and I no longer get the error
I don't think we are going to add the regexp engine selection to all the syntax file patterns.
You can ask the groovy file maintainer if he wants to add it to this specific pattern, but I don't see a reason to keep this Vim issue open.
Closed #7280.
vim --version shows me
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 23 2020 06:06:20)
macOS version
Included patches: 1-850
Compiled by ro...@apple.com
cat ~/.vimrc looks like
set number
set nocompatible
set spell spelllang=en_us
syntax on
colo default
set re=1
can you check if this still happens with updated runtime files? Have you contacted the runtime file maintainer?
can you check if this still happens with updated runtime files?
Sorry, you have to explain. How to update runtime files on a macOS ?
for one, you could simply copy over the groovy syntax file from this repository and see if this helps.
for one, you could simply copy over the groovy syntax file from this repository and see if this helps.
This is a difficult task for someone who is absolute new to this vim-error-searching
I'm just a vim user !
I neither found artifacts in master-Github-action build , nor in release
You have to tell me which file(s) I've to copy to where
'regexpengine' is only meant to be reset while debugging some issue with a regex:
Remove this line from your vimrc:
set re=1
You have to tell me which file(s) I've to copy to where
The groovy syntax file has not been updated since the issue was posted; copying it won't help you.
it might have been updated since 8.2.950, which is the version @hannesa2 is using. a test won't hurt, simply copy https://github.com/vim/vim/blob/master/runtime/syntax/groovy.vim to ~/.vim/syntax/ (create non-existing directories).
But I agree, setting the regexpengine should not be needed in general.
Just to confirm:
Deleting set re=1 from my .vimrc fixed the issue for me - this is the 'correct' way to fix this.
set re=1 in my .vimrc to work around an old issue with Ruby syntax highlighting that has since been fixed.Adding \%#=2 to the runtime/syntax/groovy as per chrisbra's suggestion above also fixed the issue when I still had set re=1 in my .vimrc.
set re=1.Editing a groovy file throws the same error for me and adding set regexpengine=0 to my .vimrc fixes it.
What I don't understand is, if I remove set regexpengine from my .vimrc it seems to default to 1, while the comments in this issue suggest that the default should be 0.
Is there any other setting that could have an effect on the regexpengine version?
15:43 $ grep 'set re' ~/.vimrc : autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
VIM version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 29 2020 23:33:57) macOS version Included patches: 1-850 Compiled by ro...@apple.com Normal version without GUI. Features included (+) or not (-): +acl -farsi +mouse_sgr +tag_binary -arabic +file_in_path -mouse_sysmouse -tag_old_static +autocmd +find_in_path -mouse_urxvt -tag_any_white +autochdir +float +mouse_xterm -tcl -autoservername +folding +multi_byte -termguicolors -balloon_eval -footer +multi_lang +terminal -balloon_eval_term +fork() -mzscheme +terminfo -browse -gettext +netbeans_intg +termresponse +builtin_terms -hangul_input +num64 +textobjects +byte_offset +iconv +packages +textprop +channel +insert_expand +path_extra +timers +cindent -ipv6 -perl +title -clientserver +job +persistent_undo -toolbar +clipboard +jumplist +popupwin +user_commands +cmdline_compl -keymap +postscript -vartabs +cmdline_hist +lambda +printer +vertsplit +cmdline_info -langmap -profile +virtualedit +comments +libcall +python/dyn +visual -conceal +linebreak -python3 +visualextra +cryptv +lispindent +quickfix +viminfo +cscope +listcmds +reltime +vreplace +cursorbind +localmap -rightleft +wildignore +cursorshape -lua +ruby/dyn +wildmenu +dialog_con +menu +scrollbind +windows +diff +mksession +signs +writebackup +digraphs +modify_fname +smartindent -X11 -dnd +mouse -sound -xfontset -ebcdic -mouseshape +spell -xim -emacs_tags -mouse_dec +startuptime -xpm +eval -mouse_gpm +statusline -xsmp +ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard +extra_search -mouse_netterm +syntax -xterm_save system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa
What I don't understand is, if I remove set regexpengine from my .vimrc it seems to default to 1, while the comments in this issue suggest that the default should be 0.
No, the default is clearly documented to be 0, see e.g. in the documentation https://vimhelp.org/options.txt.html#'regexpengine'
Or type :h 'regexpengine' in your vim
What could happen (and what has just been recently adjusted in a patch), that sometimes with :set regexpengine=0 Vim silently switches to the old engine (regexpengine=1), without the user noting. This has recently been changed for collations and ranges.
No, the default is clearly documented to be 0, see e.g. in the documentation https://vimhelp.org/options.txt.html#'regexpengine'
Sorry, I never wanted to question that the default is really 0, i wanted to understand why my installation, even though i cant find setting the regexpengine in any config files, starts with regexpengine=1.
My thoughts were that there might be another setting that influences the regexpengine, I've overlooked a config file that ist not mentioned in the vim --version output or a plugin can change the setting.
If you still have this issue, use the :verbose modifier to ask Vim what is the last script file which has altered the option:
set re?
I forgot :verbose:
verbose set re?
^-----^
Thank you, I didn't know that verbose can tell me where a setting was altered. But in this case it doesn't help me.
Running vim --clean and :verbose set re? only tells me regexpengine=1 while it works for other settings that got altered by config files.
Compiling vim from source doesn't show this behaviour 🤔
@msamendinger wrote:
Compiling vim from source doesn't show this behaviour
Yes it does. Building vim-8.2.2445 (latest in git repo):
$ cd vim/src
$ ./vim --clean -c 'set re=1' -c 'e foo.groovy'
...snip...
E945: Range too large in character class
There is a lot of discussion for something which is a known problem.
The maintainer of Groovy should apply the patch from
@chrisbra i.e. #7280 (comment)
if we accept that the old regexp engine won't be changed to support
this kind of regexp.
Again I haven't been very clear, sorry.
Running vim --clean and :verbose set re? only tells me regexpengine=1
Running the apple compiled vim with my config results in regexpengine=1, running my self compiled vim results in regexpengine=0 with my configuration.
so does the apple vim set the regexpengine=1 anywhere in its configuration files? So what does :verbose :set regexpengine? output in the vim that comes from Apple?
If this just outputs: regexpengine=1 that hints that Apple patches the default value in the C files and does not set this setting via a configuration file, which sounds strange.
What I tried was to grep for set re in all the rc files shown in vim --version output. Theres no match.
And running :verbose :set regexpengine? only outputs regexpengine=1, not sure though where to get more information on how apple builds their vim. I asked some colleagues to test their installations.
What I tried was to grep for
set rein all the rc files shown invim --versionoutput. Theres no match.
And running:verbose :set regexpengine?only outputsregexpengine=1, not sure though where to get more information on how apple builds their vim. I asked some colleagues to test their installations.
Based on the code below (search for regexpengine):
https://opensource.apple.com/source/vim/vim-91.80.1/src/optiondefs.h.auto.html
It looks like Apple did change the default value for the 'regexpengine'
option to 1.
Thanks, this not only explains the behaviour but in addition I learned about opensource.apple.com
—
You are receiving this because you commented.
can you please report this as a bug to Apple? And perhaps also notify the runtime file maintainer so he can fix it on his side as well?
Thanks.
I filed a bug with apple and notified the maintainer. Will report back.
Hm, I'm seeing this behavior on Debian 9.12, with vim 8.0 (full version below), and in my case running :verbose set regexpengine? exposed an ftplugin that was setting regexpengine=1:
Last set from ~/dotfiles/vim/.vim/pack/timblaktu/start/ansible-vim/ftplugin/ansible.vim
So, in my case, I suppose the answer is to make sure ftplugin/ansible.vim isn't running for groovy files..
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 16 2018 17:48:09)
Included patches: 1-1428
Compiled by timb...@gmail.com
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
++builtin_terms -gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages -toolbar
+cindent +insert_expand +path_extra +user_commands
-clientserver +job +perl +vertsplit
-clipboard +jumplist +persistent_undo +virtualedit
+cmdline_compl +keymap +postscript +visual
+cmdline_hist +lambda +printer +visualextra
+cmdline_info +langmap +profile +viminfo
+comments +libcall +python/dyn +vreplace
+conceal +linebreak +python3/dyn +wildignore
+cryptv +lispindent +quickfix +wildmenu
+cscope +listcmds +reltime +windows
+cursorbind +localmap +rightleft +writebackup
+cursorshape -lua +ruby -X11
+dialog_con +menu +scrollbind -xfontset
+diff +mksession +signs -xim
+digraphs +modify_fname +smartindent -xpm
-dnd +mouse +startuptime -xsmp
-ebcdic -mouseshape +statusline -xterm_clipboard
+emacs_tags +mouse_dec -sun_workshop -xterm_save
+eval -mouse_gpm +syntax
+ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/stow/vim/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -ldl -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.24/CORE -lperl -ldl -lm -lpthread -lcrypt -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm
regexpengine=1
Last set from ~/dotfiles/vim/.vim/pack/timblaktu/start/ansible-vim/ftplugin/ansible.vim
I think you should report that to the maintainer of the ftplugin. I don't think filetype plugins should set the regexpengine setting, that is more for users to set globally.
Ah, looks like this has already been taken care of: pearofducks/ansible-vim@19e6ae0
Thanks for that. Indeed, updating that plugin to latest 3.0 tag seems to prevent the error.. so far. It was somewhat intermittent to begin with, but I believe it was happening lately bc I've been working in a vim session with several windows, editing both .yml and .groovy at the same time..
I filed a bug with apple and notified the maintainer. Will report back.
EDIT: Tobias the maintainer of the groovy syntax runtime file answered on the same day and said he will send the updated syntax file to Bram. No update from Apple yet. I opened a bug in the feedbackassistant and mailed opens...@apple.com
The groovy syntax file was updated 942db23
No response from apple yet.