Skip to content

Commit

Permalink
Make struct field names in Ide_message unique
Browse files Browse the repository at this point in the history
Summary:
Ocaml is not very good about resolving non-unique field names, and having them
results in having to fully qualify things all the time. SAD!

Differential Revision: D4408143

fbshipit-source-id: 748989531c9cbcd000e30634e6eb2b9e30206563
  • Loading branch information
dabek authored and hhvm-bot committed Jan 19, 2017
1 parent ffd2ed8 commit 7b9b7a1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions hphp/hack/src/ide_rpc/ide_message.ml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ and infer_type_response = string option

and callable_details = {
return_type : string;
params : callable_param list;
callable_params : callable_param list;
}

and callable_param = {
name : string;
type_ : string;
callable_param_name : string;
callable_param_type : string;
}

and diagnostics_notification = {
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/src/ide_rpc/ide_rpc_V0_message_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ let init_response_to_json { server_api_version } = JSON_Object [

let autocomplete_response_to_json x =
let param_to_json x = JSON_Object [
("name", JSON_String x.name);
("type", JSON_String x.type_);
("name", JSON_String x.callable_param_name);
("type", JSON_String x.callable_param_type);
] in

let callable_details_to_json x = JSON_Object [
("return_type", JSON_String x.return_type);
("params", JSON_Array (List.map x.params ~f:param_to_json));
("params", JSON_Array (List.map x.callable_params ~f:param_to_json));
] in

let callable_details_to_json = function
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/src/ide_rpc/nuclide_rpc_message_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ let should_not_happen = JSON_Object [

let autocomplete_response_to_json x =
let param_to_json x = JSON_Object [
("name", JSON_String x.name);
("type", JSON_String x.type_);
("name", JSON_String x.callable_param_name);
("type", JSON_String x.callable_param_type);
("variadic", deprecated_bool_field);
] in

let callable_details_to_json x = JSON_Object [
("return_type", JSON_String x.return_type);
("params", JSON_Array (List.map x.params ~f:param_to_json));
("params", JSON_Array (List.map x.callable_params ~f:param_to_json));
("min_arity", deprecated_int_field);
] in

Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/src/server/autocompleteService.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ let autocomplete_result_to_json res =

let autocomplete_result_to_ide_response res =
let param_to_ide_response x = {
Ide_message.name = x.param_name;
type_ = x.param_ty;
Ide_message.callable_param_name = x.param_name;
callable_param_type = x.param_ty;
} in

let callable_details_to_ide_response res = {
Ide_message.return_type = res.return_ty;
params = List.map res.params param_to_ide_response;
callable_params = List.map res.params param_to_ide_response;
} in

let callable_details_to_ide_response =
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/test/unit/ide/ide_rpc_V0_message_printer_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ let test_autocomplete_response () =
autocomplete_item_type = "bbb";
callable_details = Some {
return_type = "ccc";
Ide_message.params = [{
name = "ddd";
type_ = "eee";
Ide_message.callable_params = [{
callable_param_name = "ddd";
callable_param_type = "eee";
}]
}
}] in
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/test/unit/ide/nuclide_rpc_message_printer_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ let test_autocomplete_response () =
autocomplete_item_type = "bbb";
callable_details = Some {
return_type = "ccc";
Ide_message.params = [{
name = "ddd";
type_ = "eee";
Ide_message.callable_params = [{
callable_param_name = "ddd";
callable_param_type = "eee";
}]
}
}] in
Expand Down

0 comments on commit 7b9b7a1

Please sign in to comment.