package lsp

  1. Overview
  2. Docs
LSP protocol implementation in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

jsonrpc-1.4.0.tbz
sha256=fd138e6c4fcff32c6d15eb66cc9391b7e1183717a6d1a47c688c7f6d320a159f
sha512=567a73b3c10bb59c5a4d4e8291d1aeefdfd34438a95313fba8a485638294ca5fb8034334719631243c304d3328c27afa90dfd564fdb1e7390507a06db3a4ad03

doc/lsp.stdune/Stdune/Pp/index.html

Module Stdune.PpSource

Pretty printers

Sourcetype +'tag t

A document that is not yet rendered. The argument is the type of tags in the document. For instance tags might be used for styles.

Basic combinators

Sourceval nop : _ t

A pretty printer that prints nothing

Sourceval seq : 'a t -> 'a t -> 'a t

seq x y prints x and then y

Sourceval concat : ?sep:'a t -> 'a t list -> 'a t

concat ?sep l prints elements in l separated by sep. sep defaults to nop.

Sourceval concat_map : ?sep:'a t -> 'b list -> f:('b -> 'a t) -> 'a t

Convenience function for List.map followed by concat

Sourceval concat_mapi : ?sep:'a t -> 'b list -> f:(int -> 'b -> 'a t) -> 'a t
Sourceval verbatim : string -> _ t

An indivisible block of text

Sourceval char : char -> _ t

A single character

Sourceval text : string -> _ t

Print a bunch of text. The line may be broken at any spaces in the text.

Sourceval textf : ('a, unit, string, _ t) format4 -> 'a

Same as text but take a format string as argument.

Sourceval tag : 'a -> 'a t -> 'a t

tag x t Tag the material printed by t with x

Break hints

Sourceval space : _ t

Either a newline or a space, depending on whether the line is broken at this point.

Sourceval cut : _ t

Either a newline or nothing, depending on whether the line is broken at this point.

Sourceval break : nspaces:int -> shift:int -> _ t

Either a newline or nspaces spaces. If it is a newline, shift is added to the indentation level.

Sourceval newline : _ t

Force a newline to be printed

Sourceval map_tags : 'a t -> f:('a -> 'b) -> 'b t

Convert tags in a documents

Sourceval filter_map_tags : 'a t -> f:('a -> 'b option) -> 'b t

Boxes

Boxes are the basic components to control the layout of the text. Break hints such as space and cut may cause the line to be broken, depending on the splitting rules. Whenever a line is split, the rest of the material printed in the box is indented with indent.

Sourceval box : ?indent:int -> 'a t -> 'a t

Try to put as much as possible on each line. Additionally, a break hint always break the line if the breaking would reduce the indentation level (break with negative shift value).

Sourceval vbox : ?indent:int -> 'a t -> 'a t

Always break the line when encountering a break hint.

Sourceval hbox : 'a t -> 'a t

Print everything on one line, no matter what

Sourceval hvbox : ?indent:int -> 'a t -> 'a t

If possible, print everything on one line. Otherwise, behave as a vbox

Sourceval hovbox : ?indent:int -> 'a t -> 'a t

Try to put as much as possible on each line.

Common convenience functions

Sourceval enumerate : 'a list -> f:('a -> 'b t) -> 'b t

enumerate l ~f produces an enumeration of the form:

- item1 - item2 - item3 ...
Sourceval chain : 'a list -> f:('a -> 'b t) -> 'b t

chain l ~f is used to print a succession of items that follow each other. It produces an output of this form:

item1 -> item2 -> item3 ...

Operators

Sourcemodule O : sig ... end

Rendering

Sourceval render : Format.formatter -> 'a t -> tag_handler:(Format.formatter -> 'a -> 'a t -> unit) -> unit

Render a document to a classic formatter

Sourceval render_ignore_tags : Format.formatter -> 'a t -> unit
OCaml

Innovation. Community. Security.