File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 3131(require 'company )
3232(require 'phpactor )
3333
34+ (defun company-phpactor--grab-symbol ()
35+ " If point is at the end of a symbol, return it.
36+ Otherwise, if point is not inside a symbol, return an empty string.
37+ Here we create a temporary syntax table in order to add $ to symbols."
38+ (let (($temp-syn-table (make-syntax-table )))
39+ (modify-syntax-entry ?\$ " _" $temp-syn-table)
40+
41+ (with-syntax-table $temp-syn-table
42+ (if (looking-at " \\ _>" )
43+ (buffer-substring (point ) (save-excursion (skip-syntax-backward " w_" )
44+ (point )))
45+ (unless (and (char-after ) (memq (char-syntax (char-after )) '(?w ?_ )))
46+ " " )))))
47+
3448(defun company-phpactor--get-suggestions ()
3549 " Get completions for current cursor."
3650 (let ((response (phpactor--rpc " complete" (phpactor--command-argments :source :offset ))))
4256 (interactive (list 'interactive ))
4357 (cl-case command
4458 (interactive (company-begin-backend 'company-phpactor ))
45- (prefix (company-grab-symbol))
46- (candidates (all-completions arg (mapcar #' (lambda (suggestion ) (plist-get suggestion :name )) (company-phpactor--get-suggestions))))))
59+ (prefix (company-phpactor-- grab-symbol))
60+ (candidates (all-completions ( substring-no-properties arg) (mapcar #' (lambda (suggestion ) (plist-get suggestion :name )) (company-phpactor--get-suggestions))))))
4761
4862(provide 'company-phpactor )
4963; ;; company-phpactor.el ends here
You can’t perform that action at this time.
0 commit comments