package linol

  1. Overview
  2. Docs
LSP server library

Install

Dune Dependency

Authors

Maintainers

Sources

linol-0.10.tbz
sha256=174bb8cad5b8b0c260d62b0a85da13c4f5caba4fcee042ee58284b09de7896ea
sha512=77460788407c72a33fbe289ec9c78421117543594b3524a5c8fe836f0e272c5ceb1e1074b91c1d1f476f89b75b6f63847a8021675a782ff36457c9626121a7f4

doc/src/linol.lsp/header.ml.html

Source file header.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
type t =
  { content_length : int
  ; content_type : string
  }

let content_type t = t.content_type
let content_length t = t.content_length

module Private = struct
  module Key = struct
    let content_length = "Content-Length"
    let content_type = "Content-Type"
  end
end

open Private

let crlf = "\r\n"

let to_string { content_length; content_type } =
  let b = Buffer.create 64 in
  let add = Buffer.add_string b in
  let line k v =
    add k;
    add ": ";
    add v;
    add crlf
  in
  line Key.content_length (string_of_int content_length);
  line Key.content_type content_type;
  add crlf;
  Buffer.contents b
;;

let default_content_type = "application/vscode-jsonrpc; charset=utf-8"

let create ?(content_type = default_content_type) ~content_length () =
  { content_length; content_type }
;;
OCaml

Innovation. Community. Security.