Giter Club home page Giter Club logo

ocaml-lsp's Introduction

OCaml-LSP

This project contains an implementation of an LSP server for OCaml and a standalone implementation of the LSP protocol.

Installation

We recommend to install the server via a project such as opam or esy.

Opam

To install the lsp server in a particular opam switch:

$ opam pin add ocaml-lsp-server https://github.com/ocaml/ocaml-lsp.git
$ opam install ocaml-lsp-server

Note that you will need to run install the lsp server in every switch where you'd like to use it.

Esy

To add the lsp server to an esy project, add the following lines to your project's package.json:

  "devDependencies": {
    "@opam/ocaml-lsp-server": "*"
  },
  "resolutions": {
    "@opam/ocaml-lsp-server": "github:ocaml/ocaml-lsp:ocaml-lsp-server.opam#<git-commit-sha>"
  }

Note that you need to specify a specific git commit sha from this repository instead of <git-commit-sha> placeholder above.

Source

This project uses submodules to handle dependencies. This is done so that users who install ocaml-lsp-server into their sandbox will not share constraints on the same dependencies that ocaml-lsp-server is using.

$ git clone --recurse-submodules http://github.com/ocaml/ocaml-lsp.git
$ cd ocaml-lsp
$ make build

Features

The server supports the following queries:

  • textDocument/completion
  • completionItem/resolve
  • textdocument/hover
  • textDocument/signatureHelp
  • textDocument/declaration
  • textDocument/definition
  • textDocument/typeDefinition
  • textDocument/implementation
  • textDocument/codeLens
  • textDocument/documentHighlight
  • textDocument/documentSymbol
  • textDocument/references
  • textDocument/documentColor
  • textDocument/colorPresentation
  • textDocument/formatting
  • textDocument/rangeFormatting
  • textDocument/onTypeFormatting
  • textDocument/prepareRename
  • textDocument/foldingRange
  • textDocument/selectionRange
  • workspace/symbol

Note that degrees of support for each LSP request are varying.

Tests

To run tests execute:

$ make test

Note that tests require Node.js and Yarn installed.

Relationship to Other Tools

The lsp server uses merlin under the hood, but users are not required to have merlin installed. We vendor merlin because we currently heavily depend on some implementation details of merlin that make infeasible to upgrade the lsp server and merlin independently.

History

The implementation of the lsp protocol itself was taken from facebook's hack

Previously, this lsp server was a part of merlin, until it was realized that the lsp protocol covers a wider scope than merlin.

Comparison to other LSP Servers for OCaml

Note that the comparisons below make no claims of being objective and may be entirely out of date:

  • reason-language-server This server supports bucklescript & reason. However, this project does not use merlin which means that it supports less versions of OCaml and offers less "smart" functionality - especially in the face of sources that do not yet compile.

  • ocaml-language-server This project is extremely similar in the functionality it provides because it also reuses merlin on the backend. The essential difference is that this project is written in typescript, while our server is in OCaml. We feel that it's best to use OCaml to maximize the contributor pool.

ocaml-lsp's People

Contributors

actionshrimp avatar andreypopp avatar c-cube avatar cannorin avatar edwintorok avatar fourchaux avatar gbury avatar ggreif avatar giltho avatar jorisgio avatar khady avatar let-def avatar manasjayanth avatar pinotree avatar rgrinberg avatar rusty-key avatar unixjunkie avatar zindel avatar

Watchers

 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.