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

Autocommands sometimes not parsed correctly anymore, since 8.2.1365 #6634

Closed
bfrg opened this issue Aug 6, 2020 · 10 comments
Closed

Autocommands sometimes not parsed correctly anymore, since 8.2.1365 #6634

bfrg opened this issue Aug 6, 2020 · 10 comments

Comments

@bfrg
Copy link
Contributor

bfrg commented Aug 6, 2020

Describe the bug
Since bb1b5e2 (8.2.1365) autocommands are not always parsed correctly anymore.

To Reproduce

  1. Run vim --clean test.vim -S test.vim with
    augroup test
        autocmd!
        autocmd BufReadPost *
                \ if !exists("g:leave_my_cursor_position_alone") |
                \     if line("'\"") > 0 && line ("'\"") <= line("$") |
                \         exe "normal! g'\"" |
                \     endif |
                \ endif
    augroup END
  2. Run :edit foo | buffer #. Alternatively put the cursor on a keyword and press K.
  3. Result:
    Error detected while processing BufRead Autocommands for "*":
    E121: Undefined variable: line
    

Expected behavior
No errors.

Environment
Vim version 8.2.1377

@lacygoill
Copy link

Simpler example:

vim -Nu NONE +"echo line ('.')"

In the original example, the regression is triggered by an extra space on line 5:

\     if line("'\"") > 0 && line ("'\"") <= line("$") |
                                ^
                                ✘

@bfrg
Copy link
Contributor Author

bfrg commented Aug 6, 2020

Thank you. I didn't notice the space. The snippet is from /etc/vim/vimrc provided by my distro.

@chrisbra
Copy link
Member

chrisbra commented Aug 6, 2020

I would say, it's a good thing that it errors on the extra space.

@jottkaerr
Copy link

I would beg to differ. IMHO white space inside a line is a purely aesthetic decision and should never be enforced by syntax rules. For example, I find something like

let s = 'initial value'
let s = do_something     (s, 'text',      1)
let s = do_something_else(s, 'more text', 2)

much more readable than

let s = 'initial value'
let s = do_something(s, 'text', 1)
let s = do_something_else(s, 'more text', 2)

I have been bitten by this regression today, also. And in my case it was triggered by multiple plugins from other authors that used spaces before and after parentheses.

@WolfgangMehner
Copy link

I have been bitten by this regression today, also. And in my case it was triggered by multiple plugins from other authors that used spaces before and after parentheses.

This causes huge problems for me as well. I agree with @jottkaerr, you should not conflate the syntax and linting, because linting is optional, the syntax of the language obviously is not.

@chrisbra
Copy link
Member

chrisbra commented Aug 6, 2020

i think it is fixed by bbd3e3c

@bfrg
Copy link
Contributor Author

bfrg commented Aug 6, 2020

Thank you. Looks like it works again. Therefore closing.

@bfrg bfrg closed this as completed Aug 6, 2020
@jottkaerr
Copy link

Yes, spaces around parentheses seem to work now, but there is still a problem with spaces around braces

Error detected while processing C:\Users\JKR\.vim\plugin\perl-support.vim
[238]..function <SNR>63_GetGlobalSetting:
line    4:
E720: Missing colon in Dictionary: }

The relevant line is

		let { 's:'.lname } = { 'g:'.gname }

@bfrg bfrg reopened this Aug 6, 2020
@WolfgangMehner
Copy link

To be precise, the problem is with "curly braces names", not dictionaries. The error message is slightly off here.

@brammool
Copy link
Contributor

brammool commented Aug 6, 2020 via email

janlazo added a commit to janlazo/neovim that referenced this issue Aug 8, 2020
Problem:    Curly braces expression ending in " }" does not work.
Solution:   Skip over white space when checking for "}". (closes vim/vim#6634)
vim/vim@ae95a39
janlazo added a commit to janlazo/neovim that referenced this issue Aug 9, 2020
Problem:    Curly braces expression ending in " }" does not work.
Solution:   Skip over white space when checking for "}". (closes vim/vim#6634)
vim/vim@ae95a39
janlazo added a commit to janlazo/neovim that referenced this issue Aug 12, 2020
Problem:    Curly braces expression ending in " }" does not work.
Solution:   Skip over white space when checking for "}". (closes vim/vim#6634)
vim/vim@ae95a39
janlazo added a commit to janlazo/neovim that referenced this issue Aug 15, 2020
Problem:    Curly braces expression ending in " }" does not work.
Solution:   Skip over white space when checking for "}". (closes vim/vim#6634)
vim/vim@ae95a39
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

6 participants