Git Product home page Git Product logo

ivy-xref's Introduction

ivy-xref - select from xref candidates with ivy

License GPL 3 MELPA Build Status

Use Ivy as the interface to select from xref candidates.

Installation

MELPA

The preferred way to install ivy-xref is via MELPA - then you can just M-x package-install RET ivy-xref RET

To enable then simply add the following to your init file:

(require 'ivy-xref)
;; xref initialization is different in Emacs 27 - there are two different
;; variables which can be set rather than just one
(when (>= emacs-major-version 27)
  (setq xref-show-definitions-function #'ivy-xref-show-defs))
;; Necessary in Emacs <27. In Emacs 27 it will affect all xref-based
;; commands other than xref-find-definitions (e.g. project-find-regexp)
;; as well
(setq xref-show-xrefs-function #'ivy-xref-show-xrefs)

We recommend to use use-package to make this automatic:

(use-package ivy-xref
  :ensure t
  :init
  ;; xref initialization is different in Emacs 27 - there are two different
  ;; variables which can be set rather than just one
  (when (>= emacs-major-version 27)
    (setq xref-show-definitions-function #'ivy-xref-show-defs))
  ;; Necessary in Emacs <27. In Emacs 27 it will affect all xref-based
  ;; commands other than xref-find-definitions (e.g. project-find-regexp)
  ;; as well
  (setq xref-show-xrefs-function #'ivy-xref-show-xrefs))

Manual installation

If you would like to install the package manually, download or clone it and place within Emacs' load-path, then enable as above.

License

Copyright © 2017 Alex Murray

Distributed under GNU GPL, version 3.

ivy-xref's People

Contributors

alexmurray avatar aslpavel avatar dgutov avatar eush77 avatar mookid avatar purcell avatar whame 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  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  avatar  avatar  avatar  avatar  avatar

ivy-xref's Issues

Close *xref* buffer

I've noticed that even when using ivy-xref, the *xref* buffer is created. Would it make sense to close the *xref* buffer after an option has been selected when following a reference that has multiple options or cancelling the command?

preview current candidate?

I know we can't have automatic preview of the candidates (because then we'd have to find and open those files), but it'd be nice if we had a command like ivy-call-and-recenter (which is used with counsel-rg) that when called, navigates to the file referenced by the current candidate and shows it to us.

Using predefined font face for candidates

Hi, currently ivy-xref shows all candidates using their original faces which might be hard to read.

Does it make sense to provide a way that renders all candidates cleanly? Thanks. Also it might be better to have the file:line parts rendered differently :)

ivy-xref won't open the completion buffer as expected (spacemacs)

I am using spacemacs with ivy layer but I noticed that doing C-M-i won't bring up the completion buffer as expected. Can someone give some pointer about why it happened? Replacing ivy with helm works as expected so it should be something in the ivy layer. Thx

screenshot from 2018-05-30 10-46-43

"Selecting deleted buffer" after #27

Since updating to a version of ivy-xref including #27 I'm now getting "Selected deleted buffer" when using xref-find-references.

Changing (quit-window t) back to (quit-window) seems to fix it.

I'm using emacs 27.2 installed via homebrew and d12frosted/emacs-plus/emacs-plus@27.

Option to turn off sorting

ivy-xref can be used for language server protocol [workspace/symbol] and here is an example in cquery

The results are sorted on the server side and thus client-side sorting should be disabled.

ivy-xref.el:54
-    collection)))
+   (nreverse collection)))

I searched for set name but the best fit is listed at the bottom

syl20bnr/spacemacs#10211 adds ivy-xref to the +tools/lsp layer. It will be much appreciated if you could give some advice or push forward that PR (((

Doesn't work with dired-do-find-regexp-and-replace

When I use dired-do-find-regexp-and-replace in dired-mode to multi-replace some strings in multiple files, ivy-xref doesn't work well. Actually it doesn't jump to the string properly, while it works after (setq xref-show-xrefs-function #'xref--show-xref-buffer).

wrong-number-of-arguments error in Emacs 25.3 and older

(wrong-number-of-arguments (3 . 3) 2)

This is caused by #11. Specifically, the signature of xref--show-pos-in-buf has changed between Emacs 25.3 and 26.1.

;; 25.3
(xref--show-pos-in-buf POS BUF SELECT)
;; 26.1
(xref--show-pos-in-buf POS BUF)  ; what #11 is using

I'd suggest either bumping the (emacs "25.1") dependency to (emacs "26.1"), or conditionally use one or the other function depending on the current version of Emacs.

Feature request: improve information display

It would be great if it was possible for the symbol context part (not the file name/path) was aligned to some configurable column (and leading whitespace removed). Also, when the file name/path information doesn't fit, it is truncated on the left. This is especially useful when ivy-xref-use-file-path has been enabled because duplicated file names in the project make it otherwise impossible to distinguish them, and the project is quite deep.

Example output:

...some/very/long/foobar.cpp:33   class foobar
        less/long/foobar.cpp:66   class foobar

Random buffer opening

Hi,

thanks for this package. This is how I have it configured:

(use-package ivy-xref                   ; Ivy interface for xref results
  :ensure t
  :config (setq xref-show-xrefs-function #'ivy-xref-show-xrefs))

I am using GNU Emacs 27.0.50 (build 1, x86_64-debian-linux-gnu, GTK+ Version 3.18.9) of 2018-02-28, and when I select a candidate the resulting buffer is opened in a "random" window. I'll let the screencast do the talking. :)

Screencast 2018-02-28 15:31:51.mp4.zip

ivy-call: Selecting deleted buffer

When xref-find-references to find references for python code with lsp-python,
upon selecting a result for reference, emacs raised this error: selecting deleted buffer.

emacs version: 26.1
OS: macOS Mojave
latest ivy-xref

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.