Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding ${0:placeholder} doesn't replace placeholder text #1141

Open
ruds opened this issue Aug 7, 2022 · 4 comments
Open

Expanding ${0:placeholder} doesn't replace placeholder text #1141

ruds opened this issue Aug 7, 2022 · 4 comments

Comments

@ruds
Copy link

ruds commented Aug 7, 2022

% emacs --version
GNU Emacs 28.1
Copyright (C) 2022 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
% git log -1 --oneline
5cbdbf0 (HEAD -> master, origin/master, origin/HEAD) Handle errors during evaluation properly
% HOME=$PWD emacs -L .

I evaluated the following elisp:

(require 'yasnippet)
(yas-global-mode 1)
(defun test-a ()
  (interactive)
  (yas-expand-snippet "return ${0:expression};"))

(defun test-b ()
  (interactive)
  (yas-expand-snippet "return ${1:expression};"))

When I do M-x test-a, the text return expression; is generated with point just before expression, but typing does not replace that placeholder text.

When I do M-x test-b, the same text is generated with point in the same place, but (as expected) typing replaces the placeholder expression.

The first snippet is produced by lsp-mode for completing code snippets in c-mode. When I filed emacs-lsp/lsp-mode#3665 they suggested that I should file an issue in this project, because they expect that placeholders work for $0.

@xiliuya
Copy link

xiliuya commented Dec 22, 2022

I had the same problem with eglot and clangd. Did you solve it?

@xiliuya
Copy link

xiliuya commented Dec 22, 2022

I found my problem was the conflict with symbol-overlay. issues

@KaranAhlawat
Copy link

@ruds Did you ever find a fix for this?

@dgutov
Copy link
Contributor

dgutov commented Oct 18, 2023

For anybody else who comes here: try adding (delete-selection-mode 1) to your init script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants