GithubHelp home page GithubHelp logo

sebastiansturm / consult-lsp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gagbo/consult-lsp

0.0 0.0 0.0 96 KB

LSP-mode and consult.el helping each other

License: MIT License

Emacs Lisp 100.00%

consult-lsp's Introduction

Consult LSP-mode integration

MELPA MELPA Stable

Introduction

Helm and Ivy users have extra commands that leverage lsp-mode extra information, let’s try to mimic a few features of helm-lsp and lsp-ivy in consult workflow (tested with selectrum and dogfed with vertico)

Screenshots

They tend not to be updated as often as changes happen, sorry if there are slight differences in UI. Those shots are more about giving an idea of what’s happening.

https://github.com/gagbo/consult-lsp/blob/screenshots/media/consult-lsp-diagnostics.png?raw=true

https://github.com/gagbo/consult-lsp/blob/screenshots/media/consult-lsp-symbols.png?raw=true

https://github.com/gagbo/consult-lsp/blob/screenshots/media/consult-lsp-file-symbols.png?raw=true

Commands

consult-lsp-diagnostics
Select diagnostics from current workspace. Pass prefix argument to search all workspaces
consult-lsp-symbols
Select symbols from current workspace. Pass prefix argument to search all workspaces.
consult-lsp-file-symbols
Interactively select a symbol from the current file, in a manner similar to consult-line.

There is currently no plan to add an interface to list and/or act on code-actions, but contributions are welcome!

Configuration

Customize Look and Feel

This package provides 2 entry points per command in order to customize the appearance of candidates in the selection/completion interface. This is mostly for advanced users who are somewhat familiar with consult API:

*-transformer-function
Adapter function, responsible for transforming lsp data into a valid consult candidate. a valid “consult candidate” is more often than not a propertized string, with specific properties to enable extra features.
*-annotate-builder-function
Builder function, which returns a valid lambda for annotation/affixation support. This allows to add extra information to the candidates in the interface. The returned lambda must take 1 argument and produce either a single string or a list of 3 elements (candidate prefix suffix), just as expected by either annotation-function or affixation-function

You are encouraged to take a look at the default values if you wish to customize these, especially the `file-symbols` one, which is probably the easiest ones to grok, and use marginalia.

Keys

Categories for symbols

consult-lsp-symbols and consult-lsp-file-symbols can have the set of “narrow” keys you like by customizing consult-lsp-symbols-narrow.

The cdrs of the alist must match the symbol types returned by LSP servers, AND have an “Other” key for everything that is not included.

You can find categories by looking for the SymbolKind enum in the LSP specification.

Bindings

As you can do with helm-lsp,

Use the following line to replace xref-find-apropos in lsp-mode controlled buffers:

(define-key lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols)

consult-lsp's People

Contributors

gagbo avatar northgaard avatar ashlineldridge avatar hugonobrega avatar itshoff avatar shivjm avatar syohex avatar vherrmann avatar

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.