Skip to content

Editor mode config option #7541

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

Merged
merged 2 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

- Refactor the ast for record expressions and patterns. https://github.com/rescript-lang/rescript/pull/7528
- Editor: add completions from included modules. https://github.com/rescript-lang/rescript/pull/7515
- Add `-editor-mode` arg to `bsc` for doing special optimizations only relevant to the editor tooling. https://github.com/rescript-lang/rescript/pull/7541

# 12.0.0-alpha.13

Expand Down
6 changes: 6 additions & 0 deletions compiler/bsc/rescript_compiler_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
print the transformed ReScript code to stdout" );
("-format", string_call format_file, "*internal* Format as Res syntax");
("-only-parse", set Clflags.only_parse, "*internal* stop after parsing");
( "-editor-mode",
unit_call (fun () ->
Clflags.editor_mode := true;
Clflags.ignore_parse_errors := true;
Js_config.cmi_only := true),
"*internal* Enable editor mode." );
( "-ignore-parse-errors",
set Clflags.ignore_parse_errors,
"*internal* continue after parse errors" );
Expand Down
2 changes: 2 additions & 0 deletions compiler/ml/clflags.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ and dump_lambda = ref false (* -dlambda *)

and only_parse = ref false (* -only-parse *)

and editor_mode = ref false (* -editor-mode *)

and ignore_parse_errors = ref false (* -ignore-parse-errors *)

let dont_write_files = ref false (* set to true under ocamldoc *)
Expand Down
1 change: 1 addition & 0 deletions compiler/ml/clflags.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ val dont_write_files : bool ref
val keep_locs : bool ref
val only_parse : bool ref
val ignore_parse_errors : bool ref
val editor_mode : bool ref

val parse_color_setting : string -> Misc.Color.setting option
val color : Misc.Color.setting option ref
Expand Down
Loading