-
Notifications
You must be signed in to change notification settings - Fork 233
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
Allow monadic IO in dot protocol #1581
Merged
Merged
Changes from all commits
Commits
Show all changes
4 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 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 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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I think the fork uses a single csexp as well.
merlin/src/dot-protocol/merlin_dot_protocol.mli
Line 105 in 209e5f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddickstein you might be using an old version somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
, implementswrite
in terms of a list, so there's a redefinition ofwrite
that implements it for the functor by packaging the csexp into a singleton list and callingLev_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, butLev_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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation used internally by merlin ("Blocking"), uses Csexp library.
read
is implemented as:which has type of
I decided to use result, and then adjust implementation in ocaml-lsp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, sorry for not reading this closer.
What would be the purpose of the string in Error case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.