mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.2.2629: Vim9: error for #{{ is not desired
Problem: Vim9: error for #{{ is not desired. Solution: Adjust the checks. (closes #7990)
This commit is contained in:
@@ -376,4 +376,4 @@ EXTERN char e_argument_already_declared_in_script_str[]
|
|||||||
EXTERN char e_import_as_name_not_supported_here[]
|
EXTERN char e_import_as_name_not_supported_here[]
|
||||||
INIT(= N_("E1169: 'import * as {name}' not supported here"));
|
INIT(= N_("E1169: 'import * as {name}' not supported here"));
|
||||||
EXTERN char e_cannot_use_hash_curly_to_start_comment[]
|
EXTERN char e_cannot_use_hash_curly_to_start_comment[]
|
||||||
INIT(= N_("E1170: 'Cannot use #{ to start a comment"));
|
INIT(= N_("E1170: Cannot use #{ to start a comment"));
|
||||||
|
@@ -5234,7 +5234,8 @@ ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (in_vim9script())
|
if (in_vim9script())
|
||||||
return c == '#' && cmd[1] != '{'
|
// # starts a comment, #{ might be a mistake, #{{ can start a fold
|
||||||
|
return c == '#' && (cmd[1] != '{' || cmd[2] == '{')
|
||||||
&& (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
|
&& (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
|
||||||
#endif
|
#endif
|
||||||
return c == '"';
|
return c == '"';
|
||||||
|
@@ -2155,6 +2155,10 @@ def Test_expr7_dict()
|
|||||||
# automatic conversion from number to string
|
# automatic conversion from number to string
|
||||||
var n = 123
|
var n = 123
|
||||||
var dictnr = {[n]: 1}
|
var dictnr = {[n]: 1}
|
||||||
|
|
||||||
|
# comment to start fold is OK
|
||||||
|
var x1: number #{{ fold
|
||||||
|
var x2 = 9 #{{ fold
|
||||||
END
|
END
|
||||||
CheckDefAndScriptSuccess(lines)
|
CheckDefAndScriptSuccess(lines)
|
||||||
|
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2629,
|
||||||
/**/
|
/**/
|
||||||
2628,
|
2628,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -120,7 +120,7 @@ not_in_vim9(exarg_T *eap)
|
|||||||
int
|
int
|
||||||
vim9_bad_comment(char_u *p)
|
vim9_bad_comment(char_u *p)
|
||||||
{
|
{
|
||||||
if (p[0] == '#' && p[1] == '{')
|
if (p[0] == '#' && p[1] == '{' && p[2] != '{')
|
||||||
{
|
{
|
||||||
emsg(_(e_cannot_use_hash_curly_to_start_comment));
|
emsg(_(e_cannot_use_hash_curly_to_start_comment));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -129,13 +129,13 @@ vim9_bad_comment(char_u *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if "p" points at a "#" not followed by '{'.
|
* Return TRUE if "p" points at a "#" not followed by one '{'.
|
||||||
* Does not check for white space.
|
* Does not check for white space.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
vim9_comment_start(char_u *p)
|
vim9_comment_start(char_u *p)
|
||||||
{
|
{
|
||||||
return p[0] == '#' && p[1] != '{';
|
return p[0] == '#' && (p[1] != '{' || p[2] == '{');
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
|
Reference in New Issue
Block a user