Skip to content

Add markdown code block syntax highlight support #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add needed LSP protocol types for code lenses.
  • Loading branch information
zth committed Jul 25, 2022
commit 76a7c237056a438623ba42411ef5627903418f1c
22 changes: 22 additions & 0 deletions analysis/src/Protocol.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
type position = {line: int; character: int}
type range = {start: position; end_: position}
type markupContent = {kind: string; value: string}
type command = {title: string; command: string}
type codeLens = {range: range; command: command option}
type inlayHint = {
position: position;
label: string;
Expand Down Expand Up @@ -147,6 +149,26 @@ let stringifyHint hint =
(stringifyPosition hint.position)
(Json.escape hint.label) hint.kind hint.paddingLeft hint.paddingRight

let stringifyCommand (command : command) =
Printf.sprintf
{|{
"title": "%s",
"command": "%s"
}|}
(Json.escape command.title)
(Json.escape command.command)

let stringifyCodeLens (codeLens : codeLens) =
Printf.sprintf
{|{
"range": %s,
"command": %s
}|}
(stringifyRange codeLens.range)
(match codeLens.command with
| None -> ""
| Some command -> stringifyCommand command)

(* https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic *)
let stringifyDiagnostic d =
Printf.sprintf
Expand Down