Skip to content

Commit

Permalink
lsp-completion-at-point: looking back a few more chars for trigger-ch…
Browse files Browse the repository at this point in the history
…ar (#4428)
  • Loading branch information
kiennq committed Apr 17, 2024
1 parent e67008b commit e379ae5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lsp-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,15 @@ The MARKERS and PREFIX value will be attached to each candidate."
:company-require-match 'never
:company-prefix-length
(save-excursion
(and (lsp-completion--looking-back-trigger-characterp trigger-chars) t))
(defvar company-minimum-prefix-length)
(let ((bounds-left (max (line-beginning-position) (- (point) company-minimum-prefix-length)))
triggered-by-char?)
(while (and (> (point) bounds-left)
(not (equal (char-after) ?\s))
(not triggered-by-char?))
(setq triggered-by-char? (lsp-completion--looking-back-trigger-characterp trigger-chars))
(goto-char (1- (point))))
(and triggered-by-char? t)))
:company-match #'lsp-completion--company-match
:company-doc-buffer (-compose #'lsp-doc-buffer
#'lsp-completion--get-documentation)
Expand Down

0 comments on commit e379ae5

Please sign in to comment.