-
Notifications
You must be signed in to change notification settings - Fork 151
support settings through didChangeConfiguration notification
#1103
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Configuration | ||
|
|
||
| The ocamllsp support the folowing configuration. These configurations are sent through the [`didChangeConfiguration`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeConfiguration) notification. | ||
|
|
||
| ```ts | ||
| interface config { | ||
| /** | ||
| * Enable/Disabe Extended Hover | ||
| * @default false | ||
| * @since 1.16 | ||
| */ | ||
| extendedHover: { enable : boolean } | ||
aspeddro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Enable/Disable CodeLens | ||
| * @default true | ||
| * @since 1.16 | ||
| */ | ||
| codelens: { enable : boolean } | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,262 @@ | ||
| open Import | ||
| open Import.Json.Conv | ||
|
|
||
| module Lens = struct | ||
| type t = { enable : bool [@default true] } | ||
| [@@deriving_inline yojson] [@@yojson.allow_extra_fields] | ||
|
|
||
| let _ = fun (_ : t) -> () | ||
|
|
||
| let t_of_yojson = | ||
| (let _tp_loc = "ocaml-lsp-server/src/config_data.ml.Lens.t" in | ||
| function | ||
| | `Assoc field_yojsons as yojson -> ( | ||
| let enable_field = ref Ppx_yojson_conv_lib.Option.None | ||
| and duplicates = ref [] | ||
| and extra = ref [] in | ||
| let rec iter = function | ||
| | (field_name, _field_yojson) :: tail -> | ||
| (match field_name with | ||
| | "enable" -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) enable_field with | ||
| | Ppx_yojson_conv_lib.Option.None -> | ||
| let fvalue = bool_of_yojson _field_yojson in | ||
| enable_field := Ppx_yojson_conv_lib.Option.Some fvalue | ||
| | Ppx_yojson_conv_lib.Option.Some _ -> | ||
| duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| | _ -> ()); | ||
| iter tail | ||
| | [] -> () | ||
| in | ||
| iter field_yojsons; | ||
| match Ppx_yojson_conv_lib.( ! ) duplicates with | ||
| | _ :: _ -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_duplicate_fields | ||
| _tp_loc | ||
| (Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| yojson | ||
| | [] -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) extra with | ||
| | _ :: _ -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_extra_fields | ||
| _tp_loc | ||
| (Ppx_yojson_conv_lib.( ! ) extra) | ||
| yojson | ||
| | [] -> | ||
| let enable_value = Ppx_yojson_conv_lib.( ! ) enable_field in | ||
| { enable = | ||
| (match enable_value with | ||
| | Ppx_yojson_conv_lib.Option.None -> true | ||
| | Ppx_yojson_conv_lib.Option.Some v -> v) | ||
| })) | ||
| | _ as yojson -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_list_instead_atom | ||
| _tp_loc | ||
| yojson | ||
| : Ppx_yojson_conv_lib.Yojson.Safe.t -> t) | ||
|
|
||
| let _ = t_of_yojson | ||
|
|
||
| let yojson_of_t = | ||
| (function | ||
| | { enable = v_enable } -> | ||
| let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in | ||
| let bnds = | ||
| let arg = yojson_of_bool v_enable in | ||
| ("enable", arg) :: bnds | ||
| in | ||
| `Assoc bnds | ||
| : t -> Ppx_yojson_conv_lib.Yojson.Safe.t) | ||
|
|
||
| let _ = yojson_of_t | ||
|
|
||
| [@@@end] | ||
| end | ||
|
|
||
| module ExtendedHover = struct | ||
| type t = { enable : bool [@default false] } | ||
| [@@deriving_inline yojson] [@@yojson.allow_extra_fields] | ||
|
|
||
| let _ = fun (_ : t) -> () | ||
|
|
||
| let t_of_yojson = | ||
| (let _tp_loc = "ocaml-lsp-server/src/config_data.ml.ExtendedHover.t" in | ||
| function | ||
| | `Assoc field_yojsons as yojson -> ( | ||
| let enable_field = ref Ppx_yojson_conv_lib.Option.None | ||
| and duplicates = ref [] | ||
| and extra = ref [] in | ||
| let rec iter = function | ||
| | (field_name, _field_yojson) :: tail -> | ||
| (match field_name with | ||
| | "enable" -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) enable_field with | ||
| | Ppx_yojson_conv_lib.Option.None -> | ||
| let fvalue = bool_of_yojson _field_yojson in | ||
| enable_field := Ppx_yojson_conv_lib.Option.Some fvalue | ||
| | Ppx_yojson_conv_lib.Option.Some _ -> | ||
| duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| | _ -> ()); | ||
| iter tail | ||
| | [] -> () | ||
| in | ||
| iter field_yojsons; | ||
| match Ppx_yojson_conv_lib.( ! ) duplicates with | ||
| | _ :: _ -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_duplicate_fields | ||
| _tp_loc | ||
| (Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| yojson | ||
| | [] -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) extra with | ||
| | _ :: _ -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_extra_fields | ||
| _tp_loc | ||
| (Ppx_yojson_conv_lib.( ! ) extra) | ||
| yojson | ||
| | [] -> | ||
| let enable_value = Ppx_yojson_conv_lib.( ! ) enable_field in | ||
| { enable = | ||
| (match enable_value with | ||
| | Ppx_yojson_conv_lib.Option.None -> false | ||
| | Ppx_yojson_conv_lib.Option.Some v -> v) | ||
| })) | ||
| | _ as yojson -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_list_instead_atom | ||
| _tp_loc | ||
| yojson | ||
| : Ppx_yojson_conv_lib.Yojson.Safe.t -> t) | ||
|
|
||
| let _ = t_of_yojson | ||
|
|
||
| let yojson_of_t = | ||
| (function | ||
| | { enable = v_enable } -> | ||
| let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in | ||
| let bnds = | ||
| let arg = yojson_of_bool v_enable in | ||
| ("enable", arg) :: bnds | ||
| in | ||
| `Assoc bnds | ||
| : t -> Ppx_yojson_conv_lib.Yojson.Safe.t) | ||
|
|
||
| let _ = yojson_of_t | ||
|
|
||
| [@@@end] | ||
| end | ||
|
|
||
| type t = | ||
| { codelens : Lens.t Json.Nullable_option.t | ||
| [@default None] [@yojson_drop_default ( = )] | ||
aspeddro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ; extended_hover : ExtendedHover.t Json.Nullable_option.t | ||
| [@key "extendedHover"] [@default None] [@yojson_drop_default ( = )] | ||
| } | ||
| [@@deriving_inline yojson] [@@yojson.allow_extra_fields] | ||
|
|
||
| let _ = fun (_ : t) -> () | ||
|
|
||
| let t_of_yojson = | ||
| (let _tp_loc = "ocaml-lsp-server/src/config_data.ml.t" in | ||
| function | ||
| | `Assoc field_yojsons as yojson -> ( | ||
| let codelens_field = ref Ppx_yojson_conv_lib.Option.None | ||
| and extended_hover_field = ref Ppx_yojson_conv_lib.Option.None | ||
| and duplicates = ref [] | ||
| and extra = ref [] in | ||
| let rec iter = function | ||
| | (field_name, _field_yojson) :: tail -> | ||
| (match field_name with | ||
| | "codelens" -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) codelens_field with | ||
| | Ppx_yojson_conv_lib.Option.None -> | ||
| let fvalue = | ||
| Json.Nullable_option.t_of_yojson Lens.t_of_yojson _field_yojson | ||
| in | ||
| codelens_field := Ppx_yojson_conv_lib.Option.Some fvalue | ||
| | Ppx_yojson_conv_lib.Option.Some _ -> | ||
| duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| | "extendedHover" -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) extended_hover_field with | ||
| | Ppx_yojson_conv_lib.Option.None -> | ||
| let fvalue = | ||
| Json.Nullable_option.t_of_yojson | ||
| ExtendedHover.t_of_yojson | ||
| _field_yojson | ||
| in | ||
| extended_hover_field := Ppx_yojson_conv_lib.Option.Some fvalue | ||
| | Ppx_yojson_conv_lib.Option.Some _ -> | ||
| duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| | _ -> ()); | ||
| iter tail | ||
| | [] -> () | ||
| in | ||
| iter field_yojsons; | ||
| match Ppx_yojson_conv_lib.( ! ) duplicates with | ||
| | _ :: _ -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_duplicate_fields | ||
| _tp_loc | ||
| (Ppx_yojson_conv_lib.( ! ) duplicates) | ||
| yojson | ||
| | [] -> ( | ||
| match Ppx_yojson_conv_lib.( ! ) extra with | ||
| | _ :: _ -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_extra_fields | ||
| _tp_loc | ||
| (Ppx_yojson_conv_lib.( ! ) extra) | ||
| yojson | ||
| | [] -> | ||
| let codelens_value, extended_hover_value = | ||
| ( Ppx_yojson_conv_lib.( ! ) codelens_field | ||
| , Ppx_yojson_conv_lib.( ! ) extended_hover_field ) | ||
| in | ||
| { codelens = | ||
| (match codelens_value with | ||
| | Ppx_yojson_conv_lib.Option.None -> None | ||
| | Ppx_yojson_conv_lib.Option.Some v -> v) | ||
| ; extended_hover = | ||
| (match extended_hover_value with | ||
| | Ppx_yojson_conv_lib.Option.None -> None | ||
| | Ppx_yojson_conv_lib.Option.Some v -> v) | ||
| })) | ||
| | _ as yojson -> | ||
| Ppx_yojson_conv_lib.Yojson_conv_error.record_list_instead_atom | ||
| _tp_loc | ||
| yojson | ||
| : Ppx_yojson_conv_lib.Yojson.Safe.t -> t) | ||
|
|
||
| let _ = t_of_yojson | ||
|
|
||
| let yojson_of_t = | ||
| (function | ||
| | { codelens = v_codelens; extended_hover = v_extended_hover } -> | ||
| let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in | ||
| let bnds = | ||
| if None = v_extended_hover then bnds | ||
| else | ||
| let arg = | ||
| (Json.Nullable_option.yojson_of_t ExtendedHover.yojson_of_t) | ||
| v_extended_hover | ||
| in | ||
| let bnd = ("extendedHover", arg) in | ||
| bnd :: bnds | ||
| in | ||
| let bnds = | ||
| if None = v_codelens then bnds | ||
| else | ||
| let arg = | ||
| (Json.Nullable_option.yojson_of_t Lens.yojson_of_t) v_codelens | ||
| in | ||
| let bnd = ("codelens", arg) in | ||
| bnd :: bnds | ||
| in | ||
| `Assoc bnds | ||
| : t -> Ppx_yojson_conv_lib.Yojson.Safe.t) | ||
|
|
||
| let _ = yojson_of_t | ||
|
|
||
| [@@@end] | ||
|
|
||
| let default = | ||
| { codelens = Some { enable = true } | ||
| ; extended_hover = Some { enable = false } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.