Skip to content

Commit ba98fb5

Browse files
committed
patch 8.2.2486: Vim9: some errors for white space do not show context
Problem: Vim9: some errors for white space do not show context. Solution: Include the text at the error.
1 parent 0123cc1 commit ba98fb5

7 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/dict.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
945945
if (**arg != ':')
946946
{
947947
if (*skipwhite(*arg) == ':')
948-
semsg(_(e_no_white_space_allowed_before_str), ":");
948+
semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
949949
else
950950
semsg(_(e_missing_dict_colon), *arg);
951951
clear_tv(&tvkey);
@@ -1025,7 +1025,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
10251025
if (!had_comma)
10261026
{
10271027
if (**arg == ',')
1028-
semsg(_(e_no_white_space_allowed_before_str), ",");
1028+
semsg(_(e_no_white_space_allowed_before_str_str), ",", *arg);
10291029
else
10301030
semsg(_(e_missing_dict_comma), *arg);
10311031
goto failret;

src/errors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ EXTERN char e_cannot_declare_a_register_str[]
173173
INIT(= N_("E1066: Cannot declare a register: %s"));
174174
EXTERN char e_separator_mismatch_str[]
175175
INIT(= N_("E1067: Separator mismatch: %s"));
176-
EXTERN char e_no_white_space_allowed_before_str[]
177-
INIT(= N_("E1068: No white space allowed before '%s'"));
176+
EXTERN char e_no_white_space_allowed_before_str_str[]
177+
INIT(= N_("E1068: No white space allowed before '%s': %s"));
178178
EXTERN char e_white_space_required_after_str_str[]
179179
INIT(= N_("E1069: White space required after '%s': %s"));
180180
EXTERN char e_missing_from[]

src/list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,8 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
13281328
if (do_error)
13291329
{
13301330
if (**arg == ',')
1331-
semsg(_(e_no_white_space_allowed_before_str), ",");
1331+
semsg(_(e_no_white_space_allowed_before_str_str),
1332+
",", *arg);
13321333
else
13331334
semsg(_("E696: Missing comma in List: %s"), *arg);
13341335
}

src/userfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ get_func_tv(
878878
{
879879
if (*argp != ',' && *skipwhite(argp) == ',')
880880
{
881-
semsg(_(e_no_white_space_allowed_before_str), ",");
881+
semsg(_(e_no_white_space_allowed_before_str_str), ",", argp);
882882
ret = FAIL;
883883
break;
884884
}
@@ -3214,7 +3214,7 @@ define_function(exarg_T *eap, char_u *name_arg)
32143214

32153215
if ((vim9script || eap->cmdidx == CMD_def) && VIM_ISWHITE(p[-1]))
32163216
{
3217-
semsg(_(e_no_white_space_allowed_before_str), "(");
3217+
semsg(_(e_no_white_space_allowed_before_str_str), "(", p - 1);
32183218
goto ret_free;
32193219
}
32203220

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2486,
753755
/**/
754756
2485,
755757
/**/

src/vim9compile.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,7 +2800,7 @@ compile_arguments(char_u **arg, cctx_T *cctx, int *argcount)
28002800

28012801
if (*p != ',' && *skipwhite(p) == ',')
28022802
{
2803-
semsg(_(e_no_white_space_allowed_before_str), ",");
2803+
semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
28042804
p = skipwhite(p);
28052805
}
28062806
if (*p == ',')
@@ -3055,7 +3055,7 @@ compile_list(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
30553055
}
30563056
if (*p == ',')
30573057
{
3058-
semsg(_(e_no_white_space_allowed_before_str), ",");
3058+
semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
30593059
return FAIL;
30603060
}
30613061
if (*p == ']')
@@ -3234,7 +3234,7 @@ compile_dict(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
32343234
if (**arg != ':')
32353235
{
32363236
if (*skipwhite(*arg) == ':')
3237-
semsg(_(e_no_white_space_allowed_before_str), ":");
3237+
semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
32383238
else
32393239
semsg(_(e_missing_dict_colon), *arg);
32403240
return FAIL;
@@ -3273,7 +3273,7 @@ compile_dict(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
32733273
}
32743274
if (IS_WHITE_OR_NUL(*whitep))
32753275
{
3276-
semsg(_(e_no_white_space_allowed_before_str), ",");
3276+
semsg(_(e_no_white_space_allowed_before_str_str), ",", whitep);
32773277
return FAIL;
32783278
}
32793279
whitep = *arg + 1;
@@ -4270,7 +4270,7 @@ compile_expr7t(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
42704270
if (**arg != '>')
42714271
{
42724272
if (*skipwhite(*arg) == '>')
4273-
semsg(_(e_no_white_space_allowed_before_str), ">");
4273+
semsg(_(e_no_white_space_allowed_before_str_str), ">", *arg);
42744274
else
42754275
emsg(_(e_missing_gt));
42764276
return FAIL;

src/vim9type.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ parse_type_member(
638638
if (give_error)
639639
{
640640
if (*skipwhite(*arg) == '<')
641-
semsg(_(e_no_white_space_allowed_before_str), "<");
641+
semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg);
642642
else
643643
emsg(_(e_missing_type));
644644
}
@@ -779,7 +779,8 @@ parse_type(char_u **arg, garray_T *type_gap, int give_error)
779779
if (*p != ',' && *skipwhite(p) == ',')
780780
{
781781
if (give_error)
782-
semsg(_(e_no_white_space_allowed_before_str), ",");
782+
semsg(_(e_no_white_space_allowed_before_str_str),
783+
",", p);
783784
return NULL;
784785
}
785786
if (*p == ',')

0 commit comments

Comments
 (0)