|
26 | 26 | collection))) |
27 | 27 |
|
28 | 28 | (defun ejc-capf-get-annotation (cand) |
29 | | - (let* ((on-point (ejc-get-prefix-word)) |
30 | | - (my-data (list (list "ansi sql" (ejc-get-ansi-sql-words)) |
31 | | - (list "keyword" (ejc-get-keywords)) |
32 | | - (list "owner" (ejc-owners-candidates)) |
33 | | - (list "table" (ejc-tables-candidates)) |
34 | | - (list "view" (ejc-views-candidates)) |
35 | | - (when on-point |
36 | | - (list "column" (ejc-colomns-candidates))))) |
37 | | - ;; Find which lists contain the candidate |
38 | | - (matches (ejc-find-lists-containing cand my-data))) |
39 | | - (when matches |
40 | | - (format " [%s]" (mapconcat #'identity matches ", "))))) |
| 29 | + (format " [%s]" (get-text-property 0 'meta-category cand))) |
41 | 30 |
|
42 | 31 | (defun ejc-capf () |
43 | 32 | "SQL completion-at-point function." |
44 | 33 | (let ((bds (bounds-of-thing-at-point 'symbol)) |
45 | 34 | (on-point (ejc-get-prefix-word))) |
46 | 35 | (when bds |
47 | 36 | (list (car bds) (cdr bds) |
48 | | - (append (ejc-get-ansi-sql-words) |
49 | | - (ejc-get-keywords) |
50 | | - (ejc-owners-candidates) |
51 | | - (ejc-tables-candidates) |
52 | | - (ejc-views-candidates) |
| 37 | + (append (mapcar (lambda (w) (propertize w 'meta-category "ansi sql")) |
| 38 | + (ejc-get-ansi-sql-words)) |
| 39 | + (mapcar (lambda (w) (propertize w 'meta-category "keyword")) |
| 40 | + (seq-difference (ejc-get-keywords) |
| 41 | + (ejc-get-ansi-sql-words))) |
| 42 | + (mapcar (lambda (w) (propertize w 'meta-category "owner")) |
| 43 | + (ejc-owners-candidates)) |
| 44 | + (mapcar (lambda (w) (propertize w 'meta-category "table")) |
| 45 | + (ejc-tables-candidates)) |
| 46 | + (mapcar (lambda (w) (propertize w 'meta-category "view")) |
| 47 | + (ejc-views-candidates)) |
53 | 48 | (when on-point |
54 | | - (ejc-colomns-candidates))) |
| 49 | + (mapcar (lambda (w) (propertize w 'meta-category "column")) |
| 50 | + (ejc-colomns-candidates)))) |
55 | 51 | :exclusive 'yes |
56 | 52 | :annotation-function #'ejc-capf-get-annotation)))) |
57 | 53 |
|
|
0 commit comments