Skip to content

Commit

Permalink
Add lsp-bridge--not-match-hide-keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Oct 28, 2024
1 parent c7430dd commit b5e92d6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
lsp-bridge--not-follow-complete
lsp-bridge--not-match-stop-commands
lsp-bridge--not-match-hide-characters
lsp-bridge--not-match-hide-keywords

lsp-bridge--not-only-blank-before-cursor
lsp-bridge--not-in-string
Expand Down Expand Up @@ -185,7 +186,7 @@ Setting this to nil or 0 will turn off the heartbeat mechanism."
:safe #'listp
:group 'lsp-bridge)

(defcustom lsp-bridge-completion-hide-characters '(":" ";" "(" ")" "[" "]" "{" "}" "," "\"")
(defcustom lsp-bridge-completion-hide-characters '(":" ";" "(" ")" "[" "]" "{" "}" "," "\"" ">")
"If character before match this option, stop popup completion ui.
To make this option works, you need set option `lsp-bridge-completion-obey-trigger-characters-p' with nil first.
Expand Down Expand Up @@ -1582,6 +1583,16 @@ So we build this macro to restore postion after code format."
(symbol-value 'acm-backend-lsp-completion-trigger-characters))))
(not (member char lsp-bridge-completion-hide-characters)))))

(defun lsp-bridge--not-match-hide-keywords ()
"Hide completion if string before cursor match some special keywords."
(let ((string (buffer-substring-no-properties (car (bounds-of-thing-at-point 'symbol))
(point))))
(not (when (and (or (derived-mode-p 'ruby-mode)
(derived-mode-p 'ruby-ts-mode)
(derived-mode-p 'elixir-mode)
(derived-mode-p 'elixir-ts-mode))
(member string '("do" "end")))))))

(defun lsp-bridge--is-evil-state ()
"If `evil' mode is enable, only show completion when evil is in insert mode."
(or (not (featurep 'evil))
Expand Down

0 comments on commit b5e92d6

Please sign in to comment.