Giter Site home page Giter Site logo

lsp-mode's Introduction

emacs-lsp

Join the chat at https://gitter.im/emacs-lsp/lsp-mode

Build Status MELPA

A Emacs Lisp library for implementing clients for servers using Microsoft's Language Server Protocol (v3.0).

The library is designed to integrate with existing Emacs IDE frameworks (completion-at-point, xref (beginning with Emacs 25.1), flycheck, etc).

This package is still under development, and is not recommended for daily use.

Installation

Clone this repository to a suitable path, and add

(add-to-list 'load-path "<path to emacs-lsp>")
(with-eval-after-load 'lsp-mode
    (require 'lsp-flycheck))
(require 'lsp-mode)

(lsp-define-stdio-client
 ;; This can be a symbol of your choosing. It will be used as a the
 ;; prefix for a dynamically generated function "-enable"; in this
 ;; case: lsp-prog-major-mode-enable
 lsp-prog-major-mode
 "language-id"
 ;; This will be used to report a project's root directory to the LSP
 ;; server.
 (lambda () default-directory)
 ;; This is the command to start the LSP server. It may either be a
 ;; string containing the path of the command, or a list wherein the
 ;; car is a string containing the path of the command, and the cdr
 ;; are arguments to that command.
 '("/my/lsp/server" "and" "args"))

;; Here we'll add the function that was dynamically generated by the
;; call to lsp-define-stdio-client to the major-mode hook of the
;; language we want to run it under.
;;
;; This function will turn lsp-mode on and call the command given to
;; start the LSP server.
(add-hook 'prog-major-mode #'lsp-prog-major-mode-enable)

to your .emacs, where prog-major-mode is the hook variable for a supported programming language major mode.

Adding support for languages

See API docs

Examples

completion

Completion is provided with the native completion-at-point (C-M-i), and should therefore work with any other completion backend. Async completion is provided by company-lsp.

completion

eldoc (Help on hover)

Hover support is provided with eldoc, which should be enabled automatically.

eldoc

Goto definition

Use M - . (xref-find-definition) to find the definition for the symbol under point.

gotodef

Symbol references

Use M - ? (xref-find-references) to find the references to the symbol under point.

ref

Symbol Highlighting

sym_highlight

Flycheck

flycheck

Imenu

imenu-1 imenu-2

helm-imenu

Finer Control of Starting lsp-mode

In order to more finely control the lsp-mode startup, there are a number of customizable variables.

lsp-project-whitelist : Defaults to nil. If set, lsp-mode will only be started if the given project root appears in the whitelist.

lsp-project-blacklist : Defaults to nil. If set, all projects will be started except those in this list. It is ignored if lsp-project-whitelist is set.

There are also the functions lsp-MAJOR-MODE-whitelist-add and lsp-MAJOR-MODE-whitelist-remove to adjust the current buffer project root entry on the whitelist.

lsp-mode's People

Contributors

vibhavp avatar alanz avatar sebastiencs avatar phst avatar gpittarelli avatar purcell avatar fmdkdd avatar bkchr avatar jaelsasser avatar juergenhoetzel avatar tutysara avatar sham1 avatar tigersoldier avatar kat-co avatar syohex avatar rski avatar nateeag avatar astahlman avatar gicmo avatar freebroccolo avatar maskray avatar gdkrmr avatar smarter avatar hdhoang avatar akermu avatar martinwolke avatar ruialias avatar stakemori avatar gitter-badger avatar wilfred avatar

Watchers

Parker McGee avatar James Cloos 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.