aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 9e415b31a1..ba2f2ba969 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -4122,18 +4122,30 @@ enum {
};
// Parse text from 'di' and return the quickfix list items
-static int qf_get_list_from_lines(dictitem_T *di, dict_T *retdict)
+static int qf_get_list_from_lines(dict_T *what, dictitem_T *di, dict_T *retdict)
{
int status = FAIL;
+ char_u *errorformat = p_efm;
+ dictitem_T *efm_di;
// Only a List value is supported
if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) {
+ // If errorformat is supplied then use it, otherwise use the 'efm'
+ // option setting
+ if ((efm_di = tv_dict_find(what, S_LEN("efm"))) != NULL) {
+ if (efm_di->di_tv.v_type != VAR_STRING
+ || efm_di->di_tv.vval.v_string == NULL) {
+ return FAIL;
+ }
+ errorformat = efm_di->di_tv.vval.v_string;
+ }
+
list_T *l = tv_list_alloc(kListLenMayKnow);
qf_info_T *qi = xmalloc(sizeof(*qi));
memset(qi, 0, sizeof(*qi));
qi->qf_refcount++;
- if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, p_efm,
+ if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, errorformat,
true, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) {
(void)get_errorlist(qi, NULL, 0, l);
qf_free(qi, 0);
@@ -4156,7 +4168,7 @@ int get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
dictitem_T *di;
if ((di = tv_dict_find(what, S_LEN("lines"))) != NULL) {
- return qf_get_list_from_lines(di, retdict);
+ return qf_get_list_from_lines(what, di, retdict);
}
if (wp != NULL) {
@@ -4390,6 +4402,7 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action,
dictitem_T *di;
int retval = FAIL;
int newlist = false;
+ char_u *errorformat = p_efm;
if (action == ' ' || qi->qf_curlist == qi->qf_listcount) {
newlist = true;
@@ -4471,13 +4484,20 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action,
}
}
+ if ((di = tv_dict_find(what, S_LEN("efm"))) != NULL) {
+ if (di->di_tv.v_type != VAR_STRING || di->di_tv.vval.v_string == NULL) {
+ return FAIL;
+ }
+ errorformat = di->di_tv.vval.v_string;
+ }
+
if ((di = tv_dict_find(what, S_LEN("lines"))) != NULL) {
// Only a List value is supported
if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) {
if (action == 'r') {
qf_free_items(qi, qf_idx);
}
- if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, p_efm,
+ if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat,
false, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) {
retval = OK;
}