Giter Site home page Giter Site logo

consult-yasnippet's Introduction

consult-yasnippet

MELPA

A consulting-read interface for yasnippet.

https://user-images.githubusercontent.com/23294780/134374821-4ed3ecdb-cb1d-4fa2-a63a-288a4eeb8bd0.png

This package implements the yasnippet consulting-read interface from consult#173.

Table of Contents

Installation

Manually

  1. Clone the repo.
  2. Add the repo path to your emacs load-path.
  3. Load it when needed.

From MELPA

This package is on MELPA. You can add this to your package-archives variable and then install through M-x package-install.

(push '("melpa" . "https://melpa.org/packages/") package-archives)
(package-refresh-contents)
(package-install 'consult-yasnippet)

consult-yasnippet's People

Contributors

furkanusta avatar kobayashi avatar lemonbreezes avatar mohkale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

consult-yasnippet's Issues

Support for partial completion?

Hi!
Is it possible or planned to support partial completion in M-x consult-yasnippet?

I'd like to enter part of a snippet key "tod" and have M-x consult-yasnippet show me alternatives for snippets that start with "tod" (pre-filling the minibuffer with what I've already typed).

Thanks!

Improve documentation for embark integration

The description for integrating with embark that I found in a ticket on consult doesn't seem to work, using embark-define-keymap results in an error and I'm told to use defvar-keymap. I made a naive attempt to use defvar-keymap, but it doesn't make any change to the list of embark actions.

(use-package consult-yasnippet
  :config
  (defvar-keymap embark-yasnippet-completion-actions
     :doc "Keymap for actions for yasnippets."
     :parent embark-general-map
     "y" #'consult-yasnippet-visit-snippet-file)
  (add-to-list 'embark-keymap-alist '(yasnippet . embark-yasnippet-completion-actions)))

I think it'd be a good idea to put a (working) snippet for embark integration into the README. (I think the same goes for the marginalia integration too, actually.)

how do users normally call this?

Is the expectation that consult-yasnippet is bound to it own key, or that TAB can somehow be bound to some other function that defaults to calling consult-yasnippet when other actions don't make sense?

I'm just trying to figure out how best to use this cool-looking tool.

wrong-type-argument error when `consult-yasnippet-use-thing-at-point` is non-nil

Hi. I am using Emacs30 and the latest versions of all packages (not sure if that is related). When I have consult-yasnippet-use-thing-at-point set to t and I use consult-yasnippet, I get the following error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  #f(compiled-function (action template) #<bytecode 0x5f6aaa87c9c8a98>)(return nil)
  #f(compiled-function () #<bytecode -0x34444d2d5e98bdc>)()
  consult--with-preview-1((:debounce 0.4 any) #f(compiled-function (action template) #<bytecode 0x5f6aaa87c9c8a98>) #f(compiled-function (narrow input cand) #<bytecode -0x136ddb692b07db2c>) #f(compiled-function (&rest args2) #<bytecode -0x14e415de2bb85d7f>) #f(compiled-function () #<bytecode 0x1d2ebe30b58b9a74>))
  consult--read-1((... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :prompt "Choose a snippet: " :annotate #f(compiled-function (cand) #<bytecode -0x18ce84f80d04b690>) :initial nil :lookup consult--lookup-cdr :require-match t :state #f(compiled-function (action template) #<bytecode 0x5f6aaa87c9c8a98>) :category ...)
  consult--read((... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :prompt "Choose a snippet: " :annotate #f(compiled-function (cand) #<bytecode -0x18ce84f80d04b690>) :initial nil :lookup consult--lookup-cdr :require-match t :state #f(compiled-function (action template) #<bytecode 0x5f6aaa87c9c8a98>) :category ...)
  consult-yasnippet--read-template(nil)
  consult-yasnippet(nil)
  funcall-interactively(consult-yasnippet nil)
  call-interactively(consult-yasnippet)
  (cond (t (call-interactively #'consult-yasnippet)) (t (call-interactively #'yas-insert-snippet)))
  +default/insert-snippet()
  funcall-interactively(+default/insert-snippet)
  command-execute(+default/insert-snippet)

How to disable case sensitivity?

I noticed today that when narrowing candidates from consult-yasnippet, matches are case-sensitive. So if I type "hash", I won’t get a yasnippet named "HASH".

Could we have a user preference to turn of case-sensitive searching? Thanks!

Feature Request: Support for calling snippet from any table, not just the currently active buffer

First of all, thank you for this package! One feature I've been after is the ability to search for a snippet in any Yasnippet table, not just those available in the current buffer. This same feature would also be helpful to visit any snippet you want to edit, regardless of the current buffer. Maybe passing a prefix argument to consult-yasnippet and consult-yasnippet-visit-snippet-file could accomplish this?

Wrong type argument: yas--template, t

Hello!

I've bumped into the problem. I've installed consult-yasnippet and bound it to a keybinding.
When I press it the consult minibuffer appears with snippet variants. But when I select any the following error appears

Wrong type argument: yas--template, t

or in Messages buffer

consult-yasnippet--expand-template: Wrong type argument: yas--template, t

yasnippet and consult-yasnippet are configured as follows

(catch 'setup-quit
        (if
                (straight-use-package 'yasnippet)
                nil
            (throw 'setup-quit nil))
        (eval-after-load 'yasnippet
            #'(lambda nil
                  (progn
                      (define-key yas-minor-mode-map
                          [(tab)]
                          #'nil)
                      (define-key yas-minor-mode-map "	" #'nil))))
        (yas-global-mode 1))

(catch 'setup-quit
        (if
                (straight-use-package 'consult-yasnippet)
                nil
            (throw 'setup-quit nil))
        (global-set-key
         [f7]
         #'consult-yasnippet))

The code above is the result of macro expansion produced by setup.el which I use to configure emacs.

BTW, I use emacs 28.1 under Win10.

consult-yasnippet-visit-snippet-file doesn't work in read-only buffers

Me again! I've noticed that trying to use consult-yasnippet-visit-snippet-file in a read-only buffer produces an error. I also noticed that the regular yas-visit-snippet-file doesn't produce the same error, which makes sense because when you're just trying to visit a new file, it shouldn't matter that the buffer you're currently in is read only.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.