@@ -167,14 +167,14 @@ acp.autocomplete = async (lang) => {
167
167
* 1. Init function
168
168
* ----------------
169
169
*
170
- * Every acp language has an init function
171
- * that's called on the first load of a file
172
- * with the language:
170
+ * An init function that's called
171
+ * on the first load of a file
172
+ * containing the defined language:
173
173
*
174
- * acp.lang.<lang>.init = () => {
175
- * ...
176
- * acp.lang.<lang>.props = <props>;
177
- * }
174
+ acp.lang.<lang>.init = () => {
175
+ ...
176
+ acp.lang.<lang>.props = <props>;
177
+ }
178
178
*
179
179
* Terms:
180
180
* <lang> - language name
@@ -184,22 +184,46 @@ acp.autocomplete = async (lang) => {
184
184
* 2. Autocomplete function
185
185
* ------------------------
186
186
*
187
- * Called on every type. Here you can process
188
- * the query and return results:
187
+ * Called on every type. Here you can return
188
+ * autocomplete results:
189
189
*
190
- * acp.lang.<lang>.autocomplete = (query) => {
191
- * ...
192
- * return <results>;
193
- * }
190
+ acp.lang.<lang>.autocomplete = (< query> ) => {
191
+ ...
192
+ return <results>;
193
+ }
194
194
*
195
195
* Terms:
196
- * query - text of the current line before the cursor.
197
- * newlines, spaces and tabs won't be included.
198
- * <results> - array of strings to show in the autocomplete menu
196
+ * <lang> - language name
197
+ * <query> - text of the current line before the cursor.
198
+ * newlines, spaces and tabs won't be included.
199
+ * <results> - array of strings to show in the autocomplete menu.
200
+ * these get automatically sorted by relevance.
201
+ *
202
+ * To disable automatic <results> sorting, return:
203
+ return [<results>, { sort: false }];
204
+ *
205
+ *
206
+ * [Optional] 3. Query processing function
207
+ * ---------------------------------------
208
+ *
209
+ * You can define an optional function
210
+ * to process the query.
211
+ * In this case, an additional parameter, <rawQuery>,
212
+ * will be passed to the autocomplete function.
199
213
*
200
- * Results are automatically sorted.
201
- * To disable automatic sorting, return:
202
- * return [<results>, { sort: false }];
214
+ acp.lang.<lang>.processQuery = (<query>) => {
215
+ ...
216
+ return <procQuery>;
217
+ }
218
+ *
219
+ * Terms:
220
+ * <lang> - language name
221
+ * <query> - text of the current line before the cursor.
222
+ * newlines, spaces and tabs won't be included.
223
+ * <procQuery> - proccessed query. this'll be set to the current query
224
+ *
225
+ * In autocomplete function:
226
+ * <rawQuery> - Unproccessed query.
203
227
*/
204
228
205
229
0 commit comments