Skip to content

Commit

Permalink
Add new option lsp-bridge-completion-in-string-file-types
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Jul 26, 2024
1 parent 22685db commit 6a05af5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ lsp-bridge provides support for more than two language servers for many language
- `lsp-bridge-find-def-fallback-function`: When LSP cannot find a definition, you can customize this function for candidate jumping, such as binding the citre function
- `lsp-bridge-find-ref-fallback-function`: When LSP cannot find a reference, you can customize this function for candidate jumping, such as binding the citre function
- `lsp-bridge-find-def-select-in-open-windows`: If this option is turned on, when searching for function definitions, already open windows will be selected instead of switching buffers. disable by default
- `lsp-bridge-enable-completion-in-string`: Enable completion pop-up within strings, default is off
- `lsp-bridge-enable-completion-in-string`: Enable completion pop-up within strings, disabled by default, if you only want to show completion popups in strings for certain languages, please customize the option `lsp-bridge-completion-in-string-file-types`
- `lsp-bridge-enable-completion-in-minibuffer`: Enable pop-completion up in Minibuffer, disabled by default
- `lsp-bridge-enable-diagnostics`: code diagnostic, enable by default
- `lsp-bridge-enable-inlay-hint`: inlay hint, disable by default, this option is use for strong type language, such as, Rust
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ lsp-bridge 针对许多语言都提供 2 个以上的语言服务器支持,
- `lsp-bridge-find-def-fallback-function`: 当 LSP 没有找到定义时, 可以通过定制这个函数来进行候选跳转, 比如绑定 citre 函数
- `lsp-bridge-find-ref-fallback-function`: 当 LSP 没有找到引用时, 可以通过定制这个函数来进行候选跳转, 比如绑定 citre 函数
- `lsp-bridge-find-def-select-in-open-windows`: 当打开这个选项时, 查找定义命令会尽量选择已经打开窗口去跳转定义, 而不是在当前窗口切换 Buffer, 默认关闭
- `lsp-bridge-enable-completion-in-string`: 支持在字符串中弹出补全, 默认关闭
- `lsp-bridge-enable-completion-in-string`: 支持在字符串中弹出补全, 默认关闭, 如果你只想在某些语言的字符串中弹出补全, 请自定义选项 `lsp-bridge-completion-in-string-file-types`
- `lsp-bridge-enable-completion-in-minibuffer`: 支持在 Minibuffer 中弹出补全, 默认关闭
- `lsp-bridge-enable-diagnostics`: 代码诊断, 默认打开
- `lsp-bridge-enable-inlay-hint`: 类型嵌入提示, 默认关闭, 这个选项对于那些严重依赖类型提示的语言比较有用, 比如 Rust
Expand Down
9 changes: 8 additions & 1 deletion lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ After set `lsp-bridge-completion-obey-trigger-characters-p' to nil, you need use
:safe #'booleanp
:group 'lsp-bridge)

(defcustom lsp-bridge-completion-in-string-file-types '("vue" "dart")
"File types where completion in string is allowed.
This is a list of file extensions for which
LSP-Bridge will enable completion inside string literals."
:type '(repeat string)
:group 'lsp-bridge)

(defface lsp-bridge-font-lock-flash
'((t (:inherit highlight)))
"Face to flash the current line."
Expand Down Expand Up @@ -1448,7 +1455,7 @@ So we build this macro to restore postion after code format."
;; For some languages, allow popup completion menu in string.
(and (boundp 'acm-backend-lsp-filepath)
acm-backend-lsp-filepath
(member (file-name-extension acm-backend-lsp-filepath) '("vue" "dart")))
(member (file-name-extension acm-backend-lsp-filepath) lsp-bridge-completion-in-string-file-types))
;; Other language not allowed popup completion in string, it's annoy
(not (acm-in-string-p))
;; Allow popup completion menu for string interpolation
Expand Down

0 comments on commit 6a05af5

Please sign in to comment.