Merge pull request #513 from millejoh/issue-506

Avoid completing against punctuation (again).
This commit is contained in:
John Miller 2019-04-04 18:25:47 -05:00 committed by GitHub
commit 5accc13b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,7 +91,8 @@
(let* ((kernel (ein:get-kernel-or-error))
(cached (ein:completions-get-cached arg (ein:$kernel-oinfo-cache kernel))))
(ein:aif cached it
(unless (and (looking-at "[[:nonascii:]]") (ein:company--punctuation-check (thing-at-point 'line) (current-column)))
(unless (ein:company--punctuation-check (thing-at-point 'line)
(current-column))
(case ein:completion-backend
(t
(cons :async
@ -99,8 +100,9 @@
(ein:company--complete arg cb)))))))))))
(defun ein:company--punctuation-check (thing col)
(or (string-match "[[:nonascii:]]" thing)
(let ((query (ein:trim-right (subseq thing 0 col) "[\n]")))
(string-match "[]()\",[{}'=: ]$" query (- col 2))))
(string-match "[]()\",[{}'=: ]$" query (- col 2)))))
(defun ein:company-handle-doc-buffer-finish (packed content _metadata-not-used_)