-
Notifications
You must be signed in to change notification settings - Fork 121
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
Support --context
flag of dune ocaml-merlin
#1238
Conversation
3eea746
to
530c182
Compare
cdefa22
to
1a778fb
Compare
getDuneContexts
method and spawn a new ocaml-merlin
process per Dune context
444095b
to
6ed35fe
Compare
6ed35fe
to
ba7b147
Compare
getDuneContexts
method and spawn a new ocaml-merlin
process per Dune contextgetDuneContexts
method and --context
flag
()) | ||
| Some dune -> ( | ||
let describe = | ||
"DUNE_CONFIG__GLOBAL_LOCK=disabled " ^ Fpath.to_string dune |
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.
DUNE_CONFIG__GLOBAL_LOCK=disabled
^ :(
but the question is — is dune describe contexts
command's output stable?
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 see the need for DUNE_CONFIG__GLOBAL_LOCK
as a bug / limitation of Dune, rather than a hack in this PR. The main issue is that Dune doesn't differentiate between commands that write in _build
vs commands that only read. So it will always lock the folder regardless. I opened an issue to discuss making the lock mechanism smarter: ocaml/dune#10430
but the question is — is
dune describe contexts
command's output stable?
This subcommand is being added in the companion PR ocaml/dune#10324. It only outputs the names of the available contexts, so it shouldn't need to change over time.
Co-authored-by: Andrey Popp <[email protected]>
I talked to @andreypopp and he suggested to remove the |
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.
Looks good!
Co-authored-by: Andrey Popp <[email protected]>
getDuneContexts
method and --context
flag--context
flag of dune ocaml-merlin
Thanks for the reviews @andreypopp. From my side, there's nothing else to add to this PR. Also, the parent PR in dune ocaml/dune#10324 has been merged, and it should be included in next release 3.16. |
@jchavarri is it the responsibility of the editor plugin to not use that flag if the installed dune version does not understand it ( |
@@ -8,6 +8,8 @@ | |||
|
|||
- Support folding of `ifthenelse` expressions (#1031) | |||
|
|||
- Add `--context` flag (#1238) |
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 we could add a bit more context here, at least define what "context" refers to here.
@jchavarri is this PR ready ? What will happen if the installed dune does not understand that flag ? |
I don't think this is needed anymore. Turns out that contexts alone aren't good enough for melange support. |
@rgrinberg Should ocaml/dune#10324 be reverted? That PR was added exclusively to support this use case. If context selection is not useful for any other use cases besides melange, then it probably doesn't make much sense to keep the code added in that PR. |
Yes, there's probably no point to it. Though I think we should focus on implementing the new feature and what would that look like. We can clean things up in the end. |
This PR integrates two new Dune commands into the LSP server. See related issue vscode-ocaml-platform#1432.
Dependencies and related PRs
This PR relies on features being added in dune#10324.
It also unblocks the feature implemented in vscode-ocaml-platform#1449. A screen capture demo is shown in that issue.
Description
ocamllsp/getDuneContexts
that will return the list of available Dune contexts in the workspace (through the newly addeddune describe contexts
subcommand)--context
in the server. This flag, when present, will be passed through to thedune ocaml-merlin
instance being created.