Allow monadic IO in dot protocol#1581
Conversation
|
I think we should use the new interface in Merlin itself and remove the old io functions. |
e993323 to
a329786
Compare
voodoos
left a comment
There was a problem hiding this comment.
Mostly cosmetic changes...
|
Also we will need a changelog entry :-) |
47b51bd to
84972fc
Compare
|
Ok, let's stop worrying about the indentation and make this PR the first one to be ocamlformatted. Can you rebase and clean the history ? Then I will take care of the formatting. Edit: and factor the functor/module sig |
84972fc to
76ed590
Compare
|
Thanks for the changes @3Rafal ! @rgrinberg , do you confirm that the final interface suits your needs ? |
|
|
||
| val read : in_chan -> (Csexp.t, string) result IO.t | ||
|
|
||
| val write : out_chan -> Csexp.t -> unit IO.t |
There was a problem hiding this comment.
In the ocamllsp fork, this is a list of csexps, why was this changed to a single csexp?
There was a problem hiding this comment.
I'm not sure. I think the fork uses a single csexp as well.
There was a problem hiding this comment.
@ddickstein you might be using an old version somewhere.
There was a problem hiding this comment.
I think you might be misreading. The functor takes a module whose write is implemented in terms of a single csexp. The module that is provided, Lev_fiber_csexp.Session, implements write in terms of a list, so there's a redefinition of write that implements it for the functor by packaging the csexp into a singleton list and calling Lev_fiber_csexp.Session.write. The incompatibility I was pointing out as an issue was on the read side, where the latest version of Merlin now expects the implementation that returns a result, but Lev_fiber_csexp.Session.read returns an option, and there's no re-implementation to satisfy the functor because ocaml-lsp hasn't yet updated to the latest version of Merlin. But I am now on latest Merlin and on latest ocaml-lsp, so I'm seeing an incompatibility.
There was a problem hiding this comment.
Yes, not sure why the result turned into an option, we can easily change that.
However even with that change it is important to note that the current Merlin master should not be expected to be compatible with ocaml-lsp. We still have an upstreaming PR to merge (#1585) and then we will have to make changes to ocaml-lsp to actually use the new api. At that point both projects will we be compatible for the first time.
There was a problem hiding this comment.
Implementation used internally by merlin ("Blocking"), uses Csexp library. read is implemented as:
let read = Csexp.inputwhich has type of
val input : in_channel -> (Sexp.t, string) result
I decided to use result, and then adjust implementation in ocaml-lsp
There was a problem hiding this comment.
Whoops, sorry for not reading this closer.
I decided to use result, and then adjust implementation in ocaml-lsp
What would be the purpose of the string in Error case?
There was a problem hiding this comment.
Currently, the Error string is not used. I reused the old implementation, which worked that way. Do you think it would be a better idea to change the interface to use option?
There was a problem hiding this comment.
Nah, the result type is fine. I'm just curious what you plan to use it for. If it's an error message, It's not really possible to display it in a friendly way to an lsp user through the merlin API.
from 3Rafal/monadic-io-in-dot-protocol
CHANGES:
Fri May 26 15:23:42 CEST 2023
+ merlin binary
- Allow monadic IO in dot protocol (ocaml/merlin#1581)
- Add a `scope` option to the `occurrences` command in preparation for
the upcoming `project-wide-occurrences` feature (ocaml/merlin#1596)
- Construct bool-typed holes as `false` instead of `true` in the
`construct` command, for consistency (ocaml/merlin#1599).
- Add a hook to configure system command for spawning ppxes when Merlin is
used as a library. (ocaml/merlin#1585)
- Implement an all-or-nothing cache for the PPX phase (ocaml/merlin#1584)
- Cleanup functors caches when backtracking, to avoid memory leaks
(ocaml/merlin#1609, fixes ocaml/merlin#1529 and ocaml-lsp#1032)
- Fix `construct` results ordering for sum types sand poly variants (ocaml/merlin#1603)
- Fix object method completion not working (ocaml/merlin#1606, fixes ocaml/merlin#1575)
- Improve context detection for package types (ocaml/merlin#1608, fixes ocaml/merlin#1607)
- Fix incorrect locations for string literals (ocaml/merlin#1574)
- Fixed an issue that caused `errors` to erroneously alert about missing
`cmi` files (ocaml/merlin#1577)
- Prevent destruct from crashing on closed variant types (ocaml/merlin#1602,
fixes ocaml/merlin#1601)
- Improve longident parsing (ocaml/merlin#1612, fixes ocaml/merlin#945)
+ editor modes
- emacs: call the user's configured completion UI in
`merlin-construct` (ocaml/merlin#1598)
+ test suite
- Add missing dependency to a test using ppxlib (ocaml/merlin#1583)
- Add tests for the new PPX phase cache (ocaml/merlin#1584)
- Add and update tests for `construct` ordering (ocaml/merlin#1603)
CHANGES:
Fri May 26 15:23:42 CEST 2023
+ merlin binary
- Allow monadic IO in dot protocol (ocaml/merlin#1581)
- Add a `scope` option to the `occurrences` command in preparation for
the upcoming `project-wide-occurrences` feature (ocaml/merlin#1596)
- Construct bool-typed holes as `false` instead of `true` in the
`construct` command, for consistency (ocaml/merlin#1599).
- Add a hook to configure system command for spawning ppxes when Merlin is
used as a library. (ocaml/merlin#1585)
- Implement an all-or-nothing cache for the PPX phase (ocaml/merlin#1584)
- Cleanup functors caches when backtracking, to avoid memory leaks
(ocaml/merlin#1609, fixes ocaml/merlin#1529 and ocaml-lsp#1032)
- Fix `construct` results ordering for sum types sand poly variants (ocaml/merlin#1603)
- Fix object method completion not working (ocaml/merlin#1606, fixes ocaml/merlin#1575)
- Improve context detection for package types (ocaml/merlin#1608, fixes ocaml/merlin#1607)
- Fix incorrect locations for string literals (ocaml/merlin#1574)
- Fixed an issue that caused `errors` to erroneously alert about missing
`cmi` files (ocaml/merlin#1577)
- Prevent destruct from crashing on closed variant types (ocaml/merlin#1602,
fixes ocaml/merlin#1601)
- Improve longident parsing (ocaml/merlin#1612, fixes ocaml/merlin#945)
+ editor modes
- emacs: call the user's configured completion UI in
`merlin-construct` (ocaml/merlin#1598)
+ test suite
- Add missing dependency to a test using ppxlib (ocaml/merlin#1583)
- Add tests for the new PPX phase cache (ocaml/merlin#1584)
- Add and update tests for `construct` ordering (ocaml/merlin#1603)
CHANGES:
Fri May 26 15:23:42 CEST 2023
+ merlin binary
- Allow monadic IO in dot protocol (ocaml/merlin#1581)
- Add a `scope` option to the `occurrences` command in preparation for
the upcoming `project-wide-occurrences` feature (ocaml/merlin#1596)
- Construct bool-typed holes as `false` instead of `true` in the
`construct` command, for consistency (ocaml/merlin#1599).
- Add a hook to configure system command for spawning ppxes when Merlin is
used as a library. (ocaml/merlin#1585)
- Implement an all-or-nothing cache for the PPX phase (ocaml/merlin#1584)
- Cleanup functors caches when backtracking, to avoid memory leaks
(ocaml/merlin#1609, fixes ocaml/merlin#1529 and ocaml-lsp#1032)
- Fix `construct` results ordering for sum types sand poly variants (ocaml/merlin#1603)
- Fix object method completion not working (ocaml/merlin#1606, fixes ocaml/merlin#1575)
- Improve context detection for package types (ocaml/merlin#1608, fixes ocaml/merlin#1607)
- Fix incorrect locations for string literals (ocaml/merlin#1574)
- Fixed an issue that caused `errors` to erroneously alert about missing
`cmi` files (ocaml/merlin#1577)
- Prevent destruct from crashing on closed variant types (ocaml/merlin#1602,
fixes ocaml/merlin#1601)
- Improve longident parsing (ocaml/merlin#1612, fixes ocaml/merlin#945)
+ editor modes
- emacs: call the user's configured completion UI in
`merlin-construct` (ocaml/merlin#1598)
+ test suite
- Add missing dependency to a test using ppxlib (ocaml/merlin#1583)
- Add tests for the new PPX phase cache (ocaml/merlin#1584)
- Add and update tests for `construct` ordering (ocaml/merlin#1603)
[new release] merlin, merlin-lib and dot-merlin-reader (4.9-414)
CHANGES:
Fri May 26 15:23:42 CEST 2023
+ merlin binary
- Allow monadic IO in dot protocol (ocaml/merlin#1581)
- Add a `scope` option to the `occurrences` command in preparation for
the upcoming `project-wide-occurrences` feature (ocaml/merlin#1596)
- Construct bool-typed holes as `false` instead of `true` in the
`construct` command, for consistency (ocaml/merlin#1599).
- Add a hook to configure system command for spawning ppxes when Merlin is
used as a library. (ocaml/merlin#1585)
- Implement an all-or-nothing cache for the PPX phase (ocaml/merlin#1584)
- Cleanup functors caches when backtracking, to avoid memory leaks
(ocaml/merlin#1609, fixes ocaml/merlin#1529 and ocaml-lsp#1032)
- Fix `construct` results ordering for sum types sand poly variants (ocaml/merlin#1603)
- Fix object method completion not working (ocaml/merlin#1606, fixes ocaml/merlin#1575)
- Improve context detection for package types (ocaml/merlin#1608, fixes ocaml/merlin#1607)
- Fix incorrect locations for string literals (ocaml/merlin#1574)
- Fixed an issue that caused `errors` to erroneously alert about missing
`cmi` files (ocaml/merlin#1577)
- Prevent destruct from crashing on closed variant types (ocaml/merlin#1602,
fixes ocaml/merlin#1601)
- Improve longident parsing (ocaml/merlin#1612, fixes ocaml/merlin#945)
+ editor modes
- emacs: call the user's configured completion UI in
`merlin-construct` (ocaml/merlin#1598)
+ test suite
- Add missing dependency to a test using ppxlib (ocaml/merlin#1583)
- Add tests for the new PPX phase cache (ocaml/merlin#1584)
- Add and update tests for `construct` ordering (ocaml/merlin#1603)
CHANGES:
unreleased
+ merlin binary
- Preview support for OCaml 5.1-alpha1. Short path is temporary disabled and
inline records might not behave as expected.
- Allow monadic IO in dot protocol (ocaml/merlin#1581)
- Add a `scope` option to the `occurrences` command in preparation for
the upcoming `project-wide-occurrences` feature (ocaml/merlin#1596)
- Construct bool-typed holes as `false` instead of `true` in the
`construct` command, for consistency (ocaml/merlin#1599).
- Add a hook to configure system command for spawning ppxes when Merlin is
used as a library. (ocaml/merlin#1585)
- Implement an all-or-nothing cache for the PPX phase (ocaml/merlin#1584)
- Cleanup functors caches when backtracking, to avoid memory leaks
(ocaml/merlin#1609, fixes ocaml/merlin#1529 and ocaml-lsp#1032)
- Fix `construct` results ordering for sum types sand poly variants (ocaml/merlin#1603)
- Fix object method completion not working (ocaml/merlin#1606, fixes ocaml/merlin#1575)
- Improve context detection for package types (ocaml/merlin#1608, fixes ocaml/merlin#1607)
- Fix incorrect locations for string literals (ocaml/merlin#1574)
- Fixed an issue that caused `errors` to erroneously alert about missing
`cmi` files (ocaml/merlin#1577)
- Prevent destruct from crashing on closed variant types (ocaml/merlin#1602,
fixes ocaml/merlin#1601)
- Improve longident parsing (ocaml/merlin#1612, fixes ocaml/merlin#945)
+ editor modes
- emacs: call the user's configured completion UI in
`merlin-construct` (ocaml/merlin#1598)
+ test suite
- Add missing dependency to a test using ppxlib (ocaml/merlin#1583)
- Add tests for the new PPX phase cache (ocaml/merlin#1584)
- Add and update tests for `construct` ordering (ocaml/merlin#1603)
As discussed in: ocaml/ocaml-lsp#1052