aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt2
-rw-r--r--src/nvim/eval/userfunc.c8
-rw-r--r--test/old/testdir/test_let.vim4
-rw-r--r--test/old/testdir/test_vimscript.vim6
4 files changed, 13 insertions, 7 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 9f0a6ceb25..351690f4df 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2539,7 +2539,7 @@ This does NOT work: >
|List| item.
*:let=<<* *:let-heredoc*
- *E990* *E991* *E172* *E221*
+ *E990* *E991* *E172* *E221* *E1145*
:let {var-name} =<< [trim] {endmarker}
text...
text...
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index f73d22243d..178f9fd6b6 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -71,6 +71,8 @@ static const char *e_funcref = N_("E718: Funcref required");
static const char *e_nofunc = N_("E130: Unknown function: %s");
static const char e_no_white_space_allowed_before_str_str[]
= N_("E1068: No white space allowed before '%s': %s");
+static const char e_missing_heredoc_end_marker_str[]
+ = N_("E1145: Missing heredoc end marker: %s");
void func_init(void)
{
@@ -2319,7 +2321,11 @@ void ex_function(exarg_T *eap)
lines_left = Rows - 1;
}
if (theline == NULL) {
- emsg(_("E126: Missing :endfunction"));
+ if (skip_until != NULL) {
+ semsg(_(e_missing_heredoc_end_marker_str), skip_until);
+ } else {
+ emsg(_("E126: Missing :endfunction"));
+ }
goto erret;
}
if (show_block) {
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim
index 35745e9c6a..fe7633cf11 100644
--- a/test/old/testdir/test_let.vim
+++ b/test/old/testdir/test_let.vim
@@ -327,7 +327,7 @@ func Test_let_heredoc_fails()
endfunc
END
call writefile(text, 'XheredocFail')
- call assert_fails('source XheredocFail', 'E126:')
+ call assert_fails('source XheredocFail', 'E1145:')
call delete('XheredocFail')
let text =<< trim CodeEnd
@@ -336,7 +336,7 @@ func Test_let_heredoc_fails()
endfunc
CodeEnd
call writefile(text, 'XheredocWrong')
- call assert_fails('source XheredocWrong', 'E126:')
+ call assert_fails('source XheredocWrong', 'E1145:')
call delete('XheredocWrong')
let text =<< trim TEXTend
diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim
index 6ac19a357f..5988d6ed71 100644
--- a/test/old/testdir/test_vimscript.vim
+++ b/test/old/testdir/test_vimscript.vim
@@ -6746,7 +6746,7 @@ func Test_script_lines()
\ ])
call assert_report("Shouldn't be able to define function")
catch
- call assert_exception('Vim(function):E126: Missing :endfunction')
+ call assert_exception('Vim(function):E1145: Missing heredoc end marker: .')
endtry
" :change
@@ -6766,7 +6766,7 @@ func Test_script_lines()
\ ])
call assert_report("Shouldn't be able to define function")
catch
- call assert_exception('Vim(function):E126: Missing :endfunction')
+ call assert_exception('Vim(function):E1145: Missing heredoc end marker: .')
endtry
" :insert
@@ -6786,7 +6786,7 @@ func Test_script_lines()
\ ])
call assert_report("Shouldn't be able to define function")
catch
- call assert_exception('Vim(function):E126: Missing :endfunction')
+ call assert_exception('Vim(function):E1145: Missing heredoc end marker: .')
endtry
endfunc