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

[locate] reset state from entry points #1364

Merged
merged 3 commits into from
Jul 13, 2021
Merged

[locate] reset state from entry points #1364

merged 3 commits into from
Jul 13, 2021

Conversation

trefis
Copy link
Contributor

@trefis trefis commented Jul 13, 2021

Alternative to #1339, which would have broken the test unattached-comments.t.
Note: the test, as is, would have resulted in "No documentation", but could also have been written in such a way that a docstring from the file being edited would (incorrectly) be returned.

The issue is that the global state wasn't always properly reset between calls, which this PR fixes.

PS: I believe we can still craft cases where an incorrect docstring is returned, in cases where "fallback" happen. Fallback makes sense in the context of locate (to take you the furthest place it found), but probably doesn't make sense for documentation retrieval?

@trefis trefis merged commit 172601c into master Jul 13, 2021
@trefis trefis deleted the locate-state-reset branch July 13, 2021 14:28
voodoos added a commit to voodoos/merlin that referenced this pull request Jul 20, 2021
[locate] reset state from entry points
voodoos added a commit to voodoos/merlin that referenced this pull request Jul 20, 2021
[locate] reset state from entry points
voodoos added a commit to voodoos/merlin that referenced this pull request Jul 20, 2021
[locate] reset state from entry points
Tests adapted to >4.08 <4.11
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 11:13:37 AM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested,
      `<c-i>` and `<c-u>`
      to show more or less deep results. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 11:13:37 AM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested,
      `<c-i>` and `<c-u>`
      to show more or less deep results. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 11:13:37 AM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested,
      `<c-i>` and `<c-u>`
      to show more or less deep results. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 11:13:37 AM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested,
      `<c-i>` and `<c-u>`
      to show more or less deep results. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 11:13:37 AM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested,
      `<c-i>` and `<c-u>`
      to show more or less deep results. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 11:13:37 AM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested,
      `<c-i>` and `<c-u>`
      to show more or less deep results. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 04:45:37 PM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested, `<c-i>`
      and `<c-u>` can be use to change the depth of the recursive
      construction. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
    - disable tests failing in Opam's CI due to nested dune projects (ocaml/merlin#1373)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 04:45:37 PM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested, `<c-i>`
      and `<c-u>` can be use to change the depth of the recursive
      construction. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
    - disable tests failing in Opam's CI due to nested dune projects (ocaml/merlin#1373)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jul 26, 2021
CHANGES:

Mon Jul 26 04:45:37 PM CET 2021

  + merlin binary
    - recover ill-typed patterns (ocaml/merlin#1317, ocaml/merlin#1342)
    - more accurate type-enclosing for methods (ocaml/merlin#1328, fixes ocaml/merlin#1124)
    - fix location of patterns in Occurrences (ocaml/merlin#1324, fixes ocaml/ocaml-lsp#375)
    - fix location of module definitions done via functors (ocaml/merlin#1329, fixes ocaml/merlin#1199)
    - fix -cmt-path dirs mistakenly added to build path (ocaml/merlin#1330)
    - add new module holes that can replace module expressions (ocaml/merlin#1333)
    - add a new command `construct` that builds a list of possible terms when
      called on a typed hole (ocaml/merlin#1318)
    - `refactor-open` improvements (ocaml/merlin#1313, ocaml/merlin#1314, ocaml/merlin#1366, ocaml/merlin#1372)
      - do not make paths absolute, simply prefix with the identifier under
      the cursor
        ```ocaml
        open Foo (* calling refactor-open qualify on this open *)
        let _ = Foo.bar (* previously could result in [Dune__exe.Foo.bar] *)
        ```
      - do not return identical (duplicate) edits
      - do not return unnecessary edits that when applied do not change
        the document
      - handle record fields properly
      - handle multi-line paths
      - `unqualify` should not qualify
    - Handle `Persistent_env.Error` in `Typemod.initial_env` (ocaml/merlin#1355)
    - locate: reset global state from all entry points (ocaml/merlin#1364)
    - Windows: replace user name by its SID in socketnames (ocaml/merlin#1345, @ttamttam)
  + editor modes
    - vim: add a simple interface to the new `construct` command:
      `MerlinConstruct`. When several results are suggested, `<c-i>`
      and `<c-u>` can be use to change the depth of the recursive
      construction. (ocaml/merlin#1318)
    - vim: add support for the `merlin-locate-type` command:
      `MerlinLocateType` (ocaml/merlin#1359)
    - emacs: add a simple interface to the new `construct` command:
      `merlin-construct`. (ocaml/merlin#1352)
    - emacs: add support for the `merlin-locate-type` command. (ocaml/merlin#1359)
    - emacs: fix issue with `merlin--highlight` and  various minor improvements
        (ocaml/merlin#1367, @mattiase)
  + test suite
    - cover the new `construct` command (ocaml/merlin#1318)
    - disable tests failing in Opam's CI due to nested dune projects (ocaml/merlin#1373)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Aug 19, 2021
CHANGES:

## Features

- Add a new code action `Add missing rec keyword`, which is available when
  adding a `rec` keyword can fix `Unbound value ...` error, e.g.,

  ```ocaml
  let fact n = if n = 0 then 1 else n * fact (n - 1)
                                     (* ^^^^ Unbound value fact *)
  ```

  Adding `rec` to the definition of `fact` will fix the problem. The new code
  action offers adding `rec`.

- Jump to the first hole on calling `Destruct` code action (only with client
  VSCode OCaml Platform) (ocaml/ocaml-lsp#468)

  Example: when a user invokes `Destruct` code action on `Some 1`, this code is
  replaced by `match Some 1 with None -> _ | Some _ -> _`, where the 1st and
  3rd underscores are "typed holes", a concept created by Merlin to be able to
  put "holes" in OCaml code.

  With this change, now for VSCode OCaml Platform users, on such invocation of
  `Destruct`, the cursor will jump to the first typed hole and select it, so
  that user can start editing right away.

- Use ocamlformat to properly format type snippets. This feature requires the
  `ocamlformat-rpc` opam package to be installed. (ocaml/ocaml-lsp#386)

- Add completion support for polymorphic variants, when it is possible to pin
  down the precise type. Examples (`<|>` stands for the cursor) when completion
  will work (ocaml/ocaml-lsp#473)

  Function application:

  ```
  let foo (a: [`Alpha | `Beta]) = ()

  foo `A<|>
  ```

  Type explicitly shown:

  ```
  let a : [`Alpha | `Beta] = `B<|>
  ```

  Note: this is actually a bug fix, since we were ignoring the backtick when
  constructing the prefix for completion.

- Parse merlin errors (best effort) into a more structured form. This allows
  reporting all locations as "related information" (ocaml/ocaml-lsp#475)

- Add support for Merlin `Construct` command as completion suggestions, i.e.,
  show complex expressions that could complete the typed hole. (ocaml/ocaml-lsp#472)

- Add a code action `Construct an expression` that is shown when the cursor is
  at the end of the typed hole, i.e., `_|`, where `|` is the cursor. The code
  action simply triggers the client (currently only VS Code is supported) to
  show completion suggestions. (ocaml/ocaml-lsp#472)

- Change the formatting-on-save error notification to a warning notification
  (ocaml/ocaml-lsp#472)

- Code action to qualify ("put module name in identifiers") and unqualify
  ("remove module name from identifiers") module names in identifiers (ocaml/ocaml-lsp#399)

  Starting from:

  ```ocaml
  open Unix

  let times = Unix.times ()
  let f x = x.Unix.tms_stime, x.Unix.tms_utime
  ```

  Calling "remove module name from identifiers" with the cursor on the open
  statement will produce:

  ```ocaml
  open Unix

  let times = times ()
  let f x = x.tms_stime, x.tms_utime
  ```

  Calling "put module name in identifiers" will restore:

  ```ocaml
  open Unix

  let times = Unix.times ()
  let f x = x.Unix.tms_stime, x.Unix.tms_utime
  ```

## Fixes

- Do not show "random" documentation on hover

  - fixed by [merlin#1364](ocaml/merlin#1364)
  - fixes duplicate:
    - [ocaml-lsp#344](ocaml/ocaml-lsp#344)
    - [vscode-ocaml-platform#111](ocamllabs/vscode-ocaml-platform#111)

- Correctly rename a variable used as a named/optional argument (ocaml/ocaml-lsp#478)

- When reporting an error at the beginning of the file, use the first line not
  the second (ocaml/ocaml-lsp#489)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Aug 25, 2021
CHANGES:

## Features

- Add a new code action `Add missing rec keyword`, which is available when
  adding a `rec` keyword can fix `Unbound value ...` error, e.g.,

  ```ocaml
  let fact n = if n = 0 then 1 else n * fact (n - 1)
                                     (* ^^^^ Unbound value fact *)
  ```

  Adding `rec` to the definition of `fact` will fix the problem. The new code
  action offers adding `rec`.

- Use ocamlformat to properly format type snippets. This feature requires the
  `ocamlformat-rpc` opam package to be installed. (ocaml/ocaml-lsp#386)

- Add completion support for polymorphic variants, when it is possible to pin
  down the precise type. Examples (`<|>` stands for the cursor) when completion
  will work (ocaml/ocaml-lsp#473)

  Function application:

  ```
  let foo (a: [`Alpha | `Beta]) = ()

  foo `A<|>
  ```

  Type explicitly shown:

  ```
  let a : [`Alpha | `Beta] = `B<|>
  ```

  Note: this is actually a bug fix, since we were ignoring the backtick when
  constructing the prefix for completion.

- Parse merlin errors (best effort) into a more structured form. This allows
  reporting all locations as "related information" (ocaml/ocaml-lsp#475)

- Add support for Merlin `Construct` command as completion suggestions, i.e.,
  show complex expressions that could complete the typed hole. (ocaml/ocaml-lsp#472)

- Add a code action `Construct an expression` that is shown when the cursor is
  at the end of the typed hole, i.e., `_|`, where `|` is the cursor. The code
  action simply triggers the client (currently only VS Code is supported) to
  show completion suggestions. (ocaml/ocaml-lsp#472)

- Change the formatting-on-save error notification to a warning notification
  (ocaml/ocaml-lsp#472)

- Code action to qualify ("put module name in identifiers") and unqualify
  ("remove module name from identifiers") module names in identifiers (ocaml/ocaml-lsp#399)

  Starting from:

  ```ocaml
  open Unix

  let times = Unix.times ()
  let f x = x.Unix.tms_stime, x.Unix.tms_utime
  ```

  Calling "remove module name from identifiers" with the cursor on the open
  statement will produce:

  ```ocaml
  open Unix

  let times = times ()
  let f x = x.tms_stime, x.tms_utime
  ```

  Calling "put module name in identifiers" will restore:

  ```ocaml
  open Unix

  let times = Unix.times ()
  let f x = x.Unix.tms_stime, x.Unix.tms_utime
  ```

## Fixes

- Do not show "random" documentation on hover

  - fixed by [merlin#1364](ocaml/merlin#1364)
  - fixes duplicate:
    - [ocaml-lsp#344](ocaml/ocaml-lsp#344)
    - [vscode-ocaml-platform#111](ocamllabs/vscode-ocaml-platform#111)

- Correctly rename a variable used as a named/optional argument (ocaml/ocaml-lsp#478)

- When reporting an error at the beginning of the file, use the first line not
  the second (ocaml/ocaml-lsp#489)
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.

2 participants