Closed BigBeautifulBro closed 3 years ago
For others that are having this issue, an easy temporary work around is to just disable the automatic completion pop-up and change the bind for company-complete in rust mode:
; Under dotspacemacs-configuration-layers
; Ensure auto-completion-idle-delay is nil to prevent automatic completion pop-up
(auto-completion :variables
auto-completion-enable-help-tooltip t
auto-completion-enable-snippets-in-popup nil
auto-completion-return-key-behavior 'complete
auto-completion-tab-key-behavior nil
auto-completion-idle-delay nil
:disabled-for org erc)
...
; Under dotspacemacs/user-config
(global-set-key (kbd "C-.") 'company-complete)
(define-key spacemacs-rust-mode-map-root-map
(kbd "C-.") 'company-lsp)
Hi, I reproduced your problem but for me it works, I am using rust-analyzer.
As you can see from my config I copy-pasted your auto-complete settings
(octave yaml clojure dap
(lsp :variables lsp-ui-doc-enable nil lsp-ui-sideline-code-actions-prefix " " lsp-ui-sideline-show-hover nil lsp-rust-server 'rust-analyzer lsp-rust-analyzer-server-display-inlay-hints nil)
(rust :variables rust-format-on-save t)
(auto-completion :variables auto-completion-enable-help-tooltip t auto-completion-enable-snippets-in-popup t auto-completion-return-key-behavior 'complete auto-completion-tab-key-behavior nil :disabled-for org erc)
(syntax-checking :variables syntax-checking-enable-tooltips nil)
(c-c++ :variables c-c++-enable-clang-support t c-c++-default-mode-for-headers 'c++-mode)
helm emacs-lisp
(git :variables git-magit-status-fullscreen nil magit-diff-refine-hunk 'all)
multiple-cursors neotree
(shell :variables shell-default-shell 'eshell shell-enable-smart-eshell t)
semantic cscope spell-checking treemacs
(version-control :variables version-control-diff-side 'left version-control-diff-tool 'diff-hl))
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Closing since
Description :octocat:
When using the Rust layer with auto-completion and LSP as the company backend, selecting a completion from the dropdown list does not work properly when the completion candidate is a function with one or more parameters. In this situation when using M-x company-complete, after selecting a candidate, the selection's yasnippet template is incorrectly pasted as-is without expansion. This issue also occurs when attempting to a select a candidate by just typing a couple letters, waiting for the autocompletion list without using M-x company-complete, and then selecting a candidate.
Auto-completion works properly and as expected when using M-x company-lsp instead of M-x company-complete.
If the solution is that users should use M-x company-lsp when using Rust with LSP as the company backend, please document this. This was not obvious to me, and I thought you should be using M-x company-complete.
Reproduction guide :beetle:
Observed behaviour: :eyes: :broken_heart: The text "replace(${1:from: P}, ${2:to: &str})" is pasted literally as a completion with the user's cursor at the end of this text. The user is not able to edit the parameters as a yasnippet expansion.
Expected behaviour: :heart: :smile: The text "replace(from: P, to: &str)" should be pasted as a completion with the user's cursor in the first parameter allowing them to edit the parameters as a yasnippet expansion.
System Info :computer: