Skip to content

Commit 05be83f

Browse files
authored
Editor mode config option (#7541)
* base editor mode config option * changelog
1 parent f4f7296 commit 05be83f

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

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

6061
# 12.0.0-alpha.13
6162

compiler/bsc/rescript_compiler_main.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
392392
print the transformed ReScript code to stdout" );
393393
("-format", string_call format_file, "*internal* Format as Res syntax");
394394
("-only-parse", set Clflags.only_parse, "*internal* stop after parsing");
395+
( "-editor-mode",
396+
unit_call (fun () ->
397+
Clflags.editor_mode := true;
398+
Clflags.ignore_parse_errors := true;
399+
Js_config.cmi_only := true),
400+
"*internal* Enable editor mode." );
395401
( "-ignore-parse-errors",
396402
set Clflags.ignore_parse_errors,
397403
"*internal* continue after parse errors" );

compiler/ml/clflags.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ and dump_lambda = ref false (* -dlambda *)
4040

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

43+
and editor_mode = ref false (* -editor-mode *)
44+
4345
and ignore_parse_errors = ref false (* -ignore-parse-errors *)
4446

4547
let dont_write_files = ref false (* set to true under ocamldoc *)

compiler/ml/clflags.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ val dont_write_files : bool ref
2525
val keep_locs : bool ref
2626
val only_parse : bool ref
2727
val ignore_parse_errors : bool ref
28+
val editor_mode : bool ref
2829

2930
val parse_color_setting : string -> Misc.Color.setting option
3031
val color : Misc.Color.setting option ref

0 commit comments

Comments
 (0)