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

Vim patch v8.2.0578 appears to add more strict HEREDOC syntax #1347

Closed
jsivak opened this issue Apr 15, 2020 · 4 comments · Fixed by #1348
Closed

Vim patch v8.2.0578 appears to add more strict HEREDOC syntax #1347

jsivak opened this issue Apr 15, 2020 · 4 comments · Fixed by #1348
Labels
T: bug Something isn't working

Comments

@jsivak
Copy link

jsivak commented Apr 15, 2020

After building vim to include patch 8.2.0578 (https://github.com/vim/vim/releases/tag/v8.2.0578), black.vim now causes the following error to show at vim startup:

line   43:
E221: Marker cannot start with lower case letter
  File "<string>", line 1
    << endpython3
    ^
SyntaxError: invalid syntax
line   44:
E1042: import/export can only be used in vim9script
line   45:
E1042: import/export can only be used in vim9script
line   46:
E1042: import/export can only be used in vim9script
line   48:
E1077: Missing argument type for exec_prefix
line   49:
E488: Trailing characters:   try:
line   50:
E492: Not an editor command:     default = vim.eval("g:pymode_python").strip()
line   51:
E492: Not an editor command:   except vim.error:
line   52:
E492: Not an editor command:     default = ""
line   53:
E121: Undefined variable: default
line   54:
E133: :return not inside a function
line   56:
E133: :return not inside a function
line   57:
E133: :return not inside a function
line   59:
E1077: Missing argument type for venv_path
line   61:
E133: :return not inside a function
line   62:
E133: :return not inside a function
line   64:
E1077: Missing argument type for venv_path
line   66:
E133: :return not inside a function
line   67:
E133: :return not inside a function
line   69:
E1056: expected a type: [NULL]
line  152:
E1057: Missing :enddef
line  153:
E171: Missing :endif
Press ENTER or type command to continue

I'm not 100% sure of the vim changes, but if the "endpython3" HEREDOC tag in black.vim is changed to Endpython3 (note the uppercase first letter), then black.vim is processed without error in vim.

@jsivak jsivak added the T: bug Something isn't working label Apr 15, 2020
@jsivak
Copy link
Author

jsivak commented Apr 15, 2020

This may help explain the original change to the HEREDOC "label/tag" handling: vim/vim#4705

@char101
Copy link
Contributor

char101 commented Apr 16, 2020

I can confirm this. This change is sufficient to fix it.

diff --git a/plugin/black.vim b/plugin/black.vim
index 8106ea1..066f3fd 100644
--- a/plugin/black.vim
+++ b/plugin/black.vim
@@ -45,7 +45,7 @@ if !exists("g:black_skip_string_normalization")
   let g:black_skip_string_normalization = 0
 endif

-python3 << endpython3
+python3 << Endpython3
 import collections
 import os
 import sys
@@ -191,7 +191,7 @@ def BlackUpgrade():
 def BlackVersion():
   print(f'Black, version {black.__version__} on Python {sys.version}.')

-endpython3
+Endpython3

 command! Black :py3 Black()
 command! BlackUpgrade :py3 BlackUpgrade()

@JelleZijlstra
Copy link
Collaborator

Thanks for the diagnosis! Please submit a PR with this change.

@char101
Copy link
Contributor

char101 commented Apr 17, 2020

PR created #1348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants