@@ -59,18 +59,17 @@ func getKeywordCompletions() []CompletionItem {
5959 name string
6060 description string
6161 score int
62- category string
6362 }{
64- {"root" , "The root of the output document" , 950 , "core" },
65- {"this" , "The current context value" , 950 , "core" },
66- {"if" , "Conditional expression" , 900 , "control" },
67- {"match" , "Pattern matching expression" , 900 , "control" },
68- {"let" , "Variable assignment" , 880 , "variable" },
69- {"map" , "Create named mapping" , 870 , "mapping" },
70- {"else" , "Alternative branch" , 850 , "control" },
71- {"import" , "Import external mapping" , 800 , "mapping" },
72- {"meta" , "Access message metadata" , 820 , "metadata" },
73- {"deleted" , "Delete the current field" , 750 , "mutation" },
63+ {"root" , "The root of the output document" , 950 },
64+ {"this" , "The current context value" , 950 },
65+ {"if" , "Conditional expression" , 900 },
66+ {"match" , "Pattern matching expression" , 900 },
67+ {"let" , "Variable assignment" , 880 },
68+ {"map" , "Create named mapping" , 870 },
69+ {"else" , "Alternative branch" , 850 },
70+ {"import" , "Import external mapping" , 800 },
71+ {"meta" , "Access message metadata" , 820 },
72+ {"deleted" , "Delete the current field" , 750 },
7473 }
7574
7675 var completions []CompletionItem
@@ -81,16 +80,15 @@ func getKeywordCompletions() []CompletionItem {
8180 <div class="ace-doc-header">
8281 <div class="ace-doc-signature">
8382 <strong>%s</strong>
84- <span class="ace-keyword-category">%s</span>
8583 </div>
8684 </div>
8785 <div class="ace-doc-description">%s</div>
88- </div>` , keyword .name , keyword .category , keyword . description )
86+ </div>` , keyword .name , keyword .description )
8987
9088 completions = append (completions , CompletionItem {
9189 Caption : keyword .name ,
9290 Value : keyword .name ,
93- Meta : keyword . category ,
91+ Meta : " keyword" ,
9492 Type : "keyword" ,
9593 Score : keyword .score ,
9694 Description : keyword .description ,
@@ -101,32 +99,31 @@ func getKeywordCompletions() []CompletionItem {
10199 return completions
102100}
103101
104- // getCompletions converts function/method specs into autocompletion items.
105- // Uses type switch to handle both FunctionSpec and MethodSpec maps.
102+ // getCompletions converts function/method specs with HTML into autocompletion items.
106103func getCompletions (specs any ) []CompletionItem {
107104 var completions []CompletionItem
108105
109106 switch s := specs .(type ) {
110- case map [string ]query. FunctionSpec :
107+ case map [string ]functionSpecWithHTML :
111108 for name , spec := range s {
112109 completions = append (completions , buildCompletionItem (
113110 name ,
114- FunctionSpecWrapper {spec },
111+ FunctionSpecWrapper {spec . FunctionSpec },
115112 spec .Category ,
116113 "function" ,
117114 false , // isMethod
118115 ))
119116 }
120117
121- case map [string ]query. MethodSpec :
118+ case map [string ]methodSpecWithHTML :
122119 for name , spec := range s {
123120 category := "general"
124121 if len (spec .Categories ) > 0 {
125122 category = spec .Categories [0 ].Category
126123 }
127124 completions = append (completions , buildCompletionItem (
128125 name ,
129- MethodSpecWrapper {spec },
126+ MethodSpecWrapper {spec . MethodSpec },
130127 category ,
131128 "method" ,
132129 true , // isMethod
@@ -139,6 +136,11 @@ func getCompletions(specs any) []CompletionItem {
139136
140137// buildCompletionItem creates a CompletionItem from a spec wrapper.
141138func buildCompletionItem (name string , spec Spec , category , itemType string , isMethod bool ) CompletionItem {
139+ // Use "general" as default if no category provided
140+ if category == "" {
141+ category = "general"
142+ }
143+
142144 item := CompletionItem {
143145 Caption : name ,
144146 Meta : category ,
0 commit comments