|
84 | 84 | (require 'flymake)
|
85 | 85 | (require 'php-flymake)
|
86 | 86 | (require 'regexp-opt)
|
| 87 | + (declare-function 'acm-backend-tabnine-candidate-expand "ext:acm-backend-tabnine" |
| 88 | + (candidate-info bound-start)) |
87 | 89 | (defvar add-log-current-defun-header-regexp)
|
88 | 90 | (defvar add-log-current-defun-function)
|
89 | 91 | (defvar c-syntactic-context)
|
@@ -1273,6 +1275,11 @@ After setting the stylevars run hooks according to STYLENAME
|
1273 | 1275 | :override 'php-c-looking-at-or-maybe-in-bracelist '(local)))
|
1274 | 1276 | (advice-add #'fixup-whitespace :after #'php-mode--fixup-whitespace-after '(local))
|
1275 | 1277 |
|
| 1278 | + (when (fboundp #'acm-backend-tabnine-candidate-expand) |
| 1279 | + (advice-add #'acm-backend-tabnine-candidate-expand |
| 1280 | + :filter-args #'php-acm-backend-tabnine-candidate-expand-filter-args |
| 1281 | + '(local))) |
| 1282 | + |
1276 | 1283 | (when (>= emacs-major-version 25)
|
1277 | 1284 | (with-silent-modifications
|
1278 | 1285 | (save-excursion
|
@@ -1576,6 +1583,17 @@ The output will appear in the buffer *PHP*."
|
1576 | 1583 | (forward-char -2)
|
1577 | 1584 | (looking-at-p "->\\|::")))
|
1578 | 1585 | (delete-char 1)))
|
| 1586 | + |
| 1587 | +;; Advice for lsp-bridge' acm-backend-tabnine |
| 1588 | +;; see https://github.com/manateelazycat/lsp-bridge/issues/402#issuecomment-1305653058 |
| 1589 | +(defun php-acm-backend-tabnine-candidate-expand-filter-args (args) |
| 1590 | + "Adjust to replace bound-start ARGS for Tabnine in PHP." |
| 1591 | + (cl-multiple-value-bind (candidate-info bound-start) args |
| 1592 | + (save-excursion |
| 1593 | + (goto-char bound-start) |
| 1594 | + (when (looking-at-p (eval-when-compile (regexp-quote "$"))) |
| 1595 | + (setq bound-start (1+ bound-start)))) |
| 1596 | + (list candidate-info bound-start))) |
1579 | 1597 |
|
1580 | 1598 | ;;;###autoload
|
1581 | 1599 | (progn
|
|
0 commit comments