Giter Site home page Giter Site logo

idris2-lsp's Introduction

[WIP] idris2-lsp

Language Server for Idris2.

NOTE: At this stage the LSP server requires an ipkg file to work correctly, for reference material about packages look here and here. To start a new project with an ipkg, even for a single file, you can issue the idris2 --init command, which provides an interactive interface for package creation.

Setup

# If you already have idris2, uninstall idris2 unless you installed it from source
git clone https://github.com/idris-community/idris2-lsp.git # Clone this repository
cd idris2-lsp
git submodule update --init Idris2 # Get the associated Idris commit
cd Idris2 # Change into the Idris2 directory
make bootstrap SCHEME=chez # Boostrap Idris
make install # Install Idris
# If needed, modify your shell files to ensure ~/.idris2/bin is in your PATH
make clean # Clean Idris
make all # Build Idris
make install # Install Idris
make install-with-src-libs # Install sources for libraries
make install-with-src-api # Install the API with sources
cd .. # Go back to the idris2-lsp directory
make install # Install idris2-lsp

Editor Plugins

Refer to the project wiki for editor-specific configurations.

Compile

To compile idris2-lsp you need a working installation of the Idris2 compiler (available here) and you also need the idris2api package. See the install guide how to build the idris2api package.

NOTE: The version of the Idris2 compiler available as submodule is the only tested version, we will try to keep in sync with the latest master. For specific releases of the compiler refer to the branches with the same name as the release.

Install

Run make install to install the server, by default it will be placed in the same default directory of the Idris2 compiler, i.e. ~/.idris2/bin.

Go to commands and package dependencies

The server provides support for some go to commands, e.g. go to definition, however to reach modules declared in other packages you must install packages with idris2 --install-with-src instead of idris2 --install. To access the standard library run make install-with-src-libs after building the compiler and make install-with-src-api if you also want to access to the idris2api package.

Configuration options

Server options that can be set via the initializationOptions object in the initialization message:

Option key Type Description
logFile string Absolute location of the log file for the server (default: stderr)
longActionTimeout number Timeout in ms for long actions, e.g. expression search (default: 5000)
maxCodeActionResults number Maximum number of multiple code actions for a single command, e.g. expression search (default: 5)
showImplicits boolean Show implicits in hovers
fullNamespace boolean Show full namespace in hovers

Code Actions Filters

As per specification, client can filter requested code actions with the context.only field in the request parameters. The following table specifies the list of keys that enable each code actions. A null field enables all actions, while an empty array disables all actions.

Code Action Allowed Keys
CaseSplit refactor.rewrite,refactor.rewrite.CaseSplit
ExprSearch refactor.rewrite,refactor.rewrite.ExprSearch
GenerateDef refactor.rewrite,refactor.rewrite.GenerateDef
MakeCase refactor.rewrite,refactor.rewrite.MakeCase
MakeClause refactor.rewrite,refactor.rewrite.MakeClause
MakeLemma refactor.extract,refactor.extract.MakeLemma
MakeWith refactor.rewrite,refactor.rewrite.MakeWith
RefineHole refactor.rewrite,refactor.rewrite.RefineHole

Examples

Some examples can be found in the test/lsp/example directory. Many of the existing functionality still needs to be documented.

idris2-lsp's People

Contributors

shinkage avatar michaelmesser avatar andorp avatar russoul avatar z-snails avatar bamboo avatar claymager avatar alissa-tung avatar alexhumphreys avatar cloudifold avatar buzden avatar nonius avatar joeyeremondi avatar ionathanch avatar mattpolzin avatar ywata avatar stefan-hoeck 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.