Skip to content

Commit

Permalink
[flow] Flag for detailed diagnostics for vscode
Browse files Browse the repository at this point in the history
Summary:
This is the feature flag intended for a feature similar to rust-analyzer's "Click to see full compiler diagnostics" feature.

I specially put VSCode in the feature flag name. In principle, extensions for other editors could speak the same custom protocol, we simply do not have enough bandwidth to support them, especially if we want to change the rendering protocol.

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D57169090

fbshipit-source-id: 300ff15e97499e0843c76f03fe35bf13d88d61bc
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed May 10, 2024
1 parent e2b8ed6 commit fbf242f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/commands/commandUtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,7 @@ let make_options
~f:(Files.expand_project_root_token ~root)
(FlowConfig.strict_es6_import_export_excludes flowconfig);
opt_ts_syntax = FlowConfig.ts_syntax flowconfig;
opt_vscode_detailed_diagnostics = FlowConfig.vscode_detailed_diagnostics flowconfig;
opt_automatic_require_default =
Base.Option.value (FlowConfig.automatic_require_default flowconfig) ~default:false;
opt_format;
Expand Down
7 changes: 7 additions & 0 deletions src/commands/config/flowConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ module Opts = struct
ts_syntax: bool;
one_sided_type_guards: bool;
use_mixed_in_catch_variables: bool option;
vscode_detailed_diagnostics: bool;
wait_for_recheck: bool;
watchman_defer_states: string list;
watchman_sync_timeout: int option;
Expand Down Expand Up @@ -260,6 +261,7 @@ module Opts = struct
ts_syntax = false;
one_sided_type_guards = false;
use_mixed_in_catch_variables = None;
vscode_detailed_diagnostics = false;
wait_for_recheck = false;
watchman_defer_states = [];
watchman_sync_timeout = None;
Expand Down Expand Up @@ -915,6 +917,9 @@ module Opts = struct
);
("experimental.namespaces", boolean (fun opts v -> Ok { opts with namespaces = v }));
("experimental.ts_syntax", boolean (fun opts v -> Ok { opts with ts_syntax = v }));
( "experimental.vscode_detailed_diagnostics",
boolean (fun opts v -> Ok { opts with vscode_detailed_diagnostics = v })
);
("facebook.fbs", string (fun opts v -> Ok { opts with facebook_fbs = Some v }));
("facebook.fbt", string (fun opts v -> Ok { opts with facebook_fbt = Some v }));
("file_watcher", file_watcher_parser);
Expand Down Expand Up @@ -1707,6 +1712,8 @@ let one_sided_type_guards c = c.options.Opts.one_sided_type_guards

let use_mixed_in_catch_variables c = c.options.Opts.use_mixed_in_catch_variables

let vscode_detailed_diagnostics c = c.options.Opts.vscode_detailed_diagnostics

let wait_for_recheck c = c.options.Opts.wait_for_recheck

let watchman_defer_states c = c.options.Opts.watchman_defer_states
Expand Down
2 changes: 2 additions & 0 deletions src/commands/config/flowConfig.mli
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ val one_sided_type_guards : config -> bool

val use_mixed_in_catch_variables : config -> bool option

val vscode_detailed_diagnostics : config -> bool

val wait_for_recheck : config -> bool

val watchman_defer_states : config -> string list
Expand Down
3 changes: 3 additions & 0 deletions src/common/options.ml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ type t = {
opt_one_sided_type_guards: bool;
opt_use_mixed_in_catch_variables: bool;
opt_verbose: Verbose.t option;
opt_vscode_detailed_diagnostics: bool;
opt_wait_for_recheck: bool;
opt_distributed: bool;
}
Expand Down Expand Up @@ -356,6 +357,8 @@ let use_mixed_in_catch_variables opts = opts.opt_use_mixed_in_catch_variables

let verbose opts = opts.opt_verbose

let vscode_detailed_diagnostics opts = opts.opt_vscode_detailed_diagnostics

let wait_for_recheck opts = opts.opt_wait_for_recheck

let distributed opts = opts.opt_distributed

0 comments on commit fbf242f

Please sign in to comment.