Skip to content
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

fix: update DocumentSelector definition #1068

Merged
merged 1 commit into from Apr 25, 2023

Conversation

rgrinberg
Copy link
Member

@rgrinberg rgrinberg commented Apr 25, 2023

Signed-off-by: Rudi Grinberg me@rgrinberg.com

cc @qua3k

@rgrinberg rgrinberg linked an issue Apr 25, 2023 that may be closed by this pull request
@rgrinberg rgrinberg force-pushed the ps/rr/fix__update_documentselector_definition branch from 224f200 to 14e9b23 Compare April 25, 2023 00:07
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: 9cc794e7-034d-4ad0-938f-a25e59406651 -->
@rgrinberg rgrinberg requested a review from 3Rafal April 25, 2023 00:08
@rgrinberg rgrinberg force-pushed the ps/rr/fix__update_documentselector_definition branch from 14e9b23 to 76a01b7 Compare April 25, 2023 00:08
@@ -4878,85 +4878,19 @@ module DocumentFilter = struct
end

module DocumentSelector = struct
type t = [ `String of string | `DocumentFilter of DocumentFilter.t ] list
[@@deriving_inline yojson]
type t = DocumentFilter.t list [@@deriving_inline yojson]

let _ = fun (_ : t) -> ()

let t_of_yojson =
(let _tp_loc = "lsp/src/types.ml.DocumentSelector.t" in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this let binding seems no longer needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, but this part of the file is generated. So we would need to modify the code generator to make this cleaner.

_tp_loc
yojson)
t
fun t -> list_of_yojson DocumentFilter.t_of_yojson t
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
I guess we can eta reduce to shorter version:

  let t_of_yojson =
    (list_of_yojson DocumentFilter.t_of_yojson
      : Ppx_yojson_conv_lib.Yojson.Safe.t -> t)

similarly with yojson_of_t

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this would require tweaking the code generator which is a lot more work. Feel free to do it though.

@qua3k
Copy link

qua3k commented Apr 25, 2023

This PR works well but when I attempt to generate types.ml from the metamodel on my own I don’t get the same output

@rgrinberg rgrinberg merged commit 07ba12b into master Apr 25, 2023
9 of 11 checks passed
@rgrinberg rgrinberg deleted the ps/rr/fix__update_documentselector_definition branch April 25, 2023 14:23
@rgrinberg
Copy link
Member Author

This PR works well but when I attempt to generate types.ml from the metamodel on my own I don’t get the same output

The code generation process is a bit janky at the moment. You need to run @cinaps, @lint, and @fmt in order to get the generated code. I need to improve dune first to make this simpler.

rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Jun 18, 2023
CHANGES:

## Fixes

- Disable code lens by default. The support can be re-enabled by explicitly
  setting it in the configuration. (ocaml/ocaml-lsp#1134)

- Fix initilization of `ocamlformat-rpc` in some edge cases when ocamlformat is
  initialized concurrently (ocaml/ocaml-lsp#1132)

- Kill unnecessary `$ dune ocaml-merlin` with SIGTERM rather than SIGKILL
  (ocaml/ocaml-lsp#1124)

- Refactor comment parsing to use `odoc-parser` and `cmarkit` instead of
  `octavius` and `omd` (ocaml/ocaml-lsp#1088)

  This allows users who migrated to omd 2.X to install ocaml-lsp-server in the
  same opam switch.

  We also slightly improved markdown generation support and fixed a couple in
  the generation of inline heading and module types.

- Allow opening documents that were already open. This is a workaround for
  neovim's lsp client (ocaml/ocaml-lsp#1067)

- Disable type annotation for functions (ocaml/ocaml-lsp#1054)

- Respect codeActionLiteralSupport capability (ocaml/ocaml-lsp#1046)

- Fix a document syncing issue when utf-16 is the position encoding (ocaml/ocaml-lsp#1004)

- Disable "Type-annotate" action for code that is already annotated.
  ([ocaml/ocaml-lsp#1037](ocaml/ocaml-lsp#1037)), fixes
  [ocaml/ocaml-lsp#1036](ocaml/ocaml-lsp#1036)

- Fix semantic highlighting of long identifiers when using preprocessors
  ([ocaml/ocaml-lsp#1049](ocaml/ocaml-lsp#1049), fixes
  [ocaml/ocaml-lsp#1034](ocaml/ocaml-lsp#1034))

- Fix the type of DocumentSelector in cram document registration (ocaml/ocaml-lsp#1068)

- Accept the `--clientProcessId` command line argument. (ocaml/ocaml-lsp#1074)

- Accept `--port` as a synonym for `--socket`. (ocaml/ocaml-lsp#1075)

- Fix connecting to dune rpc on Windows. (ocaml/ocaml-lsp#1080)

## Features

- Add "Remove type annotation" code action. (ocaml/ocaml-lsp#1039)

- Support settings through `didChangeConfiguration` notification (ocaml/ocaml-lsp#1103)

- Add "Extract local" and "Extract function" code actions. (ocaml/ocaml-lsp#870)

- Depend directly on `merlin-lib` 4.9 (ocaml/ocaml-lsp#1070)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DocumentSelector is of wrong type
3 participants