Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lsp-methods.el
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,19 @@ to a text document."
(lsp--sort-string c2))
t))))

(defun lsp--get-trigger-character-at-point ()
(when-let (completionProvider (lsp--capability "completionProvider"))
(seq-find (lambda (trigger-character)
(let ((len (length trigger-character)))
(when (> (point) len)
(string-equal (buffer-substring-no-properties (- (point) len) (point))
trigger-character))))
(gethash "triggerCharacters" completionProvider))))

(defun lsp--get-completions ()
(lsp--send-changes lsp--cur-workspace)
(let ((bounds (bounds-of-thing-at-point 'symbol)))
(let ((completion-trigger-character (lsp--get-trigger-character-at-point))
(bounds (bounds-of-thing-at-point 'symbol)))
(list
(if bounds (car bounds) (point))
(if bounds (cdr bounds) (point))
Expand All @@ -850,7 +860,8 @@ to a text document."
((sequencep resp) resp))))
(mapcar #'lsp--make-completion-item items))))
:annotation-function #'lsp--annotate
:display-sort-function #'lsp--sort-completions)))
:display-sort-function #'lsp--sort-completions
:company-prefix-length (when completion-trigger-character t))))

;;; TODO: implement completionItem/resolve

Expand Down