瀏覽代碼

Fix type of last parsed word. It's necessary for autocompletion

Serj Kalichev 9 月之前
父節點
當前提交
be2cf32dba
共有 2 個文件被更改,包括 6 次插入8 次删除
  1. 1 2
      src/klish_plugin_sysrepo.h
  2. 5 6
      src/pline.c

+ 1 - 2
src/klish_plugin_sysrepo.h

@@ -63,8 +63,8 @@ typedef enum {
 
 	PT_DEL =
 		PAT_CONTAINER |
+		PAT_LIST |
 		PAT_LIST_KEY |
-		PAT_LIST_KEY_INCOMPLETED |
 		PAT_LEAF |
 		PAT_LEAF_EMPTY |
 		PAT_LEAFLIST |
@@ -119,7 +119,6 @@ typedef enum {
 		PAT_CONTAINER |
 		PAT_LIST |
 		PAT_LIST_KEY |
-		PAT_LIST_KEY_INCOMPLETED |
 		PAT_LEAF |
 		PAT_LEAF_EMPTY |
 		PAT_LEAFLIST |

+ 5 - 6
src/pline.c

@@ -625,7 +625,7 @@ static bool_t pline_parse_module(const struct lys_module *module,
 							leaf->name, str, BOOL_TRUE);
 						faux_argv_each(&arg);
 						str = (const char *)faux_argv_current(arg);
-						pexpr->pat = PAT_LIST_KEY_INCOMPLETED;
+						pexpr->pat = PAT_LIST_KEY;
 					}
 
 				// Keys with statements. Arbitrary order of keys.
@@ -683,8 +683,8 @@ static bool_t pline_parse_module(const struct lys_module *module,
 							pexpr->args_num++;
 							faux_argv_each(&arg);
 							str = (const char *)faux_argv_current(arg);
+							pexpr->pat = PAT_LIST_KEY_INCOMPLETED;
 						}
-						pexpr->pat = PAT_LIST_KEY_INCOMPLETED;
 
 						// Completion
 						if (!str) {
@@ -704,7 +704,7 @@ static bool_t pline_parse_module(const struct lys_module *module,
 						specified_keys_num++;
 						faux_argv_each(&arg);
 						str = (const char *)faux_argv_current(arg);
-						pexpr->pat = PAT_LIST_KEY_INCOMPLETED;
+						pexpr->pat = PAT_LIST_KEY;
 					}
 					if (break_upper_loop) {
 						faux_list_free(keys);
@@ -724,7 +724,7 @@ static bool_t pline_parse_module(const struct lys_module *module,
 								cur_key->node->name);
 							pline_add_compl(pline, PCOMPL_NODE,
 								cur_key->node, tmp,
-								SRP_REPO_EDIT, PAT_LIST_KEY);
+								SRP_REPO_EDIT, PAT_LIST_KEY_INCOMPLETED);
 							faux_str_free(tmp);
 						}
 
@@ -732,7 +732,7 @@ static bool_t pline_parse_module(const struct lys_module *module,
 							pexpr_xpath_add_list_key(pexpr,
 								cur_key->node->name,
 								cur_key->dflt, BOOL_FALSE);
-							pexpr->pat = PAT_LIST_KEY_INCOMPLETED;
+							pexpr->pat = PAT_LIST_KEY;
 						} else { // Mandatory key is not specified
 							break_upper_loop = BOOL_TRUE;
 						}
@@ -744,7 +744,6 @@ static bool_t pline_parse_module(const struct lys_module *module,
 					break;
 			}
 
-			pexpr->pat = PAT_LIST_KEY;
 			pexpr->tree_depth++;
 
  			// Completion