-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merlin: add new contexts commands (#10324)
* merlin: add rules regardless of (merlin) Signed-off-by: Javier Chávarri <[email protected]> * merlin: update tests Signed-off-by: Javier Chávarri <[email protected]> * merlin: add GetContexts command Signed-off-by: Javier Chávarri <[email protected]> * merlin: add SetContexts (wip) Signed-off-by: Javier Chávarri <[email protected]> * better tests Signed-off-by: Javier Chávarri <[email protected]> * merlin: simpler get-set-contexts test Signed-off-by: Javier Chávarri <[email protected]> * Revert "merlin: add rules regardless of (merlin)" This reverts commit 3d3c97f. Signed-off-by: Javier Chávarri <[email protected]> * merlin: introduce generate_merlin_rules Signed-off-by: Javier Chávarri <[email protected]> * add docs and changelog Signed-off-by: Javier Chávarri <[email protected]> * merlin: roll back changes in default-based-context test Signed-off-by: Javier Chávarri <[email protected]> * merlin: update get-set-contexts test Signed-off-by: Javier Chávarri <[email protected]> * update changes Signed-off-by: Javier Chávarri <[email protected]> * rename Standard to Default Signed-off-by: Javier Chávarri <[email protected]> * merlin: rename Nothing to Not_selected Signed-off-by: Javier Chávarri <[email protected]> * merlin: fix tests Signed-off-by: Javier Chávarri <[email protected]> * describe: add contexts subcommand Signed-off-by: Javier Chávarri <[email protected]> * merlin: replace get/set context with flag Signed-off-by: Javier Chávarri <[email protected]> * merlin: cleanup Signed-off-by: Javier Chávarri <[email protected]> * cleanup Signed-off-by: Javier Chávarri <[email protected]> * merlin: remove context check Signed-off-by: Javier Chávarri <[email protected]> * apply suggestions from code review Co-authored-by: Antonio Nuno Monteiro <[email protected]> Signed-off-by: Javier Chávarri <[email protected]> * gate generate_merlin_rules to 3.16 Signed-off-by: Javier Chávarri <[email protected]> * merlin: add --context to dump_dot_merlin Signed-off-by: Javier Chávarri <[email protected]> * apply suggestions from code review Co-authored-by: Antonio Nuno Monteiro <[email protected]> Signed-off-by: Javier Chávarri <[email protected]> * merlin: add Select_context.conv Signed-off-by: Javier Chávarri <[email protected]> * fix: promote tests after rebase Signed-off-by: Antonio Nuno Monteiro <[email protected]> * refactor: remove `Selected_context.t`, reuse the context arg, use it in dump Signed-off-by: Antonio Nuno Monteiro <[email protected]> --------- Signed-off-by: Javier Chávarri <[email protected]> Signed-off-by: Antonio Nuno Monteiro <[email protected]> Co-authored-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
02170fe
commit 0471f45
Showing
12 changed files
with
305 additions
and
35 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
open Import | ||
|
||
let term = | ||
let+ builder = Common.Builder.term in | ||
let common, config = Common.init builder in | ||
Scheduler.go ~common ~config | ||
@@ fun () -> | ||
let open Fiber.O in | ||
let* setup = Import.Main.setup () in | ||
let+ setup = Memo.run setup in | ||
let ctxts = | ||
List.map | ||
~f:(fun (name, _) -> Context_name.to_string name) | ||
(Context_name.Map.to_list setup.scontexts) | ||
in | ||
List.iter ctxts ~f:print_endline | ||
;; | ||
|
||
let command = | ||
let doc = "List the build contexts available in the workspace." in | ||
let info = Cmd.info ~doc "contexts" in | ||
Cmd.v info term | ||
;; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
open Import | ||
|
||
(** Dune command to print out the available build contexts.*) | ||
val command : unit Cmd.t |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- Add new flag `--context` to `dune ocaml-merlin`, which allows to select a Dune | ||
context when requesting Merlin config. Add `dune describe contexts` | ||
subcommand. Introduce a field `generate_merlin_rules` for contexts declared in | ||
the workspace, that allows to optionally produce Merlin rules for other | ||
contexts besides the one selected for Merlin (#10324, @jchavarri) |
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
19 changes: 19 additions & 0 deletions
19
test/blackbox-tests/test-cases/describe/describe-contexts.t
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Showcase behavior of the `dune describe contexts` subcommand | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.14) | ||
> EOF | ||
|
||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.14) | ||
> | ||
> (context default) | ||
> | ||
> (context | ||
> (default | ||
> (name alt))) | ||
> EOF | ||
|
||
$ dune describe contexts | ||
alt | ||
default |
Oops, something went wrong.