├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── feature_request.md └── workflows │ └── formatter.yml ├── .gitignore ├── .haxerc ├── .npmignore ├── .vscode ├── settings.json └── tasks.json ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── build └── Build.hx ├── buildAll.hxml ├── buildCommon.hxml ├── buildCpp.hxml ├── buildJava.hxml ├── buildJsBrowser.hxml ├── buildJsNode.hxml ├── buildNeko.hxml ├── buildSchema.hxml ├── checkstyle.json ├── display.hxml ├── haxe_libraries ├── exception.hxml ├── haxeparser.hxml ├── hxargs.hxml ├── hxcpp.hxml ├── hxjava.hxml ├── hxjsonast.hxml ├── hxnodejs.hxml ├── hxparse.hxml ├── instrument.hxml ├── json2object.hxml ├── safety.hxml ├── test-adapter.hxml ├── tokentree.hxml └── utest.hxml ├── haxelib.json ├── hxformat.json ├── makeReleaseZip.sh ├── package-lock.json ├── package.json ├── resources ├── default-hxformat.json ├── formatOnSave.gif ├── hxformat-schema.json └── schema.png ├── schema └── SchemaGenerator.hx ├── src ├── FormatterVersion.hx └── formatter │ ├── Cli.hx │ ├── FormatStats.hx │ ├── Formatter.hx │ ├── codedata │ ├── CodeLine.hx │ ├── CodeLines.hx │ ├── FormatterInputData.hx │ ├── ParseFile.hx │ ├── ParsedCode.hx │ ├── TokenData.hx │ ├── TokenInfo.hx │ ├── TokenList.hx │ ├── VerbatimCodeLine.hx │ └── WhitespaceAfterType.hx │ ├── config │ ├── Config.hx │ ├── EmptyLinesConfig.hx │ ├── FormatterConfig.hx │ ├── IndentationConfig.hx │ ├── LineEndConfig.hx │ ├── SameLineConfig.hx │ ├── WhitespaceConfig.hx │ ├── WhitespacePolicy.hx │ └── WrapConfig.hx │ ├── debug │ └── PosInfosMacro.hx │ ├── import.hx │ └── marker │ ├── Indenter.hx │ ├── MarkAdditionalIndentation.hx │ ├── MarkEmptyLines.hx │ ├── MarkLineEnds.hx │ ├── MarkSameLine.hx │ ├── MarkTokenText.hx │ ├── MarkWhitespace.hx │ ├── MarkerBase.hx │ └── wrapping │ ├── MarkWrapping.hx │ ├── MarkWrappingBase.hx │ └── WrappableItem.hx ├── test.hxml ├── test ├── GoldBaseTest.hx ├── SelfTest.hx ├── TestCaseMacro.hx ├── TestMain.hx ├── TestSingleRun.hx ├── TestSuite.hx ├── formatter │ ├── EmptyLinesTest.hx │ ├── FormatStatsTest.hx │ └── codedata │ │ └── TokenListTest.hx ├── import.hx └── testcases │ ├── EmptyLinesTestCases.hx │ ├── ExpressionLevelTestCases.hx │ ├── FormatRangeTestCases.hx │ ├── IndentationTestCases.hx │ ├── LineEndsTestCases.hx │ ├── MissingTestCases.hx │ ├── Other.hx │ ├── SameLineTestCases.hx │ ├── WhitespaceTestCases.hx │ ├── WrappingTestCases.hx │ ├── emptylines │ ├── abstract_in_nested_conditional.hxtest │ ├── after_vars_before_conditionals.hxtest │ ├── around_package_0.hxtest │ ├── around_package_1.hxtest │ ├── class_fields_with_conditional_function_signatures.hxtest │ ├── empty_classes_with_conditional_metadata.hxtest │ ├── empty_curly_both_break.hxtest │ ├── empty_curly_break.hxtest │ ├── empty_line_between_var_and_function.hxtest │ ├── end_type_empty_line_with_return_body.hxtest │ ├── enum_before_fields.hxtest │ ├── enum_fields.hxtest │ ├── getter_setter.hxtest │ ├── getter_setter_keep.hxtest │ ├── getter_setter_same.hxtest │ ├── imports_and_using_all.hxtest │ ├── imports_and_using_all_0.hxtest │ ├── imports_and_using_fifth_level.hxtest │ ├── imports_and_using_first_level.hxtest │ ├── imports_and_using_fourth_level.hxtest │ ├── imports_and_using_full_package.hxtest │ ├── imports_and_using_second_level.hxtest │ ├── imports_and_using_third_level.hxtest │ ├── issue_102_before_doc_comments_in_typedefs_and_enums.hxtest │ ├── issue_130_lines_between_var_and_prop.hxtest │ ├── issue_147_between_fields_with_comments.hxtest │ ├── issue_175_empty_line_between_conditional_and_comment.hxtest │ ├── issue_188_conditional_fields_doc_comment.hxtest │ ├── issue_188_conditional_fields_doc_comment_ignore.hxtest │ ├── issue_188_conditional_fields_doc_comment_none.hxtest │ ├── issue_240_class_empty_lines.hxtest │ ├── issue_255_no_empty_lines.hxtest │ ├── issue_255_no_single_line_empty_lines.hxtest │ ├── issue_255_one_single_line_empty_lines.hxtest │ ├── issue_292_between_multiline_comments.hxtest │ ├── issue_292_between_multiline_comments_one_emptyline.hxtest │ ├── issue_292_file_header_comment.hxtest │ ├── issue_292_file_header_comment_no_empty_line.hxtest │ ├── issue_307_empty_line_after_class_metadata.hxtest │ ├── issue_310_one_file_header_comment_with_package.hxtest │ ├── issue_310_one_file_header_comment_with_package_and_zero.hxtest │ ├── issue_310_one_type_doc_comment_one_emtpy_line.hxtest │ ├── issue_310_two_multiline_comments_no_empty_line.hxtest │ ├── issue_310_two_multiline_comments_one_emtpy_line.hxtest │ ├── issue_310_two_multiline_comments_with_package.hxtest │ ├── issue_310_two_multiline_comments_with_package_2.hxtest │ ├── issue_322_missing_empty_line_after_conditional.hxtest │ ├── issue_322_missing_empty_line_after_else_conditional.hxtest │ ├── issue_322_missing_empty_line_after_ifelse_conditional.hxtest │ ├── issue_356_functions_without_implementation.hxtest │ ├── issue_368_multiline_string_literals.hxtest │ ├── issue_377_macro_classes.hxtest │ ├── issue_378_metadata_using_import_package.hxtest │ ├── issue_384_macro_classes_with_metadata.hxtest │ ├── issue_385_single_line_doc_comment_fields.hxtest │ ├── issue_40_conditionals.hxtest │ ├── issue_419_conditionals.hxtest │ ├── issue_428_doc_comments_vs_conditionals.hxtest │ ├── issue_431_conditionalised_class_with_constraints.hxtest │ ├── issue_432_after_doc_comments.hxtest │ ├── issue_455_keep_empty_lines_between_fields.hxtest │ ├── issue_455_keep_empty_lines_between_fields_ignore.hxtest │ ├── issue_49_imports_with_conditional.hxtest │ ├── issue_4_no_empty_line_before_sharp_end.hxtest │ ├── issue_4_no_empty_line_before_sharp_end_2.hxtest │ ├── issue_511_block_level_doc_comments.hxtest │ ├── issue_52_between_types_with_conditionals.hxtest │ ├── issue_52_between_types_with_nested_conditional.hxtest │ ├── issue_556_if_body_with_comment.hxtest │ ├── issue_5_final_lineend.hxtest │ ├── issue_601_enum_abstract_final.hxtest │ ├── issue_644_keep_empty_lines_in_anon_function.hxtest │ ├── issue_65_extern_class.hxtest │ ├── issue_66_interface.hxtest │ ├── issue_672_enum_fields_emptylines.hxtest │ ├── issue_69_before_doc_comments.hxtest │ ├── issue_69_before_doc_comments_ignore.hxtest │ ├── issue_69_before_doc_comments_none.hxtest │ ├── issue_6_keep_empty_lines_after_bropen.hxtest │ ├── issue_6_keep_empty_lines_before_bropen.hxtest │ ├── issue_6_no_empty_lines_after_bropen.hxtest │ ├── issue_70_remove_empty_lines_around_blocks.hxtest │ ├── issue_85_after_last_import_with_sharp.hxtest │ ├── issue_85_before_using_after_sharp.hxtest │ ├── issue_91_class_fields_vars_props.hxtest │ ├── issue_98_before_doc_comments_with_final.hxtest │ ├── line_comments_between_function.hxtest │ ├── line_comments_between_function_no_emptyline.hxtest │ ├── line_comments_between_types.hxtest │ ├── line_comments_between_types_no_emptyline.hxtest │ ├── line_comments_between_types_no_space.hxtest │ ├── max_anywhere_in_file.hxtest │ ├── private_abstract_with_conditionals.hxtest │ ├── type_parameter_detection.hxtest │ ├── typedef_between_fields.hxtest │ └── typedef_fields.hxtest │ ├── expressionlevel │ └── issue_450_object_literal.hxtest │ ├── formatrange │ ├── before_multiline_comment_and_beyond.hxtest │ ├── before_multiline_comment_with_star.hxtest │ ├── end_in_multiline_string.hxtest │ ├── fullLine.hxtest │ ├── multiLine.hxtest │ ├── multiline_comment.hxtest │ ├── multiline_comment_at_start.hxtest │ ├── multiline_comment_mixed_indentation.hxtest │ ├── multiline_comment_with_star.hxtest │ ├── multiline_comment_with_star_add_star_line.hxtest │ ├── multiline_string.hxtest │ ├── singleLine.hxtest │ ├── start_in_multiline_string.hxtest │ ├── two_multiline_comments.hxtest │ └── two_multiline_comments_with_star.hxtest │ ├── indentation │ ├── arrow_function_paramter.hxtest │ ├── call_wrapping_indent.hxtest │ ├── conditionals_fixed_zero_increase.hxtest │ ├── conditionals_fixed_zero_increase_blocks.hxtest │ ├── constructor_body.hxtest │ ├── constructor_body_next.hxtest │ ├── else_in_return_switch_with_expressionCase_keep.hxtest │ ├── else_in_return_switch_with_expressionCase_same.hxtest │ ├── else_in_return_switch_with_expressionIf_next.hxtest │ ├── else_in_return_switch_with_expressionIf_same.hxtest │ ├── function_from_to.hxtest │ ├── if_else_conditionals.hxtest │ ├── indent_typedef.hxtest │ ├── indent_with_comment_body.hxtest │ ├── indent_with_curly_on_next.hxtest │ ├── indentation_of_properties.hxtest │ ├── issue_100_macro_blocks.hxtest │ ├── issue_10_indent_anon_function_call.hxtest │ ├── issue_114_untyped.hxtest │ ├── issue_114_untyped_keep.hxtest │ ├── issue_118_indenter_npe_with_conditionals.hxtest │ ├── issue_128_multiple_arrow_functions.hxtest │ ├── issue_129_macro_block.hxtest │ ├── issue_138_multiple_objects_in_call.hxtest │ ├── issue_138_multiple_objects_in_call_curly_next.hxtest │ ├── issue_139_unstable_multiline_comment.hxtest │ ├── issue_13_dont_add_whitespace_in_doc_comments.hxtest │ ├── issue_144_switch_braceless_if.hxtest │ ├── issue_153_unstable_typedef_extension.hxtest │ ├── issue_168_object_literal_in_array_comprehension.hxtest │ ├── issue_16_blocks_within_blocks.hxtest │ ├── issue_170_additional_indentation.hxtest │ ├── issue_174_comments_before_case.hxtest │ ├── issue_177_switch_indentation.hxtest │ ├── issue_177_switch_indentation_both.hxtest │ ├── issue_179_indentation_with_long_throw.hxtest │ ├── issue_187_multi_line_wrapped_assignment.hxtest │ ├── issue_187_multi_line_wrapped_assignment_fill.hxtest │ ├── issue_187_multi_line_wrapped_assignment_oneline.hxtest │ ├── issue_208_additional_unstable_comments.hxtest │ ├── issue_209_additional_unstable_comments.hxtest │ ├── issue_210_more_comment_side_scrolling.hxtest │ ├── issue_212_ping_pong_comment.hxtest │ ├── issue_220_object_literal_if_else_chain.hxtest │ ├── issue_220_object_literal_if_else_chain_indent_value_expr.hxtest │ ├── issue_220_object_literal_if_else_chain_same.hxtest │ ├── issue_221_indentation_of_prefix_increment.hxtest │ ├── issue_237_comment_in_object_literal.hxtest │ ├── issue_252_conditionals_aligned.hxtest │ ├── issue_252_conditionals_aligned_decrease.hxtest │ ├── issue_252_conditionals_aligned_fixed_zero.hxtest │ ├── issue_252_conditionals_aligned_increase.hxtest │ ├── issue_258_object_literal_false.hxtest │ ├── issue_258_object_literal_true.hxtest │ ├── issue_290_block_breaking_conditional.hxtest │ ├── issue_290_block_breaking_conditional_2.hxtest │ ├── issue_290_block_breaking_conditional_both.hxtest │ ├── issue_298_sharp_error_indent_aligned.hxtest │ ├── issue_298_sharp_error_indent_aligned_decrease.hxtest │ ├── issue_298_sharp_error_indent_aligned_increase.hxtest │ ├── issue_304_expression_if_indentation_keep.hxtest │ ├── issue_304_expression_if_indentation_keep_indent_assignment_expr.hxtest │ ├── issue_304_expression_if_indentation_next.hxtest │ ├── issue_304_expression_if_indentation_next_indent_assignment_expr.hxtest │ ├── issue_304_expression_if_indentation_same.hxtest │ ├── issue_304_expression_if_indentation_same_indent_assignment_expr.hxtest │ ├── issue_305_object_literal.hxtest │ ├── issue_305_object_literal_curly_both.hxtest │ ├── issue_305_object_literal_indent_curly_both.hxtest │ ├── issue_315_anon_function_call.hxtest │ ├── issue_326_untyped_assignment.hxtest │ ├── issue_334_complex_var_assignment.hxtest │ ├── issue_334_complex_var_assignment_indent_value_expr.hxtest │ ├── issue_339_line_comment_before_catch.hxtest │ ├── issue_354_echecktype_breaks_else_indentation.hxtest │ ├── issue_367_array_literal_call.hxtest │ ├── issue_372_echecktype_anon_function.hxtest │ ├── issue_392_case_indentation.hxtest │ ├── issue_3_increasing_indent_in_doc_comments.hxtest │ ├── issue_423_switch_case_opbool_chain.hxtest │ ├── issue_452_braceless_function_with_switch.hxtest │ ├── issue_45_comment_breaks_indentation.hxtest │ ├── issue_464_double_indentation.hxtest │ ├── issue_465_return_if.hxtest │ ├── issue_468_return_if_else.hxtest │ ├── issue_470_method_chains.hxtest │ ├── issue_476_var_assignment.hxtest │ ├── issue_477_comment_in_case.hxtest │ ├── issue_478_indent_case.hxtest │ ├── issue_478_indent_case_curly_next.hxtest │ ├── issue_490_nested_object_literal.hxtest │ ├── issue_490_nested_object_literal_indent.hxtest │ ├── issue_499_conditional_comment.hxtest │ ├── issue_500_incorrect_comment_closing.hxtest │ ├── issue_512_array_literal_assignment.hxtest │ ├── issue_519_nested_conditional.hxtest │ ├── issue_51_adjust_comment_indentation.hxtest │ ├── issue_534_additional_indent_for_parens_after_equals.hxtest │ ├── issue_540_arrow_indent_as_call_parameter.hxtest │ ├── issue_546_wrapping_and_arrow_function.hxtest │ ├── issue_557_anon_struct_with_assignment.hxtest │ ├── issue_567_metadata_if_expression.hxtest │ ├── issue_576_switch_indentation.hxtest │ ├── issue_577_anon_function_body.hxtest │ ├── issue_577_anon_function_body_curly_next.hxtest │ ├── issue_611_var_with_local_function.hxtest │ ├── issue_618_macro_if.hxtest │ ├── issue_629_type_check_after_block.hxtest │ ├── issue_646_trailing_whitespace.hxtest │ ├── issue_646_trailing_whitespace_false.hxtest │ ├── issue_676_conditionals.hxtest │ ├── issue_74_typedef_indentation_with_comment.hxtest │ ├── issue_77_array_wrapping_indent.hxtest │ ├── issue_78_single_array_literal.hxtest │ ├── issue_79_multiple_anon_functions.hxtest │ ├── issue_86_indentation_removed_from_comments.hxtest │ ├── issue_8_incorrect_if_indentation.hxtest │ ├── issue_90_indentation_after_var.hxtest │ ├── lambda_map.hxtest │ ├── method_chain_with_anon_functions.hxtest │ ├── method_chain_with_line_comment.hxtest │ ├── nested_if_else_with_curly_next.hxtest │ ├── nested_if_else_with_curly_same.hxtest │ ├── nested_indentation.hxtest │ ├── nested_method_chain.hxtest │ ├── object_literal.hxtest │ ├── opassignop.hxtest │ ├── properties_In_anon_types.hxtest │ ├── try_catch_with_curly_next.hxtest │ └── typedef_with_curly_next.hxtest │ ├── lineends │ ├── abstract_class.hxtest │ ├── comment_wrap.hxtest │ ├── comments_after_if.hxtest │ ├── comments_after_single_line_type.hxtest │ ├── conditional_array.hxtest │ ├── dollar_chain.hxtest │ ├── expression_if.hxtest │ ├── expression_if_indent_assignment_expr.hxtest │ ├── if_body_comment.hxtest │ ├── if_with_conditional.hxtest │ ├── issue_107_inline_sharp.hxtest │ ├── issue_111_extra_line_break_after_object.hxtest │ ├── issue_146_function_with_overload.hxtest │ ├── issue_151_dynamic_modifier.hxtest │ ├── issue_158_anon_function_in_nested_literal.hxtest │ ├── issue_15_no_linebreaks_in_empty_structure.hxtest │ ├── issue_160_conditionals_and_comments.hxtest │ ├── issue_176_curly_after_type_param.hxtest │ ├── issue_176_curly_after_type_param_both.hxtest │ ├── issue_17_lineend_aftersharp_error.hxtest │ ├── issue_198_call_on_anon_functions.hxtest │ ├── issue_213_linebreak_in_function_type.hxtest │ ├── issue_215_macro_with_dollar_block.hxtest │ ├── issue_216_typedef_without_semicolon_unstable_comments.hxtest │ ├── issue_216_typedef_without_semicolon_unstable_comments_empty_lines.hxtest │ ├── issue_231_anon_function_parameter.hxtest │ ├── issue_231_anon_function_parameter_keep.hxtest │ ├── issue_231_anon_function_parameter_one_line.hxtest │ ├── issue_231_anon_function_parameter_one_line_after_first.hxtest │ ├── issue_232_key_value_iterator.hxtest │ ├── issue_27_case_var_line_end.hxtest │ ├── issue_291_conditional_modifier.hxtest │ ├── issue_301_typedef_anon_type.hxtest │ ├── issue_301_typedef_anon_type_wrap_keep.hxtest │ ├── issue_319_object_literal_left_curly_before.hxtest │ ├── issue_319_object_literal_left_curly_both.hxtest │ ├── issue_319_object_literal_left_curly_none.hxtest │ ├── issue_321_comment_after_typedef.hxtest │ ├── issue_329_else_body_with_popen.hxtest │ ├── issue_329_else_body_with_popen_indent_value_expr.hxtest │ ├── issue_329_else_body_with_popen_indent_value_expr_keep.hxtest │ ├── issue_329_else_body_with_popen_keep.hxtest │ ├── issue_32_structure_inheritance.hxtest │ ├── issue_330_ternary_with_object_literal.hxtest │ ├── issue_331_line_comment_after_typedef.hxtest │ ├── issue_333_if_body_metadata.hxtest │ ├── issue_344_conditional_with_line_comment.hxtest │ ├── issue_346_many_curly_options.hxtest │ ├── issue_346_many_curly_options_both.hxtest │ ├── issue_358_left_curly_with_empty_structure_return.hxtest │ ├── issue_358_left_curly_with_empty_structure_return_both.hxtest │ ├── issue_363_abstract_with_comments.hxtest │ ├── issue_364_empty_abstract_body_with_comments.hxtest │ ├── issue_369_anon_type_hint_return_value.hxtest │ ├── issue_369_anon_type_hint_return_value_both.hxtest │ ├── issue_380_incomplete_metadata.hxtest │ ├── issue_396_long_opadd_chain.hxtest │ ├── issue_410_missing_semicolon_handling.hxtest │ ├── issue_429_semicolon_after_conditional.hxtest │ ├── issue_43_multi_line_comments_in_line.hxtest │ ├── issue_445_curly_with_comment.hxtest │ ├── issue_445_curly_with_comment_both.hxtest │ ├── issue_44_single_line_sharp.hxtest │ ├── issue_475_structure_type_param.hxtest │ ├── issue_47_dont_linebreak_structure_types.hxtest │ ├── issue_50_typedef_with_type_parameter.hxtest │ ├── issue_538_anon_function_curly.hxtest │ ├── issue_538_anon_function_curly_newline_when_empty.hxtest │ ├── issue_53_line_end_after_typedefs.hxtest │ ├── issue_53_line_end_after_typedefs_empty_lines.hxtest │ ├── issue_560_arrow_function_curly.hxtest │ ├── issue_565_macro_class.hxtest │ ├── issue_578_metadata_multiline_comment.hxtest │ ├── issue_598_multiline_comment_var.hxtest │ ├── issue_602_return_metadata.hxtest │ ├── issue_614_switch_semicolon.hxtest │ ├── issue_61_block_var_init.hxtest │ ├── issue_626_overload_modifier.hxtest │ ├── issue_630_local_metadata.hxtest │ ├── issue_643_comments_in_typedef.hxtest │ ├── issue_87_assignment_without_semicolon.hxtest │ ├── issue_88_block_var_init.hxtest │ ├── issue_89_case_without_semicolon.hxtest │ ├── issue_9_dont_move_single_line_comments.hxtest │ ├── line_end_character_auto.hxtest │ ├── line_end_character_cr.hxtest │ ├── line_end_character_crlf.hxtest │ ├── line_end_character_lf.hxtest │ ├── map_with_comment.hxtest │ ├── metadata_after.hxtest │ ├── metadata_after_last.hxtest │ ├── metadata_force_after_last.hxtest │ ├── metadata_none.hxtest │ └── simons_type_parameter_constraints.hxtest │ ├── missing │ └── issue_18_missing_modifier_in_conditionals.hxtest │ ├── other │ ├── callback_type_param.hxtest │ ├── code_snippet.hxtest │ ├── disabled_excluded.hxtest │ ├── disabled_formatting.hxtest │ ├── ends_with_string_literal.hxtest │ ├── ends_with_string_literal_2.hxtest │ ├── ends_with_string_literal_3.hxtest │ ├── failing_issue_558_merge_conflict.hxtest │ ├── fixConstAfterConst_exception.hxtest │ ├── for_with_macro_reification.hxtest │ ├── formatter_off.hxtest │ ├── formatter_off_on.hxtest │ ├── inline_markup.hxtest │ ├── issue_106_indenter_npe.hxtest │ ├── issue_154_crash_with_nested_ternary.hxtest │ ├── issue_156_recursive_loop_with_conditional_switch.hxtest │ ├── issue_157_line_deleted_after_ternary.hxtest │ ├── issue_163_macro_class_name.hxtest │ ├── issue_164_implements_extends.hxtest │ ├── issue_165_conditionals_with_new.hxtest │ ├── issue_166_macro_patterns.hxtest │ ├── issue_190_ternary_with_macro.hxtest │ ├── issue_191_conditionals.hxtest │ ├── issue_200_interesting_conditionals.hxtest │ ├── issue_203_multiline_interpolation.hxtest │ ├── issue_228_typedef_withoug_assign.hxtest │ ├── issue_23_execption_hashmap.hxtest │ ├── issue_24_empty_exception.hxtest │ ├── issue_259_inline_conditionals_truncate.hxtest │ ├── issue_25_import_completion_exception.hxtest │ ├── issue_261_multiline_string_interpolation.hxtest │ ├── issue_261_multiline_string_interpolation_2.hxtest │ ├── issue_261_multiline_string_interpolation_indent_assignment_expr.hxtest │ ├── issue_28_exception_with_bom.hxtest │ ├── issue_29_execption_conditionals_before_type.hxtest │ ├── issue_30_exception_with_guard.hxtest │ ├── issue_33_macro_class_reification.hxtest │ ├── issue_34_switch_this.hxtest │ ├── issue_480_conditional_with_dot_ident.hxtest │ ├── issue_523_inline_markup.hxtest │ ├── issue_558_not_merge_conflict.hxtest │ ├── issue_58_missing_modifiers_of_final.hxtest │ ├── issue_610_token.hxtest │ ├── issue_624_inline_markup.hxtest │ ├── issue_94_incomplete_code_snippet.hxtest │ ├── issue_94_incomplete_code_snippet_empty_lines.hxtest │ ├── issue_96_incomplete_code_snippet.hxtest │ ├── issue_97_incomplete_code_snippet.hxtest │ ├── issue_97_incomplete_code_snippet_empty_lines.hxtest │ ├── mixed_samples.hxtest │ ├── mixed_samples_2.hxtest │ ├── mixed_samples_3.hxtest │ ├── mixed_samples_4.hxtest │ ├── mixed_samples_empty_lines.hxtest │ ├── module_level_statics.hxtest │ ├── numeric_separator.hxtest │ ├── private_final_class.hxtest │ ├── safe_navigation_operator.hxtest │ ├── sharp_error.hxtest │ ├── sharp_if_parens_macro_hang.hxtest │ ├── ternary_with_return.hxtest │ └── unicode_regex.hxtest │ ├── sameline │ ├── abstract_any.hxtest │ ├── anon_type_hint_with_curly_next.hxtest │ ├── anon_type_hint_with_curly_next_and_space.hxtest │ ├── inline_conditional.hxtest │ ├── issue_104_typedef_with_finals.hxtest │ ├── issue_105_expressionIf_with_untyped.hxtest │ ├── issue_113_object_literal_binop.hxtest │ ├── issue_119_expression_case.hxtest │ ├── issue_11_else_if_next_line.hxtest │ ├── issue_11_else_if_same_line.hxtest │ ├── issue_120_expression_case_2.hxtest │ ├── issue_120_expression_case_2_keep.hxtest │ ├── issue_120_expression_case_2_next.hxtest │ ├── issue_121_longer_expression_case.hxtest │ ├── issue_121_longer_expression_case_keep.hxtest │ ├── issue_121_longer_expression_case_next.hxtest │ ├── issue_122_function_call_on_object_literal.hxtest │ ├── issue_123_return_try_catch.hxtest │ ├── issue_123_return_try_catch_expression_try_next.hxtest │ ├── issue_123_return_try_catch_expression_try_same.hxtest │ ├── issue_123_return_try_catch_next.hxtest │ ├── issue_124_switch_in_object_literal.hxtest │ ├── issue_125_expression_case_and_comment_keep.hxtest │ ├── issue_125_expression_case_and_comment_next.hxtest │ ├── issue_125_expression_case_and_comment_same.hxtest │ ├── issue_126_array_comprehension.hxtest │ ├── issue_127_expression_case_in_call.hxtest │ ├── issue_131_conditional_type_hint.hxtest │ ├── issue_132_expression_case_if.hxtest │ ├── issue_133_array_comprehension_without_block.hxtest │ ├── issue_137_array_comprehension.hxtest │ ├── issue_142_abstract_on_anon_struct.hxtest │ ├── issue_143_abstract_from_anon_struct.hxtest │ ├── issue_148_typedefs_same_line.hxtest │ ├── issue_161_if_body_in_object_literal.hxtest │ ├── issue_167_abstract_with_multiple_froms.hxtest │ ├── issue_178_return_object_literal.hxtest │ ├── issue_185_function_call_object_literal.hxtest │ ├── issue_19_ternary_style_if.hxtest │ ├── issue_20_for_body_in_array_comprehension.hxtest │ ├── issue_21_no_curly_ifelse_sameline.hxtest │ ├── issue_235_keep_if_else.hxtest │ ├── issue_254_case_colon.hxtest │ ├── issue_254_case_colon_keep.hxtest │ ├── issue_254_case_colon_next.hxtest │ ├── issue_256_keep_anon_function.hxtest │ ├── issue_257_return_keep.hxtest │ ├── issue_257_return_next.hxtest │ ├── issue_257_return_same.hxtest │ ├── issue_257_return_same_indent_value_expr.hxtest │ ├── issue_26_function_body_next.hxtest │ ├── issue_26_function_body_same.hxtest │ ├── issue_271_arrow_switch.hxtest │ ├── issue_272_binop_switch.hxtest │ ├── issue_303_return_sameline.hxtest │ ├── issue_303_return_sameline_all_keep.hxtest │ ├── issue_303_return_sameline_all_next.hxtest │ ├── issue_303_return_sameline_all_same.hxtest │ ├── issue_303_return_sameline_same.hxtest │ ├── issue_306_case_bropen_keep.hxtest │ ├── issue_306_case_bropen_keep_curly_both.hxtest │ ├── issue_306_case_bropen_next.hxtest │ ├── issue_306_case_bropen_same.hxtest │ ├── issue_316_line_comment_after_else.hxtest │ ├── issue_316_line_comment_after_else_curly_both.hxtest │ ├── issue_316_line_comment_after_else_on_newline.hxtest │ ├── issue_328_braceless_if_with_conditionals.hxtest │ ├── issue_332_conditional_modifiers.hxtest │ ├── issue_336_complex_conditionals_typedef.hxtest │ ├── issue_360_if_else_with_try_catch.hxtest │ ├── issue_362_untyped_body.hxtest │ ├── issue_362_untyped_body_curly_both.hxtest │ ├── issue_362_untyped_body_keep.hxtest │ ├── issue_362_untyped_body_next.hxtest │ ├── issue_362_untyped_body_next_curly_both.hxtest │ ├── issue_365_array_comprehension.hxtest │ ├── issue_41_ternary_style_if_in_call.hxtest │ ├── issue_42_if_after_assign_with_blocks.hxtest │ ├── issue_42_if_after_assign_with_blocks_indent_assignment_expr.hxtest │ ├── issue_42_if_after_assign_with_blocks_on_same_line.hxtest │ ├── issue_48_metadata_max_length.hxtest │ ├── issue_498_nested_array_comprehension.hxtest │ ├── issue_504_conditional_import.hxtest │ ├── issue_509_try_catch_expression.hxtest │ ├── issue_509_try_catch_expression_next.hxtest │ ├── issue_509_try_catch_expression_same.hxtest │ ├── issue_54_return_sharp_multiple_passes.hxtest │ ├── issue_552_non_value_if_in_switch.hxtest │ ├── issue_612_else_block.hxtest │ ├── issue_612_else_block_semicolon_false.hxtest │ ├── issue_612_else_block_semicolon_true.hxtest │ ├── issue_63_do_while_all_same.hxtest │ ├── issue_63_do_while_next.hxtest │ ├── issue_63_do_while_same.hxtest │ ├── issue_63_do_while_same_next.hxtest │ ├── issue_681_single_line_function_body_with_metadata.hxtest │ ├── issue_73_return_switch_if_expression.hxtest │ ├── issue_76_function_new_body_next.hxtest │ ├── issue_80_expression_try_catch_next.hxtest │ ├── issue_80_expression_try_catch_same.hxtest │ ├── issue_81_while_array_comprehension.hxtest │ ├── issue_83_anon_function_body_all_same.hxtest │ ├── issue_83_anon_function_body_next.hxtest │ ├── issue_83_anon_function_body_same.hxtest │ ├── issue_83_anon_function_body_same_next.hxtest │ ├── issue_93_expression_if_with_binop.hxtest │ ├── issue_99_expressionIf_in_structure_field_assignment.hxtest │ ├── return_if_else_if.hxtest │ ├── return_if_else_if_keep.hxtest │ ├── return_if_else_if_next.hxtest │ ├── return_if_else_if_next_with_indent.hxtest │ ├── return_if_else_if_same.hxtest │ ├── return_try_catch_allman_curly.hxtest │ ├── switch_case_keep.hxtest │ ├── switch_case_next.hxtest │ └── switch_case_same.hxtest │ ├── whitespace │ ├── abstract_from_function.hxtest │ ├── abstract_over_array_of_anon_type.hxtest │ ├── block_metadata.hxtest │ ├── call_with_array.hxtest │ ├── commented_out_parameter.hxtest │ ├── conditionalised_case.hxtest │ ├── default_metadata.hxtest │ ├── final_space_removed_from_javadoc_comments_2.hxtest │ ├── for_iterator_with_popen.hxtest │ ├── imports_mult.hxtest │ ├── inline_calls.hxtest │ ├── interval_with_popen.hxtest │ ├── issue_101_comment_in_object_literal.hxtest │ ├── issue_103_missing_space_around_arrow_function.hxtest │ ├── issue_108_at_new.hxtest │ ├── issue_112_detect_arrow_function.hxtest │ ├── issue_115_comment_changes_whitespace.hxtest │ ├── issue_115_comment_changes_whitespace_space.hxtest │ ├── issue_117_dollar_and_binop.hxtest │ ├── issue_12_space_before_unary_minus.hxtest │ ├── issue_134_comments.hxtest │ ├── issue_135_string_interpolation_with_escaped_dollar.hxtest │ ├── issue_135_string_interpolation_with_escaped_dollar_noformat.hxtest │ ├── issue_140_assignment_in_anon_type.hxtest │ ├── issue_141_comment_with_star.hxtest │ ├── issue_145_overload_function.hxtest │ ├── issue_14_space_before_inline_structure.hxtest │ ├── issue_150_overload_function.hxtest │ ├── issue_152_type_hint.hxtest │ ├── issue_159_unstable_comment.hxtest │ ├── issue_162_space_at_start_of_single_line_comment.hxtest │ ├── issue_172_type_check.hxtest │ ├── issue_173_optional_arrow_type.hxtest │ ├── issue_181_property_type_hint.hxtest │ ├── issue_183_type_check_this.hxtest │ ├── issue_184_type_hint_in_overload.hxtest │ ├── issue_194_untyped_ternary.hxtest │ ├── issue_195_macro_do_while.hxtest │ ├── issue_196_ternary_anon_function.hxtest │ ├── issue_197_ternary_floats.hxtest │ ├── issue_199_ternary_with_conmments.hxtest │ ├── issue_1_ternary_whitespace.hxtest │ ├── issue_201_ternary_with_opnot.hxtest │ ├── issue_202_structure_inheritance_with_type_parameters.hxtest │ ├── issue_202_structure_inheritance_with_type_parameters_empty_lines.hxtest │ ├── issue_204_nested_while_loop.hxtest │ ├── issue_205_ternary_with_macro_reification.hxtest │ ├── issue_206_typedef_function_type_with_structure.hxtest │ ├── issue_217_type_hint_on_number.hxtest │ ├── issue_218_macro_reification_parens.hxtest │ ├── issue_219_macro_reification_comma.hxtest │ ├── issue_22_is_operator_spacing.hxtest │ ├── issue_241_metadata_with_parameter.hxtest │ ├── issue_241_metadata_with_parameter_with_popen_before.hxtest │ ├── issue_251_space_after_anon_function.hxtest │ ├── issue_251_space_after_anon_function_empty.hxtest │ ├── issue_263_metatdata_do.hxtest │ ├── issue_273_arrow_function_type_hint_in_call.hxtest │ ├── issue_284_type_check_in_array_comprehension.hxtest │ ├── issue_308_whitespace_after_comma.hxtest │ ├── issue_31_space_before_comma_in_objects.hxtest │ ├── issue_327_between_conditional_and_metadata.hxtest │ ├── issue_335_missing_space_after_conditional.hxtest │ ├── issue_337_type_parameter_with_structure_type.hxtest │ ├── issue_345_conditionalised_function_parameters.hxtest │ ├── issue_348_ternary_with_opbool.hxtest │ ├── issue_348_unary_after_condition.hxtest │ ├── issue_35_space_after_gt_return_type_hint.hxtest │ ├── issue_361_else_with_echecktype.hxtest │ ├── issue_36_space_remove_after_type_hint.hxtest │ ├── issue_374_echecktype_detection.hxtest │ ├── issue_37_ternary_with_comparison.hxtest │ ├── issue_38_whitespace_in_doc_comments.hxtest │ ├── issue_395_echecktype_with_conditional.hxtest │ ├── issue_397_conditionals_in_function_args.hxtest │ ├── issue_39_space_in_const_type_parameter.hxtest │ ├── issue_426_arrow_function_map_literal.hxtest │ ├── issue_431_conditionial_class_constraints.hxtest │ ├── issue_441_array_literal_block_comment.hxtest │ ├── issue_446_conditional_function_type_hint.hxtest │ ├── issue_46_at_final_spacing.hxtest │ ├── issue_513_return_popen.hxtest │ ├── issue_531_conditional_typedef.hxtest │ ├── issue_531_conditional_typedef_no_additional_indent.hxtest │ ├── issue_543_ifPolicy_after_else.hxtest │ ├── issue_547_unary_minus_whitespace.hxtest │ ├── issue_55_semicolon_after_sharp_end.hxtest │ ├── issue_562_arrow_function.hxtest │ ├── issue_563_typed_interface_final.hxtest │ ├── issue_56_arrow_functions.hxtest │ ├── issue_582_type_hints_conditionals.hxtest │ ├── issue_583_catch.hxtest │ ├── issue_583_conditionParams.hxtest │ ├── issue_583_if_condition.hxtest │ ├── issue_583_sharp_condition.hxtest │ ├── issue_583_switch_condition.hxtest │ ├── issue_583_while_condition.hxtest │ ├── issue_586_type_hints.hxtest │ ├── issue_588_anon_type_param.hxtest │ ├── issue_591_call_parens.hxtest │ ├── issue_592_bracket_config.hxtest │ ├── issue_592_bracket_config_access.hxtest │ ├── issue_592_bracket_config_array_literal.hxtest │ ├── issue_592_bracket_config_comprehension.hxtest │ ├── issue_592_bracket_config_map_literal.hxtest │ ├── issue_593_doc_comment_trailing_whitespace.hxtest │ ├── issue_594_metatdata_in.hxtest │ ├── issue_599_null_safe_navigation_operator.hxtest │ ├── issue_59_compress_parens_without_semicolon.hxtest │ ├── issue_605_operator_is.hxtest │ ├── issue_607_anon_object_with_meta.hxtest │ ├── issue_60_object_literal_with_string_identifier.hxtest │ ├── issue_613_type_hints_in_arrow_function.hxtest │ ├── issue_615_bool_or_and_assign.hxtest │ ├── issue_622_bracket.hxtest │ ├── issue_62_case_with_pattern_guard.hxtest │ ├── issue_634_is_as_import.hxtest │ ├── issue_638_complextype_reification_ternary.hxtest │ ├── issue_642_arrow_function_with_optional_arg.hxtest │ ├── issue_64_space_before_unary_minus.hxtest │ ├── issue_650_default_type_parameter.hxtest │ ├── issue_650_default_type_parameter_none.hxtest │ ├── issue_659_enum_type_params.hxtest │ ├── issue_660_macro_colon_type.hxtest │ ├── issue_66_whitespace_at_end_of_comment.hxtest │ ├── issue_67_whitespace_around_untyped.hxtest │ ├── issue_71_array_as_if_body.hxtest │ ├── issue_72_whitespace_in_string_interpolation.hxtest │ ├── issue_72_whitespace_in_string_interpolation_noiformat.hxtest │ ├── issue_75_non_operator_is.hxtest │ ├── issue_7_spaces_in_type_params_with_braces.hxtest │ ├── issue_84_type_parameter.hxtest │ ├── issue_92_detect_function_style.hxtest │ ├── issue_95_optional_enum_constuctor_arg.hxtest │ ├── macro_reification.hxtest │ ├── mark_arrow_npe_with_conditionals.hxtest │ ├── negative_int.hxtest │ ├── not_with_popen.hxtest │ ├── opsub_and_popen.hxtest │ ├── popen_in_metadata.hxtest │ ├── single_line_comments.hxtest │ ├── single_line_comments_no_space.hxtest │ ├── space_in_anonymous_object.hxtest │ ├── space_inside_anon_type_hint.hxtest │ ├── spread_operator.hxtest │ ├── static_locals.hxtest │ ├── type_hint_around.hxtest │ ├── typedef_extension_gt_space.hxtest │ ├── var_meta_data.hxtest │ ├── whitespace_after_object_literal.hxtest │ ├── whitespace_after_type_parameter.hxtest │ ├── whitespace_before_popen.hxtest │ └── whitespace_null_safety_operator.hxtest │ └── wrapping │ ├── a_lot_of_array_items.hxtest │ ├── array_of_3_objects.hxtest │ ├── call_with_array_parameter.hxtest │ ├── call_wrapping_with_function.hxtest │ ├── default_wrapping_after_comma.hxtest │ ├── issue_110_max_length.hxtest │ ├── issue_116_multipass.hxtest │ ├── issue_136_object_literal.hxtest │ ├── issue_136_object_literal_indent_assignment_expr.hxtest │ ├── issue_155_single_line_comments_in_array.hxtest │ ├── issue_169_wrapping_on_field_access.hxtest │ ├── issue_171_wrapping_on_arrow.hxtest │ ├── issue_180_middle_of_function_call.hxtest │ ├── issue_182_conditional_in_object_literal.hxtest │ ├── issue_189_return_type_hint_max_line_length.hxtest │ ├── issue_192_wrapping_function_with_comment.hxtest │ ├── issue_193_wrapping_of_At.hxtest │ ├── issue_207_array_wrapping_with_conditionals.hxtest │ ├── issue_211_conditional_in_object_literal.hxtest │ ├── issue_214_no_additional_indent_for_empty_functions.hxtest │ ├── issue_238_keep_wrapping.hxtest │ ├── issue_238_keep_wrapping_array.hxtest │ ├── issue_238_keep_wrapping_array_comprehension.hxtest │ ├── issue_238_keep_wrapping_call.hxtest │ ├── issue_238_keep_wrapping_call_fillLine.hxtest │ ├── issue_238_keep_wrapping_call_one_per_line.hxtest │ ├── issue_238_keep_wrapping_function_signature.hxtest │ ├── issue_238_keep_wrapping_nowrap.hxtest │ ├── issue_238_keep_wrapping_object_literal.hxtest │ ├── issue_238_keep_wrapping_return_call.hxtest │ ├── issue_299_opboolchain_fill.hxtest │ ├── issue_299_opboolchain_keep.hxtest │ ├── issue_299_opboolchain_one_line.hxtest │ ├── issue_299_opboolchain_one_line_after.hxtest │ ├── issue_311_line_break_before_popen.hxtest │ ├── issue_311_line_break_before_popen_keep.hxtest │ ├── issue_313_opbool_chain_nested_blocks.hxtest │ ├── issue_314_splitting_field_access.hxtest │ ├── issue_320_multiline_string_literal_parameter.hxtest │ ├── issue_340_array_wrapping.hxtest │ ├── issue_355_var_wrapping.hxtest │ ├── issue_355_var_wrapping_fillline.hxtest │ ├── issue_355_var_wrapping_keep.hxtest │ ├── issue_355_var_wrapping_one_line.hxtest │ ├── issue_357_array_comprehension.hxtest │ ├── issue_359_case_pattern_wrapping.hxtest │ ├── issue_359_case_pattern_wrapping_after_last.hxtest │ ├── issue_366_nested_array_comprehension.hxtest │ ├── issue_375_conditionalized_chain_call.hxtest │ ├── issue_376_opadd_chain_as_function_body.hxtest │ ├── issue_386_wrapping_of_call.hxtest │ ├── issue_430_early_multivar_wrapping.hxtest │ ├── issue_433_matrix_wrapping.hxtest │ ├── issue_433_matrix_wrapping_no_align.hxtest │ ├── issue_433_matrix_wrapping_no_matrix.hxtest │ ├── issue_433_matrix_wrapping_trailing_comma.hxtest │ ├── issue_438_multiline_strings.hxtest │ ├── issue_438_multiline_strings_crlf.hxtest │ ├── issue_439_wrapping_function_header.hxtest │ ├── issue_443_matrix_wrapping_with_comments.hxtest │ ├── issue_444_array_wrapping_with_comments.hxtest │ ├── issue_444_array_wrapping_with_comments_one_per_line.hxtest │ ├── issue_466_array_wrapping_regression.hxtest │ ├── issue_472_comment_parameter.hxtest │ ├── issue_488_enum_type_hint.hxtest │ ├── issue_494_type_parameter.hxtest │ ├── issue_496_promises_method_chain.hxtest │ ├── issue_516_literal_wrapping_with_postfix_exclamation.hxtest │ ├── issue_561_multiline_string_call_parameter_keep.hxtest │ ├── issue_569_object_literal_with_opboolor.hxtest │ ├── issue_572_max_line_length.hxtest │ ├── issue_572_max_line_length_opbool.hxtest │ ├── issue_579_case_wrapping.hxtest │ ├── issue_617_wrapping_of_arrow_function.hxtest │ ├── issue_669_interface_extends_wrapping.hxtest │ ├── issue_670_wrapping_with_maxlinelength.hxtest │ ├── issue_675_map_literal_wrapping.hxtest │ ├── issue_68_object_literal_wrapping.hxtest │ ├── issue_82_parameter_wrapping.hxtest │ ├── long_array_access.hxtest │ ├── long_array_items.hxtest │ ├── long_op_chain_wrapping.hxtest │ ├── method_chain_with_comments.hxtest │ ├── method_chain_with_comments_keep.hxtest │ ├── nested_object_literal_with_curly_both.hxtest │ ├── opadd_chain.hxtest │ ├── opadd_chain_fillLine_after_last.hxtest │ ├── opadd_chain_keep.hxtest │ ├── opadd_chain_one_line.hxtest │ ├── opadd_chain_one_line_after_first.hxtest │ ├── opadd_chain_one_line_after_first_before_last.hxtest │ ├── opadd_chain_one_line_before_last.hxtest │ ├── string_concatenation.hxtest │ ├── string_concatenation_one_line_after_first_after_last.hxtest │ ├── string_concatenation_one_line_after_first_before_last.hxtest │ ├── string_concatenation_one_line_after_last.hxtest │ ├── string_concatenation_one_line_before_last.hxtest │ ├── wrapping_call_with_array.hxtest │ ├── wrapping_call_with_new.hxtest │ ├── wrapping_metadata.hxtest │ ├── wrapping_method_chain_after_first.hxtest │ ├── wrapping_method_chain_keep.hxtest │ ├── wrapping_method_chain_per_line.hxtest │ ├── wrapping_of_array.hxtest │ ├── wrapping_of_complex_object.hxtest │ ├── wrapping_of_function_signature.hxtest │ ├── wrapping_of_function_signature_keep.hxtest │ ├── wrapping_of_function_signature_no_wrap.hxtest │ ├── wrapping_of_function_signature_one_item.hxtest │ ├── wrapping_of_implements.hxtest │ ├── wrapping_of_implements_keep.hxtest │ ├── wrapping_of_implements_oneline.hxtest │ ├── wrapping_of_implements_onelineafter.hxtest │ └── wrapping_of_objects.hxtest ├── testCoverage.hxml ├── testJava.hxml └── uglifyFormatter.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs. 2 | # More information at http://EditorConfig.org 3 | root = true 4 | 5 | [*] 6 | indent_style = tab 7 | indent_size = 4 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.hx] 12 | end_of_line = lf 13 | charset = utf-8 14 | 15 | [*.md] 16 | indent_style = space 17 | indent_size = 2 18 | trim_trailing_whitespace = false 19 | 20 | [*.yml] 21 | indent_style = space 22 | indent_size = 2 23 | 24 | [*.hxtest] 25 | trim_trailing_whitespace = false 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Describe the Feature**
8 | A clear and concise description of what the bug is. 9 | 10 | **(Optional) Sample of desired output** 11 | ```haxe 12 | class Main { 13 | static function main() { 14 | doSomething(""); 15 | } 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | .temp 4 | *.iws 5 | *.log 6 | *.cache 7 | .DS_Store 8 | *.n 9 | *.js 10 | *.js.map 11 | *.zip 12 | .haxelib/ 13 | out/ 14 | node_modules/ 15 | log/ 16 | dump/ 17 | target/ 18 | haxe3/ 19 | callgrind.* 20 | ./debug 21 | lcov.info 22 | lcovtest 23 | .unittest/** 24 | 25 | codecov.json 26 | coverage.json 27 | deprecated/ 28 | resources/schema.xml 29 | 30 | core 31 | test/formatter-result.txt 32 | test/single-run.txt 33 | result.txt 34 | **.hxtest.disabled 35 | -------------------------------------------------------------------------------- /.haxerc: -------------------------------------------------------------------------------- 1 | { 2 | "version": "9a7121e", 3 | "resolveLibs": "scoped" 4 | } -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .github 2 | .idea 3 | .unittest 4 | .vscode 5 | haxe_libraries 6 | haxe3_libraries 7 | node_modules 8 | src 9 | test 10 | temp 11 | .editorconfig 12 | .travis.yml 13 | .gitignore 14 | .haxerc 15 | *.html 16 | *.hxml 17 | *.log 18 | *.sh 19 | *.txt 20 | *.yml 21 | *.zip 22 | checkstyle.json 23 | codecov.json 24 | coverage.json 25 | lcov.info 26 | run* 27 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "haxe.configurations": [ 3 | ["display.hxml"] 4 | ], 5 | "[haxe]": { 6 | "editor.formatOnSave": true, 7 | "editor.formatOnPaste": true, 8 | }, 9 | "haxecheckstyle.sourceFolders": [ 10 | "src", 11 | "schema", 12 | "test" 13 | ], 14 | "haxe.importsSortOrder": "stdlib -> libs -> project" 15 | } 16 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "hxml", 6 | "file": "buildAll.hxml", 7 | "group": { 8 | "kind": "build", 9 | "isDefault": true 10 | }, 11 | "label": "Build All" 12 | }, 13 | { 14 | "type": "hxml", 15 | "file": "test.hxml", 16 | "group": { 17 | "kind": "test", 18 | "isDefault": true 19 | } 20 | }, 21 | { 22 | "label": "Format all files", 23 | "type": "shell", 24 | "command": "haxelib run formatter -s .", 25 | "problemMatcher": [] 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /buildAll.hxml: -------------------------------------------------------------------------------- 1 | -cp build 2 | --run Build 3 | -------------------------------------------------------------------------------- /buildCommon.hxml: -------------------------------------------------------------------------------- 1 | -lib tokentree 2 | -lib haxeparser 3 | -lib hxparse 4 | -lib json2object 5 | -lib hxargs 6 | # -lib safety 7 | 8 | -dce full 9 | -D analyzer-optimize 10 | -D haxe-next 11 | 12 | -cp src 13 | 14 | # --macro nullSafety('formatter') 15 | -------------------------------------------------------------------------------- /buildCpp.hxml: -------------------------------------------------------------------------------- 1 | buildCommon.hxml 2 | -cpp out 3 | -main formatter.Cli 4 | 5 | -D HAXE_OUTPUT_FILE=formatter 6 | -------------------------------------------------------------------------------- /buildJava.hxml: -------------------------------------------------------------------------------- 1 | buildCommon.hxml 2 | --jvm out/Cli.jar 3 | -main formatter.Cli 4 | -------------------------------------------------------------------------------- /buildJsBrowser.hxml: -------------------------------------------------------------------------------- 1 | buildCommon.hxml 2 | -js runBrowser.js 3 | -main formatter.Formatter 4 | -------------------------------------------------------------------------------- /buildJsNode.hxml: -------------------------------------------------------------------------------- 1 | buildCommon.hxml 2 | -lib hxnodejs 3 | -js run.js 4 | -main formatter.Cli 5 | -------------------------------------------------------------------------------- /buildNeko.hxml: -------------------------------------------------------------------------------- 1 | buildCommon.hxml 2 | -neko run.n 3 | -main formatter.Cli 4 | -cmd neko run.n --default-config resources/default-hxformat.json 5 | -------------------------------------------------------------------------------- /buildSchema.hxml: -------------------------------------------------------------------------------- 1 | -lib tokentree 2 | -lib haxeparser 3 | -lib hxparse 4 | -lib json2object 5 | -lib hxargs 6 | # -lib safety 7 | 8 | -cp src 9 | -cp schema 10 | -xml resources/schema.xml 11 | -x SchemaGenerator 12 | -------------------------------------------------------------------------------- /display.hxml: -------------------------------------------------------------------------------- 1 | -cp src 2 | -cp test 3 | -cp schema 4 | 5 | -lib tokentree 6 | -lib haxeparser 7 | -lib hxparse 8 | -lib json2object 9 | -lib hxargs 10 | -lib safety 11 | -lib instrument 12 | -lib utest 13 | -lib test-adapter 14 | -------------------------------------------------------------------------------- /haxe_libraries/exception.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/exception#2.0.0" into exception/2.0.0/haxelib 2 | -cp ${HAXE_LIBCACHE}/exception/2.0.0/haxelib/src 3 | -D exception=2.0.0 -------------------------------------------------------------------------------- /haxe_libraries/haxeparser.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/HaxeCheckstyle/haxeparser#a5fce2ecf5fb3bdfebfd7efd8b05329d456ec0d2" into haxeparser/4.3.0-rc.1/github/a5fce2ecf5fb3bdfebfd7efd8b05329d456ec0d2 2 | -lib hxparse 3 | -cp ${HAXE_LIBCACHE}/haxeparser/4.3.0-rc.1/github/a5fce2ecf5fb3bdfebfd7efd8b05329d456ec0d2/src 4 | -D haxeparser=4.3.0-rc.1 -------------------------------------------------------------------------------- /haxe_libraries/hxargs.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/simn/hxargs#1d8ec84f641833edd6f0cb2e4290b7524fd27219" into hxargs/3.0.2/github/1d8ec84f641833edd6f0cb2e4290b7524fd27219 2 | -cp ${HAXE_LIBCACHE}/hxargs/3.0.2/github/1d8ec84f641833edd6f0cb2e4290b7524fd27219/ 3 | -D hxargs=3.0.2 -------------------------------------------------------------------------------- /haxe_libraries/hxcpp.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/HaxeFoundation/hxcpp#9d9b920a42ecd073a5efaea8c7ad184acec6f479" into hxcpp/4.3.0/github/9d9b920a42ecd073a5efaea8c7ad184acec6f479 2 | # @run: haxelib run-dir hxcpp "${HAXE_LIBCACHE}/hxcpp/4.3.0/github/9d9b920a42ecd073a5efaea8c7ad184acec6f479" 3 | -cp ${HAXE_LIBCACHE}/hxcpp/4.3.0/github/9d9b920a42ecd073a5efaea8c7ad184acec6f479/ 4 | -D hxcpp=4.3.0 -------------------------------------------------------------------------------- /haxe_libraries/hxjava.hxml: -------------------------------------------------------------------------------- 1 | -D hxjava=4.0.0-alpha 2 | # @install: lix --silent download "haxelib:/hxjava#4.0.0-alpha" into hxjava/4.0.0-alpha/haxelib 3 | # @run: haxelib run-dir hxjava ${HAXE_LIBCACHE}/hxjava/4.0.0-alpha/haxelib 4 | -cp ${HAXE_LIBCACHE}/hxjava/4.0.0-alpha/haxelib/ 5 | -java-lib lib/hxjava-std.jar 6 | -------------------------------------------------------------------------------- /haxe_libraries/hxjsonast.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/hxjsonast#1.1.0" into hxjsonast/1.1.0/haxelib 2 | -cp ${HAXE_LIBCACHE}/hxjsonast/1.1.0/haxelib/src 3 | -D hxjsonast=1.1.0 -------------------------------------------------------------------------------- /haxe_libraries/hxnodejs.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/HaxeFoundation/hxnodejs#504066dc1ba5ad543afa5f6c3ea019f06136a82b" into hxnodejs/12.1.0/github/504066dc1ba5ad543afa5f6c3ea019f06136a82b 2 | -cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/github/504066dc1ba5ad543afa5f6c3ea019f06136a82b/src 3 | -D hxnodejs=12.1.0 4 | --macro allowPackage('sys') 5 | # should behave like other target defines and not be defined in macro context 6 | --macro define('nodejs') 7 | --macro _internal.SuppressDeprecated.run() 8 | -------------------------------------------------------------------------------- /haxe_libraries/hxparse.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/simn/hxparse#876070ec62a4869de60081f87763e23457a3bda8" into hxparse/4.3.0/github/876070ec62a4869de60081f87763e23457a3bda8 2 | -cp ${HAXE_LIBCACHE}/hxparse/4.3.0/github/876070ec62a4869de60081f87763e23457a3bda8/src 3 | -D hxparse=4.3.0 -------------------------------------------------------------------------------- /haxe_libraries/instrument.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/instrument#1.2.0" into instrument/1.2.0/haxelib 2 | -lib safety 3 | -cp ${HAXE_LIBCACHE}/instrument/1.2.0/haxelib/src 4 | -D instrument=1.2.0 -------------------------------------------------------------------------------- /haxe_libraries/json2object.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/elnabo/json2object#a75859de1e966c09e73591b6c9186086c143fe60" into json2object/3.11.0/github/a75859de1e966c09e73591b6c9186086c143fe60 2 | -lib hxjsonast 3 | -cp ${HAXE_LIBCACHE}/json2object/3.11.0/github/a75859de1e966c09e73591b6c9186086c143fe60/src 4 | -D json2object=3.11.0 -------------------------------------------------------------------------------- /haxe_libraries/safety.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/safety#1.1.2" into safety/1.1.2/haxelib 2 | -cp ${HAXE_LIBCACHE}/safety/1.1.2/haxelib/src 3 | -D safety=1.1.2 -------------------------------------------------------------------------------- /haxe_libraries/test-adapter.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/test-adapter#2.0.7" into test-adapter/2.0.7/haxelib 2 | -lib json2object 3 | -cp ${HAXE_LIBCACHE}/test-adapter/2.0.7/haxelib/ 4 | -D test-adapter=2.0.7 5 | --macro _testadapter.Macro.init() -------------------------------------------------------------------------------- /haxe_libraries/tokentree.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "haxelib:/tokentree#1.2.18" into tokentree/1.2.18/haxelib 2 | -cp ${HAXE_LIBCACHE}/tokentree/1.2.18/haxelib/src 3 | -D tokentree=1.2.18 -------------------------------------------------------------------------------- /haxe_libraries/utest.hxml: -------------------------------------------------------------------------------- 1 | # @install: lix --silent download "gh://github.com/haxe-utest/utest#bdb5fec4b8e77d9a3c079d9cfb108f29f153721a" into utest/2.0.0-alpha/github/bdb5fec4b8e77d9a3c079d9cfb108f29f153721a 2 | -cp ${HAXE_LIBCACHE}/utest/2.0.0-alpha/github/bdb5fec4b8e77d9a3c079d9cfb108f29f153721a/src 3 | -D utest=2.0.0-alpha 4 | --macro utest.utils.Macro.importEnvSettings() 5 | -------------------------------------------------------------------------------- /haxelib.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "formatter", 3 | "url": "https://github.com/HaxeCheckstyle/haxe-formatter", 4 | "license": "MIT", 5 | "tags": [ 6 | "cli", 7 | "formatter", 8 | "style" 9 | ], 10 | "description": "A code formatter for Haxe", 11 | "version": "1.18.0", 12 | "releasenote": "added indentOffset and fixed line break in type parameter constraint - see CHANGELOG for details.", 13 | "contributors": [ 14 | "AlexHaxe", 15 | "Gama11" 16 | ], 17 | "dependencies": {}, 18 | "classPath": "src" 19 | } 20 | -------------------------------------------------------------------------------- /hxformat.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /resources/formatOnSave.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaxeCheckstyle/haxe-formatter/f11169fd7c9ab988554cada3feef68293e6486aa/resources/formatOnSave.gif -------------------------------------------------------------------------------- /resources/schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaxeCheckstyle/haxe-formatter/f11169fd7c9ab988554cada3feef68293e6486aa/resources/schema.png -------------------------------------------------------------------------------- /schema/SchemaGenerator.hx: -------------------------------------------------------------------------------- 1 | import haxe.Json; 2 | import sys.io.File; 3 | import formatter.config.FormatterConfig; 4 | import json2object.utils.JsonSchemaWriter; 5 | 6 | class SchemaGenerator { 7 | static function main() { 8 | var schema = new JsonSchemaWriter().schema; 9 | schema = Json.stringify(Json.parse(schema), "\t"); 10 | File.saveContent("resources/hxformat-schema.json", schema); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/FormatterVersion.hx: -------------------------------------------------------------------------------- 1 | import haxe.Json; 2 | import sys.io.File; 3 | 4 | class FormatterVersion { 5 | macro public static function getFormatterVersion():haxe.macro.Expr.ExprOf { 6 | #if !display 7 | try { 8 | var content:String = File.getContent("haxelib.json"); 9 | var haxelib = Json.parse(content); 10 | var version:String = haxelib.version; 11 | return macro $v{version}; 12 | } catch (e:Any) { 13 | var version:String = "dev"; 14 | return macro $v{version}; 15 | } 16 | #else 17 | var version:String = "dev"; 18 | return macro $v{version}; 19 | #end 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/formatter/codedata/ParseFile.hx: -------------------------------------------------------------------------------- 1 | package formatter.codedata; 2 | 3 | typedef ParseFile = { 4 | var name:String; 5 | var content:Bytes; 6 | @:optional var lineSeparator:String; 7 | } 8 | -------------------------------------------------------------------------------- /src/formatter/codedata/TokenData.hx: -------------------------------------------------------------------------------- 1 | package formatter.codedata; 2 | 3 | typedef TokenData = { 4 | var tokens:Array; 5 | var tokenTree:TokenTree; 6 | } 7 | -------------------------------------------------------------------------------- /src/formatter/codedata/TokenInfo.hx: -------------------------------------------------------------------------------- 1 | package formatter.codedata; 2 | 3 | typedef TokenInfo = { 4 | var token:TokenTree; 5 | var whitespaceAfter:WhitespaceAfterType; 6 | var spacesAfter:Int; 7 | var spacesBefore:Int; 8 | var emptyLinesAfter:Int; 9 | var wrapAfter:Bool; 10 | var text:String; 11 | var additionalIndent:Int; 12 | } 13 | -------------------------------------------------------------------------------- /src/formatter/codedata/WhitespaceAfterType.hx: -------------------------------------------------------------------------------- 1 | package formatter.codedata; 2 | 3 | enum WhitespaceAfterType { 4 | None; 5 | Space; 6 | Newline; 7 | } 8 | -------------------------------------------------------------------------------- /src/formatter/import.hx: -------------------------------------------------------------------------------- 1 | package formatter; 2 | 3 | #if (tokentree && !macro) 4 | import haxe.io.Bytes; 5 | import haxe.macro.Expr; 6 | import byte.ByteData; 7 | import haxeparser.Data; 8 | import tokentree.TokenTree; 9 | import tokentree.TokenTreeAccessHelper; 10 | import tokentree.utils.TokenTreeCheckUtils; 11 | import formatter.codedata.ParsedCode; 12 | import formatter.codedata.TokenInfo; 13 | 14 | using StringTools; 15 | using tokentree.TokenTreeAccessHelper; 16 | using formatter.config.WhitespacePolicy; 17 | #end 18 | -------------------------------------------------------------------------------- /src/formatter/marker/wrapping/WrappableItem.hx: -------------------------------------------------------------------------------- 1 | package formatter.marker.wrapping; 2 | 3 | typedef WrappableItem = { 4 | var first:TokenTree; 5 | var last:TokenTree; 6 | var multiline:Bool; 7 | var firstLineLength:Int; 8 | var lastLineLength:Int; 9 | } 10 | -------------------------------------------------------------------------------- /test.hxml: -------------------------------------------------------------------------------- 1 | -cp src 2 | -cp test 3 | 4 | -lib tokentree 5 | -lib haxeparser 6 | -lib hxparse 7 | -lib json2object 8 | -lib hxargs 9 | -lib utest 10 | -lib test-adapter 11 | 12 | # -D debugLog 13 | # -D debugIndent 14 | # -D detailed_coverage 15 | # -D debugWrapping 16 | -D unittest 17 | -D haxe-next 18 | -x TestMain 19 | 20 | -D UTEST_PRINT_TESTS 21 | 22 | # -D dump=pretty 23 | -------------------------------------------------------------------------------- /test/import.hx: -------------------------------------------------------------------------------- 1 | import utest.Assert; 2 | import utest.ITest; 3 | 4 | using StringTools; 5 | -------------------------------------------------------------------------------- /test/testcases/EmptyLinesTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/emptylines")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class EmptyLinesTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/ExpressionLevelTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/expressionlevel")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class ExpressionLevelTestCases extends GoldBaseTest implements ITest { 6 | public function new() { 7 | super(); 8 | entryPoint = ExpressionLevel; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/testcases/IndentationTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/indentation")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class IndentationTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/LineEndsTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/lineends")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class LineEndsTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/MissingTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/missing")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class MissingTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/Other.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/other")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class Other extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/SameLineTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/sameline")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class SameLineTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/WhitespaceTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/whitespace")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class WhitespaceTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/WrappingTestCases.hx: -------------------------------------------------------------------------------- 1 | package testcases; 2 | 3 | @:build(TestCaseMacro.build("test/testcases/wrapping")) 4 | @:build(utest.utils.TestBuilder.build()) 5 | class WrappingTestCases extends GoldBaseTest implements ITest {} 6 | -------------------------------------------------------------------------------- /test/testcases/emptylines/after_vars_before_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class TokenTree extends Token { 6 | static inline var MAX_LEVEL:Int = 9999; 7 | public var index:Int; 8 | public var inserted:Bool; 9 | #if (!keep_whitespace) 10 | public var space:String; 11 | 12 | #end 13 | public function new() { 14 | } 15 | } 16 | 17 | --- 18 | 19 | class TokenTree extends Token { 20 | static inline var MAX_LEVEL:Int = 9999; 21 | 22 | public var index:Int; 23 | public var inserted:Bool; 24 | #if (!keep_whitespace) 25 | public var space:String; 26 | #end 27 | 28 | public function new() {} 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/emptylines/around_package_0.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines" : { 3 | "beforePackage": 0, 4 | "afterPackage": 0 5 | } 6 | } 7 | 8 | --- 9 | 10 | package formatter.marker; 11 | 12 | import haxe.Int64; 13 | 14 | --- 15 | 16 | package formatter.marker; 17 | import haxe.Int64; 18 | -------------------------------------------------------------------------------- /test/testcases/emptylines/around_package_1.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines" : { 3 | "beforePackage": 1, 4 | "afterPackage": 1 5 | } 6 | } 7 | 8 | --- 9 | 10 | package formatter.marker; 11 | 12 | import haxe.Int64; 13 | 14 | --- 15 | 16 | 17 | package formatter.marker; 18 | 19 | import haxe.Int64; 20 | -------------------------------------------------------------------------------- /test/testcases/emptylines/empty_curly_both_break.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both", 4 | "emptyCurly": "break" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main{} 11 | 12 | class Main { 13 | public function new() {} 14 | } 15 | 16 | --- 17 | 18 | class Main 19 | { 20 | } 21 | 22 | class Main 23 | { 24 | public function new() 25 | { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/emptylines/empty_curly_break.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "emptyCurly": "break" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main{} 10 | 11 | class Main { 12 | public function new() {} 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | } 19 | 20 | class Main { 21 | public function new() { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/emptylines/empty_line_between_var_and_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main{var foo:Int=1;static function main(){}var foo2:Int=1;public function main2(){}} 6 | 7 | --- 8 | 9 | class Main { 10 | var foo:Int = 1; 11 | 12 | static function main() {} 13 | 14 | var foo2:Int = 1; 15 | 16 | public function main2() {} 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/emptylines/end_type_empty_line_with_return_body.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "classEmptyLines": { 4 | "beginType": 1, 5 | "endType": 1 6 | }, 7 | "afterLeftCurly": "keep", 8 | "beforeRightCurly": "keep" 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | function main2() 16 | return ""; 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | 23 | function main2() 24 | return ""; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/emptylines/enum_before_fields.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "afterLeftCurly": "keep", 4 | "beforeRightCurly": "keep", 5 | "enumEmptyLines": { 6 | "beginType": 1, 7 | "endType": 1, 8 | "betweenFields": 1, 9 | "existingBetweenFields": "remove" 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | enum Result { 17 | Success(formattedCode:String); 18 | Failure(errorMessage:String); 19 | Disabled; 20 | } 21 | 22 | --- 23 | 24 | enum Result { 25 | 26 | Success(formattedCode:String); 27 | 28 | Failure(errorMessage:String); 29 | 30 | Disabled; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/testcases/emptylines/enum_fields.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | enum Result { 6 | Success(formattedCode:String); 7 | Failure(errorMessage:String); 8 | Disabled; 9 | } 10 | 11 | --- 12 | 13 | enum Result { 14 | Success(formattedCode:String); 15 | Failure(errorMessage:String); 16 | Disabled; 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_130_lines_between_var_and_prop.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static var _haxelibRepo:Null; 7 | static var haxelibRepo(get, never):Null; 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | static var _haxelibRepo:Null; 14 | static var haxelibRepo(get, never):Null; 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_240_class_empty_lines.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "classEmptyLines": { 4 | "beginType": 1 5 | }, 6 | "afterLeftCurly": "keep" 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | static function main() { 14 | doSomething(""); 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | 22 | static function main() { 23 | doSomething(""); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_292_file_header_comment.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | /* 7 | * Copyright 2018 - etc. 8 | */ 9 | /** 10 | Xml implementation. 11 | **/ 12 | class Main {} 13 | 14 | --- 15 | 16 | /* 17 | * Copyright 2018 - etc. 18 | */ 19 | 20 | /** 21 | Xml implementation. 22 | **/ 23 | class Main {} 24 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_292_file_header_comment_no_empty_line.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "afterFileHeaderComment": 0 4 | } 5 | } 6 | 7 | --- 8 | 9 | /* 10 | * Copyright 2018 - etc. 11 | */ 12 | /** 13 | Xml implementation. 14 | **/ 15 | class Main {} 16 | 17 | --- 18 | 19 | /* 20 | * Copyright 2018 - etc. 21 | */ 22 | /** 23 | Xml implementation. 24 | **/ 25 | class Main {} 26 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_310_one_file_header_comment_with_package.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "afterFileHeaderComment": 1, 4 | "betweenMultilineComments": 1 5 | } 6 | } 7 | 8 | --- 9 | 10 | /* 11 | * Copyright (C)2005-2018 Haxe Foundation 12 | * 13 | * etc 14 | */ 15 | package; 16 | interface IMarker { 17 | } 18 | 19 | --- 20 | 21 | /* 22 | * Copyright (C)2005-2018 Haxe Foundation 23 | * 24 | * etc 25 | */ 26 | 27 | package; 28 | 29 | interface IMarker {} 30 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_310_one_file_header_comment_with_package_and_zero.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "afterFileHeaderComment": 0, 4 | "betweenMultilineComments": 1 5 | } 6 | } 7 | 8 | --- 9 | 10 | /* 11 | * Copyright (C)2005-2018 Haxe Foundation 12 | * 13 | * etc 14 | */ 15 | package; 16 | interface IMarker { 17 | } 18 | 19 | --- 20 | 21 | /* 22 | * Copyright (C)2005-2018 Haxe Foundation 23 | * 24 | * etc 25 | */ 26 | package; 27 | 28 | interface IMarker {} 29 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_322_missing_empty_line_after_conditional.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | #if foo 7 | import Foo; 8 | #end 9 | 10 | class FooBar {} 11 | 12 | --- 13 | 14 | #if foo 15 | import Foo; 16 | #end 17 | 18 | class FooBar {} 19 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_322_missing_empty_line_after_else_conditional.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | #if foo 7 | import Foo; 8 | #else 9 | import Bar; 10 | #end 11 | 12 | class FooBar {} 13 | 14 | --- 15 | 16 | #if foo 17 | import Foo; 18 | #else 19 | import Bar; 20 | #end 21 | 22 | class FooBar {} 23 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_322_missing_empty_line_after_ifelse_conditional.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | #if foo 7 | import Foo; 8 | #elseif bar 9 | import Bar; 10 | #end 11 | 12 | class FooBar {} 13 | 14 | --- 15 | 16 | #if foo 17 | import Foo; 18 | #elseif bar 19 | import Bar; 20 | #end 21 | 22 | class FooBar {} 23 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_368_multiline_string_literals.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | it("part1", { 9 | run(parse(" 10 | 11 | ")).should.be(3); 12 | }); 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | it("part1", { 21 | run(parse(" 22 | 23 | ")).should.be(3); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_377_macro_classes.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | macro class { 9 | var foo:Int; 10 | function bar() { 11 | trace("bar"); 12 | } 13 | function foobar() { 14 | trace("foobar"); 15 | } 16 | } 17 | } 18 | } 19 | 20 | --- 21 | 22 | class Main { 23 | static function main() { 24 | macro class { 25 | var foo:Int; 26 | 27 | function bar() { 28 | trace("bar"); 29 | } 30 | 31 | function foobar() { 32 | trace("foobar"); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_378_metadata_using_import_package.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | @:using(Tools) 7 | class Foo {} 8 | 9 | @:using 10 | class Foo {} 11 | 12 | @:package 13 | class Foo {} 14 | 15 | @:import 16 | class Foo { 17 | @:private var foo; 18 | } 19 | 20 | 21 | 22 | --- 23 | 24 | @:using(Tools) 25 | class Foo {} 26 | 27 | @:using 28 | class Foo {} 29 | 30 | @:package 31 | class Foo {} 32 | 33 | @:import 34 | class Foo { 35 | @:private var foo; 36 | } 37 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_384_macro_classes_with_metadata.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | macro class { 9 | var foo:Int; 10 | 11 | @Test 12 | 13 | function foobar() {} 14 | 15 | 16 | @Test 17 | function foobar() {} 18 | } 19 | } 20 | } 21 | 22 | --- 23 | 24 | class Main { 25 | static function main() { 26 | macro class { 27 | var foo:Int; 28 | 29 | @Test 30 | function foobar() {} 31 | 32 | @Test 33 | function foobar() {} 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_428_doc_comments_vs_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | #if foo 8 | /** docs **/ 9 | var foo:Int; 10 | #end 11 | 12 | var foo:Int; 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | #if foo 19 | /** docs **/ 20 | var foo:Int; 21 | #end 22 | 23 | var foo:Int; 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_49_imports_with_conditional.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if !macro 6 | import haxeLanguageServer.helper.DisplayOffsetConverter; 7 | #end 8 | 9 | --- 10 | 11 | #if !macro 12 | import haxeLanguageServer.helper.DisplayOffsetConverter; 13 | #end 14 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_4_no_empty_line_before_sharp_end.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if macro 6 | 7 | class Main { 8 | 9 | static function main() {} 10 | 11 | } 12 | 13 | #end 14 | 15 | --- 16 | 17 | #if macro 18 | class Main { 19 | static function main() {} 20 | } 21 | #end 22 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_4_no_empty_line_before_sharp_end_2.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if macro 6 | 7 | class Main { 8 | 9 | static function main() {} 10 | 11 | } 12 | 13 | #end 14 | 15 | class Main2 { 16 | 17 | static function main() {} 18 | 19 | } 20 | 21 | --- 22 | 23 | #if macro 24 | class Main { 25 | static function main() {} 26 | } 27 | #end 28 | 29 | class Main2 { 30 | static function main() {} 31 | } 32 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_511_block_level_doc_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | 8 | /** test **/ 9 | foo(); 10 | bar(); 11 | 12 | /** test **/ 13 | 14 | foo(); 15 | 16 | bar(); 17 | 18 | /** test **/ 19 | 20 | } 21 | } 22 | 23 | --- 24 | 25 | class Main { 26 | static function main() { 27 | /** test **/ 28 | foo(); 29 | bar(); 30 | 31 | /** test **/ 32 | 33 | foo(); 34 | 35 | bar(); 36 | 37 | /** test **/ 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_52_between_types_with_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if foo 6 | 7 | typedef Foo = String; 8 | 9 | #else 10 | 11 | typedef Bar = Int; 12 | 13 | #end 14 | 15 | --- 16 | 17 | #if foo 18 | typedef Foo = String; 19 | #else 20 | typedef Bar = Int; 21 | #end 22 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_52_between_types_with_nested_conditional.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if macro 6 | import haxe.macro.Expr; 7 | 8 | #if (haxe_ver < 4.0) 9 | typedef ObjectDeclField = { 10 | var field:String; 11 | var expr:Expr; 12 | } 13 | 14 | #else 15 | typedef ObjectDeclField = haxe.macro.ObjectField; 16 | #end 17 | #end 18 | 19 | --- 20 | 21 | #if macro 22 | import haxe.macro.Expr; 23 | 24 | #if (haxe_ver < 4.0) 25 | typedef ObjectDeclField = { 26 | var field:String; 27 | var expr:Expr; 28 | } 29 | #else 30 | typedef ObjectDeclField = haxe.macro.ObjectField; 31 | #end 32 | #end 33 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_5_final_lineend.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main{final foo:Int=1;final static function main():{final x:Int, y:Int}{}} 6 | 7 | --- 8 | 9 | class Main { 10 | final foo:Int = 1; 11 | 12 | final static function main():{final x:Int, y:Int} {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_644_keep_empty_lines_in_anon_function.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Foo { 7 | var a = function() { 8 | 1; 9 | 10 | 2; 11 | } 12 | } 13 | 14 | var b = function() { 15 | 1; 16 | 17 | 2; 18 | } 19 | 20 | final a = function() { 21 | 1; 22 | 23 | 1; 24 | } 25 | 26 | --- 27 | 28 | class Foo { 29 | var a = function() { 30 | 1; 31 | 32 | 2; 33 | } 34 | } 35 | 36 | var b = function() { 37 | 1; 38 | 39 | 2; 40 | } 41 | 42 | final a = function() { 43 | 1; 44 | 45 | 1; 46 | } 47 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_65_extern_class.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | extern class Foo { 6 | var foo:Int; 7 | var bar:Int; 8 | function new():Void; 9 | function foo():Void; 10 | } 11 | 12 | --- 13 | 14 | extern class Foo { 15 | var foo:Int; 16 | var bar:Int; 17 | function new():Void; 18 | function foo():Void; 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_66_interface.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | interface Foo extends Bar { 6 | var foo:Int; 7 | var bar:Int; 8 | function new():Void; 9 | function foo():Void; 10 | } 11 | 12 | --- 13 | 14 | interface Foo extends Bar { 15 | var foo:Int; 16 | var bar:Int; 17 | function new():Void; 18 | function foo():Void; 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_6_keep_empty_lines_after_bropen.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines":{ 3 | "afterLeftCurly": "keep" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | 12 | if (false) { 13 | 14 | trace(""); 15 | trace(""); 16 | 17 | trace(""); 18 | trace(""); 19 | 20 | } 21 | 22 | } 23 | } 24 | 25 | --- 26 | 27 | class Main { 28 | static function main() { 29 | 30 | if (false) { 31 | 32 | trace(""); 33 | trace(""); 34 | 35 | trace(""); 36 | trace(""); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_6_keep_empty_lines_before_bropen.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines":{ 3 | "beforeRightCurly": "keep" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | 12 | if (false) { 13 | 14 | trace(""); 15 | trace(""); 16 | 17 | trace(""); 18 | trace(""); 19 | 20 | } 21 | 22 | } 23 | } 24 | 25 | --- 26 | 27 | class Main { 28 | static function main() { 29 | if (false) { 30 | trace(""); 31 | trace(""); 32 | 33 | trace(""); 34 | trace(""); 35 | 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_6_no_empty_lines_after_bropen.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | 8 | if (false) { 9 | 10 | trace(""); 11 | trace(""); 12 | 13 | trace(""); 14 | trace(""); 15 | 16 | } 17 | 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | static function main() { 25 | if (false) { 26 | trace(""); 27 | trace(""); 28 | 29 | trace(""); 30 | trace(""); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_85_after_last_import_with_sharp.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if macro 6 | import StringTools; 7 | #end 8 | 9 | class Main{} 10 | 11 | --- 12 | 13 | #if macro 14 | import StringTools; 15 | #end 16 | 17 | class Main {} 18 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_85_before_using_after_sharp.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if macro 6 | import StringTools; 7 | #end 8 | 9 | using StringTools; 10 | 11 | --- 12 | 13 | #if macro 14 | import StringTools; 15 | #end 16 | 17 | using StringTools; 18 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_91_class_fields_vars_props.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | private class CancellationTokenImpl { 6 | public var canceled(default,null):Bool; 7 | public var callback:Void->Void; 8 | } 9 | 10 | --- 11 | 12 | private class CancellationTokenImpl { 13 | public var canceled(default, null):Bool; 14 | public var callback:Void->Void; 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/emptylines/issue_98_before_doc_comments_with_final.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Color = { 6 | /** 7 | The red component of this color in the range [0-1]. 8 | **/ 9 | final red:Float; 10 | 11 | /** 12 | * The green component of this color in the range [0-1]. 13 | */ 14 | final green:Float; 15 | } 16 | 17 | --- 18 | 19 | typedef Color = { 20 | /** 21 | The red component of this color in the range [0-1]. 22 | **/ 23 | final red:Float; 24 | 25 | /** 26 | * The green component of this color in the range [0-1]. 27 | */ 28 | final green:Float; 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/emptylines/line_comments_between_types.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | //class Main { 7 | class Main {} 8 | 9 | //class Main { 10 | typedef Main = String; 11 | //class Main { 12 | 13 | class Main {} 14 | 15 | //class Main { 16 | //} 17 | typedef Main = String; 18 | //class Main { 19 | //} 20 | 21 | --- 22 | 23 | // class Main { 24 | class Main {} 25 | 26 | // class Main { 27 | typedef Main = String; 28 | 29 | // class Main { 30 | 31 | class Main {} 32 | 33 | // class Main { 34 | // } 35 | typedef Main = String; 36 | 37 | // class Main { 38 | // } 39 | -------------------------------------------------------------------------------- /test/testcases/emptylines/line_comments_between_types_no_emptyline.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines" : { 3 | "lineCommentsBetweenTypes" : "none" 4 | } 5 | } 6 | 7 | --- 8 | 9 | // class Main { 10 | // } 11 | class Main {} 12 | 13 | // class Main { 14 | // } 15 | typedef Main = String; 16 | // class Main { 17 | // } 18 | 19 | --- 20 | 21 | // class Main { 22 | // } 23 | class Main {} 24 | 25 | // class Main { 26 | // } 27 | typedef Main = String; 28 | 29 | // class Main { 30 | // } 31 | -------------------------------------------------------------------------------- /test/testcases/emptylines/max_anywhere_in_file.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "maxAnywhereInFile":1, 4 | "betweenTypes":2 5 | } 6 | } 7 | 8 | --- 9 | 10 | typedef Color = { 11 | var green:Float; 12 | } 13 | 14 | typedef ConditionalEmptyLinesConfig = { 15 | @:default(0) @:optional var afterError:Int; 16 | } 17 | 18 | --- 19 | 20 | typedef Color = { 21 | var green:Float; 22 | } 23 | 24 | typedef ConditionalEmptyLinesConfig = { 25 | @:default(0) @:optional var afterError:Int; 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/expressionlevel/issue_450_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | {foo: bar} 6 | 7 | --- 8 | 9 | {foo: bar} 10 | -------------------------------------------------------------------------------- /test/testcases/formatrange/before_multiline_comment_and_beyond.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | >[ var startPos:Int; 8 | * comment 9 | */ 10 | typedef FormatterInputRange = { 11 | var startPos:Int; 12 | var endPos:Int;]< 13 | } 14 | 15 | --- 16 | 17 | var startPos:Int; 18 | * comment 19 | */ 20 | typedef FormatterInputRange = { 21 | var startPos:Int; 22 | var endPos:Int; -------------------------------------------------------------------------------- /test/testcases/formatrange/before_multiline_comment_with_star.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | >[ var startPos:Int;]< 8 | * comment 9 | */ 10 | typedef FormatterInputRange = { 11 | var startPos:Int; 12 | var endPos:Int; 13 | } 14 | 15 | --- 16 | 17 | var startPos:Int; -------------------------------------------------------------------------------- /test/testcases/formatrange/end_in_multiline_string.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public function new () 7 | { 8 | >[ trace ("test"); 9 | } 10 | var text:String = " 11 | var fileName:String; 12 | var content:Bytes; 13 | ]< var content2:Bytes; 14 | @:optional var tokenList:Array; 15 | "; 16 | } 17 | 18 | --- 19 | 20 | trace("test"); 21 | } 22 | 23 | var text:String = " 24 | var fileName:String; 25 | var content:Bytes; 26 | -------------------------------------------------------------------------------- /test/testcases/formatrange/fullLine.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | typedef FormatterInputData = { 7 | var fileName:String; 8 | var content:Bytes; 9 | @:optional var tokenList:Array; 10 | >[ @:optional var tokenTree:TokenTree; 11 | ]< var config:Config; 12 | @:optional var entryPoint:TokenTreeEntryPoint; 13 | @:optional var lineSeparator:String; 14 | @:optional var range:FormatterInputRange; 15 | } 16 | 17 | typedef FormatterInputRange = { 18 | var startPos:Int; 19 | var endPos:Int; 20 | } 21 | 22 | 23 | 24 | --- 25 | 26 | @:optional var tokenTree:TokenTree; 27 | -------------------------------------------------------------------------------- /test/testcases/formatrange/multiline_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | comment 8 | >[ var startPos:Int;]< 9 | */ 10 | typedef FormatterInputRange = { 11 | var startPos:Int; 12 | var endPos:Int; 13 | } 14 | 15 | --- 16 | 17 | var startPos:Int; -------------------------------------------------------------------------------- /test/testcases/formatrange/multiline_comment_at_start.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | >[ var startPos:Int;]< 8 | comment 9 | */ 10 | typedef FormatterInputRange = { 11 | var startPos:Int; 12 | var endPos:Int; 13 | } 14 | 15 | --- 16 | 17 | var startPos:Int; -------------------------------------------------------------------------------- /test/testcases/formatrange/multiline_comment_mixed_indentation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | comment 8 | comment 9 | comment 10 | comment 11 | comment 12 | >[ var startPos:Int; 13 | ]< */ 14 | typedef FormatterInputRange = { 15 | var startPos:Int; 16 | var endPos:Int; 17 | } 18 | 19 | --- 20 | 21 | var startPos:Int; 22 | -------------------------------------------------------------------------------- /test/testcases/formatrange/multiline_comment_with_star.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | * comment 8 | >[ var startPos:Int;]< 9 | */ 10 | typedef FormatterInputRange = { 11 | var startPos:Int; 12 | var endPos:Int; 13 | } 14 | 15 | --- 16 | 17 | var startPos:Int; -------------------------------------------------------------------------------- /test/testcases/formatrange/multiline_comment_with_star_add_star_line.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | * comment 8 | >[* var startPos:Int; 9 | ]< */ 10 | typedef FormatterInputRange = { 11 | var startPos:Int; 12 | var endPos:Int; 13 | } 14 | 15 | --- 16 | 17 | * var startPos:Int; 18 | -------------------------------------------------------------------------------- /test/testcases/formatrange/multiline_string.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | var text:String = " 7 | var fileName:String; 8 | var content:Bytes; 9 | >[ var content2:Bytes; 10 | ]< @:optional var tokenList:Array; 11 | "; 12 | } 13 | 14 | --- 15 | 16 | var content2:Bytes; 17 | -------------------------------------------------------------------------------- /test/testcases/formatrange/singleLine.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | typedef FormatterInputData = { 7 | var fileName:String; 8 | var content:Bytes; 9 | @:optional var tokenList:Array; 10 | >[ @:optional var tokenTree:TokenTree;]< 11 | var config:Config; 12 | @:optional var entryPoint:TokenTreeEntryPoint; 13 | @:optional var lineSeparator:String; 14 | @:optional var range:FormatterInputRange; 15 | } 16 | 17 | typedef FormatterInputRange = { 18 | var startPos:Int; 19 | var endPos:Int; 20 | } 21 | 22 | 23 | 24 | --- 25 | 26 | @:optional var tokenTree:TokenTree; -------------------------------------------------------------------------------- /test/testcases/formatrange/start_in_multiline_string.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | var text:String = " 7 | var fileName:String; 8 | var content:Bytes; 9 | >[ var content2:Bytes; 10 | @:optional var tokenList:Array; 11 | "; 12 | public function new () 13 | { 14 | trace ("test"]<); 15 | } 16 | } 17 | 18 | --- 19 | 20 | var content2:Bytes; 21 | @:optional var tokenList:Array; 22 | "; 23 | 24 | public function new() { 25 | trace("test" -------------------------------------------------------------------------------- /test/testcases/formatrange/two_multiline_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | comment 8 | >[ var startPos:Int; 9 | */ 10 | Class Main { 11 | var startPos:Int; 12 | var endPos:Int; 13 | /** 14 | var startPos:Int; 15 | var endPos:Int; 16 | ]< 17 | */ 18 | public function new(){ 19 | } 20 | } 21 | 22 | --- 23 | 24 | var startPos:Int; 25 | */ 26 | Class Main { 27 | var startPos:Int; 28 | var endPos:Int; 29 | 30 | /** 31 | var startPos:Int; 32 | var endPos:Int; 33 | -------------------------------------------------------------------------------- /test/testcases/formatrange/two_multiline_comments_with_star.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | /** 7 | * comment 8 | >[* var startPos:Int; 9 | */ 10 | Class Main { 11 | var startPos:Int; 12 | var endPos:Int; 13 | /** 14 | * var startPos:Int; 15 | * var endPos:Int;]< 16 | */ 17 | public function new(){ 18 | } 19 | } 20 | 21 | --- 22 | 23 | * var startPos:Int; 24 | */ 25 | Class Main { 26 | var startPos:Int; 27 | var endPos:Int; 28 | 29 | /** 30 | * var startPos:Int; 31 | * var endPos:Int; -------------------------------------------------------------------------------- /test/testcases/indentation/constructor_body.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public function new() { 7 | super(); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public function new() { 15 | super(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/indentation/constructor_body_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public function new() { 11 | super(); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main 18 | { 19 | public function new() 20 | { 21 | super(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/indentation/indent_typedef.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef ParseFile = {var name:String; 6 | var content:ByteData;} 7 | 8 | --- 9 | 10 | typedef ParseFile = { 11 | var name:String; 12 | var content:ByteData; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/indentation/indent_with_curly_on_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both", 4 | "atVar": "after" 5 | }, 6 | "sameLine": { 7 | "ifElse": "next", 8 | "ifBody": "next", 9 | "elseBody": "next", 10 | "caseBody": "same" 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | static function main() { 18 | if (false){ trace("");} 19 | } 20 | } 21 | 22 | --- 23 | 24 | class Main 25 | { 26 | static function main() 27 | { 28 | if (false) 29 | { 30 | trace(""); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/testcases/indentation/indentation_of_properties.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public var file(default, null):ParseFile; 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | public var file(default, null):ParseFile; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_10_indent_anon_function_call.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | trace(function() { 8 | trace(""); 9 | }); 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main() { 17 | trace(function() { 18 | trace(""); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_118_indenter_npe_with_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Serializer { 6 | function serializeRef(v:Dynamic) { 7 | #if js 8 | if( js.Syntax.typeof(ci) == vt && ci == v ) { 9 | #else 10 | if( cache[i] == v ) { 11 | #end 12 | } 13 | } 14 | 15 | function serializeFields(v:{}) {} 16 | } 17 | 18 | --- 19 | 20 | class Serializer { 21 | function serializeRef(v:Dynamic) { 22 | #if js 23 | if (js.Syntax.typeof(ci) == vt && ci == v) { 24 | #else 25 | if (cache[i] == v) { 26 | #end 27 | } 28 | } 29 | 30 | function serializeFields(v:{}) {} 31 | } 32 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_128_multiple_arrow_functions.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function readClassPaths() { 7 | context.callHaxeMethod(_ -> { 8 | stopProgress(); 9 | }, error -> { 10 | stopProgress(); 11 | }); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | function readClassPaths() { 19 | context.callHaxeMethod(_ -> { 20 | stopProgress(); 21 | }, error -> { 22 | stopProgress(); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_129_macro_block.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | macro { 8 | if ($struct == null) { 9 | $struct = $defaults; 10 | } else { 11 | $b{generateAssignments(fields, struct, defaults)}; 12 | } 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | macro { 22 | if ($struct == null) { 23 | $struct = $defaults; 24 | } else { 25 | $b{generateAssignments(fields, struct, defaults)}; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_139_unstable_multiline_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Metadata = { 6 | var name:String; 7 | var doc:JsonDoc; 8 | /* var parameters:Array; 9 | var platforms:Array; 10 | var target:Array; */ 11 | } 12 | 13 | --- 14 | 15 | typedef Metadata = { 16 | var name:String; 17 | var doc:JsonDoc; 18 | /* var parameters:Array; 19 | var platforms:Array; 20 | var target:Array; */ 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_13_dont_add_whitespace_in_doc_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | /** 7 | 8 | **/ 9 | static public function main() {} 10 | /* 11 | 12 | */ 13 | static public function main() {} 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | /** 20 | 21 | **/ 22 | static public function main() {} 23 | 24 | /* 25 | 26 | */ 27 | static public function main() {} 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_144_switch_braceless_if.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | if (true) 8 | switch (foo) { 9 | case bar: 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | if (true) 19 | switch (foo) { 20 | case bar: 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_168_object_literal_in_array_comprehension.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var expectedEdits = [for (usage in markedUsages) { 8 | range: usage, 9 | newText: newName 10 | } 11 | ]; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | var expectedEdits = [ 20 | for (usage in markedUsages) 21 | { 22 | range: usage, 23 | newText: newName 24 | } 25 | ]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_16_blocks_within_blocks.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static public function main() { 7 | { 8 | trace(""); 9 | } 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static public function main() { 17 | { 18 | trace(""); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_170_additional_indentation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function handleJsonRpc(params:TextDocumentPositionParams, token:CancellationToken, resolve:Definition->Void, reject:ResponseError->Void, 7 | doc:TextDocument, offset:Int) { 8 | call(); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | function handleJsonRpc(params:TextDocumentPositionParams, token:CancellationToken, resolve:Definition->Void, reject:ResponseError->Void, 16 | doc:TextDocument, offset:Int) { 17 | call(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_177_switch_indentation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main 6 | { 7 | public static function main() 8 | { 9 | switch (stage.window.context.type) 10 | { 11 | case OPENGL, OPENGLES, WEBGL: 12 | DRAW_TILES; 13 | default: 14 | BLITTING; 15 | } 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | public static function main() { 23 | switch (stage.window.context.type) { 24 | case OPENGL, OPENGLES, WEBGL: 25 | DRAW_TILES; 26 | default: 27 | BLITTING; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_221_indentation_of_prefix_increment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | ansIds[ansi] = cids[ci]; 8 | ++ci; 9 | do a++ while (true); 10 | do ++a while (true); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | ansIds[ansi] = cids[ci]; 19 | ++ci; 20 | do 21 | a++ while (true); 22 | do 23 | ++a while (true); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_237_comment_in_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main():Void { 7 | func({ // comment 8 | foo: 1 9 | }); 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main():Void { 17 | func({ // comment 18 | foo: 1 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_290_block_breaking_conditional.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | #if defined 9 | if (true) { 10 | #else 11 | if (false) { 12 | #end 13 | doSomething(""); 14 | } 15 | } 16 | static function main() {} 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | static function main() { 23 | #if defined 24 | if (true) { 25 | #else 26 | if (false) { 27 | #end 28 | doSomething(""); 29 | } 30 | } 31 | 32 | static function main() {} 33 | } 34 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_290_block_breaking_conditional_2.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | #if defined 9 | if (true) { 10 | trace("foo"); 11 | #end 12 | doSomething(""); 13 | #if defined 14 | } 15 | #end 16 | } 17 | static function main() {} 18 | } 19 | 20 | --- 21 | 22 | class Main { 23 | static function main() { 24 | #if defined 25 | if (true) { 26 | trace("foo"); 27 | #end 28 | doSomething(""); 29 | #if defined 30 | } 31 | #end 32 | } 33 | 34 | static function main() {} 35 | } 36 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_315_anon_function_call.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | context.subscriptions.push(Vscode.commands.registerCommand("hellohaxe.sayHello", function() { 9 | Vscode.window.showInformationMessage("Hello from Haxe!"); 10 | })); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | static function main() { 18 | context.subscriptions.push(Vscode.commands.registerCommand("hellohaxe.sayHello", function() { 19 | Vscode.window.showInformationMessage("Hello from Haxe!"); 20 | })); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_326_untyped_assignment.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | (untyped foo).bar = function() { 9 | trace(); 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | (untyped foo).bar = function() { 19 | trace(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_3_increasing_indent_in_doc_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | /** 7 | [Description] 8 | **/ 9 | static function main() {} 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | /** 16 | [Description] 17 | **/ 18 | static function main() {} 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_452_braceless_function_with_switch.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public function connect():Void 7 | (switch handlers[name] { 8 | case null: handlers[name] = []; 9 | case v: v; 10 | }).push({target: target, method: method}); 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | public function connect():Void 17 | (switch handlers[name] { 18 | case null: handlers[name] = []; 19 | case v: v; 20 | }).push({target: target, method: method}); 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_464_double_indentation.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | env.clipboard.writeText(if (element == null) { 9 | methods.map(method -> method.toString()).join("\n\n"); 10 | } else { 11 | element.toString(); 12 | }); 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | env.clipboard.writeText(if (element == null) { 21 | methods.map(method -> method.toString()).join("\n\n"); 22 | } else { 23 | element.toString(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_465_return_if.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | return if (client != null) { 9 | client.sendRequest(method, params); 10 | } else { 11 | Promise.reject("client not initialized"); 12 | } 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | return if (client != null) { 21 | client.sendRequest(method, params); 22 | } else { 23 | Promise.reject("client not initialized"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_468_return_if_else.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | return if (foo) { 9 | foo; 10 | } else if (bar) { 11 | bar; 12 | } else { 13 | foobar; 14 | } 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | static function main() { 22 | return if (foo) { 23 | foo; 24 | } else if (bar) { 25 | bar; 26 | } else { 27 | foobar; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_470_method_chains.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | var p = Promise.all().then(function(r) { 9 | Assert.notNull(r); 10 | done(); 11 | }).catchError(function(e) { 12 | trace(e); 13 | done(); 14 | }); 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | static function main() { 22 | var p = Promise.all().then(function(r) { 23 | Assert.notNull(r); 24 | done(); 25 | }).catchError(function(e) { 26 | trace(e); 27 | done(); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_476_var_assignment.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Foo { 7 | private static var __pool:ObjectPool = new ObjectPool(function() return new AsyncErrorEvent(null), function(event) event.__init()); 8 | } 9 | 10 | --- 11 | 12 | class Foo { 13 | private static var __pool:ObjectPool = new ObjectPool(function() return new AsyncErrorEvent(null), 14 | function(event) event.__init()); 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_478_indent_case.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "indentation": { 3 | "indentCaseLabels": false 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | switch haxe.ds.Option.None { 12 | case Some(v): 13 | trace("Foo"); 14 | default: 15 | trace("Bar"); 16 | } 17 | } 18 | } 19 | 20 | --- 21 | 22 | class Main { 23 | static function main() { 24 | switch haxe.ds.Option.None { 25 | case Some(v): 26 | trace("Foo"); 27 | default: 28 | trace("Bar"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_490_nested_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "objectLiteralCurly": { 4 | "leftCurly": "both" 5 | } 6 | }, 7 | "indentation": { 8 | "indentObjectLiteral": false 9 | } 10 | } 11 | 12 | --- 13 | 14 | private var user:User = { 15 | Address: { 16 | Street: "" 17 | } 18 | } 19 | 20 | --- 21 | 22 | private var user:User = 23 | { 24 | Address: 25 | { 26 | Street: "" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_490_nested_object_literal_indent.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "objectLiteralCurly": { 4 | "leftCurly": "both" 5 | } 6 | }, 7 | "indentation": { 8 | "indentObjectLiteral": true 9 | } 10 | } 11 | 12 | --- 13 | 14 | private var user:User = { 15 | Address: { 16 | Street: "" 17 | } 18 | } 19 | 20 | --- 21 | 22 | private var user:User = 23 | { 24 | Address: 25 | { 26 | Street: "" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_499_conditional_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | #if true 7 | function foo() { 8 | #else 9 | function foo() { 10 | #end 11 | } 12 | 13 | /** 14 | Doc. 15 | **/ 16 | public static function bar():Void {} 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | #if true 23 | function foo() { 24 | #else 25 | function foo() { 26 | #end 27 | } 28 | 29 | /** 30 | Doc. 31 | **/ 32 | public static function bar():Void {} 33 | } 34 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_51_adjust_comment_indentation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | /** 7 | Description 8 | - point A 9 | - point B 10 | **/ 11 | static public function main() {} 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | /** 18 | Description 19 | - point A 20 | - point B 21 | **/ 22 | static public function main() {} 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_557_anon_struct_with_assignment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | var example:{ 8 | function test():Void; 9 | } = { 10 | test: function test():Void {} 11 | }; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | var example:{ 20 | function test():Void; 21 | } = { 22 | test: function test():Void {} 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_611_var_with_local_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | var foo:Array = { 7 | function bar() {} 8 | [1, 2, 3]; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | var foo:Array = { 16 | function bar() {} 17 | [1, 2, 3]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_618_macro_if.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | macro if ($i{name} != null) 8 | $e 9 | else 10 | 1; 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | macro if ($i{name} != null) 19 | $e 20 | else 21 | 1; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_629_type_check_after_block.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | function main() { 6 | if (true) {} 7 | (f : Dynamic).foo = true; 8 | } 9 | 10 | --- 11 | 12 | function main() { 13 | if (true) {} 14 | (f : Dynamic).foo = true; 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_646_trailing_whitespace.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "indentation": { 3 | "trailingWhitespace": true 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | trace(1); 12 | 13 | trace(2); 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | static function main() { 21 | trace(1); 22 | 23 | trace(2); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_646_trailing_whitespace_false.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "indentation": { 3 | "trailingWhitespace": false 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | trace(1); 12 | 13 | trace(2); 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | static function main() { 21 | trace(1); 22 | 23 | trace(2); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_74_typedef_indentation_with_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Package = { 6 | var path:JsonPackagePath; 7 | // var ?contents:Array<{name:String, kind:PackageContentKind}>; 8 | } 9 | 10 | typedef Module = { 11 | var path:JsonModulePath; 12 | } 13 | 14 | --- 15 | 16 | typedef Package = { 17 | var path:JsonPackagePath; 18 | // var ?contents:Array<{name:String, kind:PackageContentKind}>; 19 | } 20 | 21 | typedef Module = { 22 | var path:JsonModulePath; 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_77_array_wrapping_indent.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | class Main { 7 | function main() { 8 | return [{one: two, three: four, five: six, seven: eight}]; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | function main() { 16 | return [ 17 | { 18 | one: two, 19 | three: four, 20 | five: six, 21 | seven: eight 22 | } 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_78_single_array_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | class Main { 7 | static function main() { 8 | []; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | []; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_8_incorrect_if_indentation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | if (false) trace(""); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | if (false) 16 | trace(""); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/indentation/issue_90_indentation_after_var.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef FoldingRangeServerCapabilities = { 6 | var ?foldingRangeProvider:EitherType>; 7 | } 8 | 9 | --- 10 | 11 | typedef FoldingRangeServerCapabilities = { 12 | var ?foldingRangeProvider:EitherType>; 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/indentation/properties_In_anon_types.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main 6 | { 7 | var storage:{ 8 | var language(default, never):State; 9 | var collapsed(default, never):State; 10 | var height(default, never):State; 11 | var fontSize(default, never):State; 12 | }; 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | var storage:{ 19 | var language(default, never):State; 20 | var collapsed(default, never):State; 21 | var height(default, never):State; 22 | var fontSize(default, never):State; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/indentation/typedef_with_curly_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | }, 5 | "sameLine": { 6 | "tryBody": "next", 7 | "catchBody": "next", 8 | "tryCatch": "next" 9 | } 10 | } 11 | 12 | --- 13 | 14 | typedef Test = { 15 | var name:String; 16 | var id:Int64; 17 | } 18 | 19 | --- 20 | 21 | typedef Test = 22 | { 23 | var name:String; 24 | var id:Int64; 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/lineends/abstract_class.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract class Foo { 6 | abstract function foo(); 7 | public abstract function foo2(); 8 | public function foo3(); 9 | } 10 | 11 | --- 12 | 13 | abstract class Foo { 14 | abstract function foo(); 15 | 16 | public abstract function foo2(); 17 | 18 | public function foo3(); 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/lineends/comments_after_if.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main{ 6 | function main(){ 7 | if (true) // foo 8 | return; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | function main() { 16 | if (true) // foo 17 | return; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/lineends/comments_after_single_line_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | public function put() {} // foo 6 | 7 | 8 | --- 9 | 10 | public function put() {} // foo 11 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_107_inline_sharp.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | #if !cppia inline #end function addChar(c:Int):Void {} 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | #if !cppia inline #end function addChar(c:Int):Void {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_151_dynamic_modifier.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public dynamic function logError(message:String):Void {} 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | public dynamic function logError(message:String):Void {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_158_anon_function_in_nested_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | { 8 | "outer": { 9 | foo: function() { 10 | trace("bar"); 11 | } 12 | } 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | { 22 | "outer": { 23 | foo: function() { 24 | trace("bar"); 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_15_no_linebreaks_in_empty_structure.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main 6 | { 7 | static public function main() 8 | { 9 | var s: 10 | { 11 | 12 | }; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static public function main() { 20 | var s:{}; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_176_curly_after_type_param.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class FlxBounds { 6 | // foo 7 | } 8 | 9 | class Main 10 | { 11 | function get_cameras():Array 12 | { 13 | call(); 14 | } 15 | } 16 | 17 | --- 18 | 19 | class FlxBounds { 20 | // foo 21 | } 22 | 23 | class Main { 24 | function get_cameras():Array { 25 | call(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_176_curly_after_type_param_both.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class FlxBounds { 10 | // foo 11 | } 12 | 13 | class Main 14 | { 15 | function get_cameras():Array 16 | { 17 | call(); 18 | } 19 | } 20 | 21 | --- 22 | 23 | class FlxBounds 24 | { 25 | // foo 26 | } 27 | 28 | class Main 29 | { 30 | function get_cameras():Array 31 | { 32 | call(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_17_lineend_aftersharp_error.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if js #error "js is defined" #elseif php #else #end 6 | 7 | #if js trace("js is defined"); #elseif php #else #end 8 | 9 | #if js 10 | #error "js is defined" 11 | #elseif php 12 | #else 13 | #end 14 | 15 | 16 | --- 17 | 18 | #if js #error "js is defined" #elseif php #else #end 19 | #if js trace("js is defined"); #elseif php #else #end 20 | #if js 21 | #error "js is defined" 22 | #elseif php 23 | #else 24 | #end 25 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_198_call_on_anon_functions.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | kvs(map).each(function(l, r) { 8 | map1.set(l, r); 9 | }.tupled()); 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | public static function main() { 17 | kvs(map).each(function(l, r) { 18 | map1.set(l, r); 19 | }.tupled()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_213_linebreak_in_function_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | var copy:Uri->Uri->{overwrite:Bool}->EitherType>; 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | var copy:Uri->Uri->{overwrite:Bool}->EitherType>; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_215_macro_with_dollar_block.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | macro { $e0; ${loop(el)}}; 8 | macro { 9 | $e0; 10 | ${loop(el)}}; 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | macro {$e0; ${loop(el)}}; 19 | macro { 20 | $e0; 21 | ${loop(el)} 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_216_typedef_without_semicolon_unstable_comments.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "afterFieldsWithDocComments": "ignore" 4 | } 5 | } 6 | 7 | 8 | --- 9 | 10 | typedef Foo = Int 11 | 12 | /** Docs for Bar **/ 13 | typedef Bar = Float 14 | 15 | typedef Foo = Int; 16 | 17 | /** Docs for Bar **/ 18 | typedef Bar = Float 19 | 20 | 21 | --- 22 | 23 | typedef Foo = Int 24 | 25 | /** Docs for Bar **/ 26 | typedef Bar = Float 27 | typedef Foo = Int; 28 | 29 | /** Docs for Bar **/ 30 | typedef Bar = Float 31 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_216_typedef_without_semicolon_unstable_comments_empty_lines.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines":{ 3 | "betweenSingleLineTypes": 1 4 | } 5 | } 6 | 7 | --- 8 | 9 | typedef Foo = Int 10 | 11 | /** Docs for Bar **/ 12 | typedef Bar = Float 13 | 14 | typedef Foo = Int; 15 | 16 | /** Docs for Bar **/ 17 | typedef Bar = Float 18 | 19 | 20 | --- 21 | 22 | typedef Foo = Int 23 | 24 | /** Docs for Bar **/ 25 | typedef Bar = Float 26 | 27 | typedef Foo = Int; 28 | 29 | /** Docs for Bar **/ 30 | typedef Bar = Float 31 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_232_key_value_iterator.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | for (key=>value in map) { 8 | trace(key, value); 9 | } 10 | 11 | for (index=> value in array) { 12 | trace(key, value); 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | for (key => value in map) { 22 | trace(key, value); 23 | } 24 | 25 | for (index => value in array) { 26 | trace(key, value); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_27_case_var_line_end.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | switch (foo) { 8 | case var bar: 9 | trace(""); 10 | case Pattern(var foo, var bar): 11 | trace(""); 12 | } 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | switch (foo) { 21 | case var bar: 22 | trace(""); 23 | case Pattern(var foo, var bar): 24 | trace(""); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_291_conditional_modifier.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Xml { 7 | var nodeName:String = ""; 8 | 9 | #if !cppia inline #end function get_nodeName() { 10 | return nodeName; 11 | } 12 | 13 | #if !cppia inline #end function set_nodeName(v) { 14 | return this.nodeName = v; 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Xml { 21 | var nodeName:String = ""; 22 | 23 | #if !cppia inline #end function get_nodeName() { 24 | return nodeName; 25 | } 26 | 27 | #if !cppia inline #end function set_nodeName(v) { 28 | return this.nodeName = v; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_321_comment_after_typedef.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Bar = String 6 | 7 | /** 8 | docs 9 | **/ 10 | class Foo {} 11 | 12 | --- 13 | 14 | typedef Bar = String 15 | 16 | /** 17 | docs 18 | **/ 19 | class Foo {} 20 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_329_else_body_with_popen.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function getRevBits(n) { 7 | return if (n == 0) 8 | 0 9 | else if (getBit()) 10 | (1 << (n - 1)) | getRevBits(n - 1) 11 | else 12 | getRevBits(n - 1); 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | function getRevBits(n) { 20 | return if (n == 0) 0 else if (getBit()) (1 << (n - 1)) | getRevBits(n - 1) else getRevBits(n - 1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_329_else_body_with_popen_indent_value_expr.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "indentation": { 3 | "indentComplexValueExpressions": true 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | function getRevBits(n) { 11 | return if (n == 0) 12 | 0 13 | else if (getBit()) 14 | (1 << (n - 1)) | getRevBits(n - 1) 15 | else 16 | getRevBits(n - 1); 17 | } 18 | } 19 | 20 | --- 21 | 22 | class Main { 23 | function getRevBits(n) { 24 | return if (n == 0) 0 else if (getBit()) (1 << (n - 1)) | getRevBits(n - 1) else getRevBits(n - 1); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_329_else_body_with_popen_keep.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionIf": "keep" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | function getRevBits(n) { 11 | return if (n == 0) 12 | 0 13 | else if (getBit()) 14 | (1 << (n - 1)) | getRevBits(n - 1) 15 | else 16 | getRevBits(n - 1); 17 | } 18 | } 19 | 20 | --- 21 | 22 | class Main { 23 | function getRevBits(n) { 24 | return if (n == 0) 25 | 0 26 | else if (getBit()) 27 | (1 << (n - 1)) | getRevBits(n - 1) 28 | else 29 | getRevBits(n - 1); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_32_structure_inheritance.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Foo = {}; 6 | 7 | typedef Bar = { 8 | > Foo, > Bar2, var foo:Int; var bar:Int; 9 | } 10 | 11 | typedef Bar2 = { 12 | > Foo, foo:Int, ?bar:Int 13 | } 14 | 15 | typedef Bar3 = Bar &{ 16 | foo:Int, ?bar:Int 17 | } & Bar2 18 | 19 | --- 20 | 21 | typedef Foo = {}; 22 | 23 | typedef Bar = { 24 | > Foo, 25 | > Bar2, 26 | var foo:Int; 27 | var bar:Int; 28 | } 29 | 30 | typedef Bar2 = { 31 | > Foo, 32 | foo:Int, 33 | ?bar:Int 34 | } 35 | 36 | typedef Bar3 = Bar & { 37 | foo:Int, 38 | ?bar:Int 39 | } & 40 | Bar2 41 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_330_ternary_with_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | return (meta == null || meta.obj == null) ? {} : meta.obj; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | return (meta == null || meta.obj == null) ? {} : meta.obj; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_331_line_comment_after_typedef.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef TypeParams = Array; // no constraints 6 | typedef Foo = Bar 7 | 8 | --- 9 | 10 | typedef TypeParams = Array; // no constraints 11 | typedef Foo = Bar 12 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_333_if_body_metadata.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | if (prev == null) 8 | @:privateAccess MainLoop.pending = next; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | if (prev == null) 17 | @:privateAccess MainLoop.pending = next; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_344_conditional_with_line_comment.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | #if js 7 | class JS { 8 | var foo:Int; 9 | } 10 | #else 11 | class NotJS { 12 | var foo:Int; 13 | } 14 | #end // js 15 | 16 | --- 17 | 18 | #if js 19 | class JS { 20 | var foo:Int; 21 | } 22 | #else 23 | class NotJS { 24 | var foo:Int; 25 | } 26 | #end // js 27 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_358_left_curly_with_empty_structure_return.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | function correctObjectTypes(row:{}):{} { 8 | trace("foo"); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | function correctObjectTypes(row:{}):{} { 16 | trace("foo"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_358_left_curly_with_empty_structure_return_both.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both", 4 | "rightCurly": "both" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | function correctObjectTypes(row:{}):{} { 12 | trace("foo"); 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main 19 | { 20 | function correctObjectTypes(row:{}):{} 21 | { 22 | trace("foo"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_364_empty_abstract_body_with_comments.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | abstract Thenable(ThenableStruct) from ThenableStruct {} // abstract wrapping prevents compiler hanging, see https://github.com/HaxeFoundation/haxe/issues/5785 7 | 8 | --- 9 | 10 | abstract Thenable(ThenableStruct) 11 | from ThenableStruct {} // abstract wrapping prevents compiler hanging, see https://github.com/HaxeFoundation/haxe/issues/5785 12 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_369_anon_type_hint_return_value.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "bracesConfig": { 4 | "anonTypeBraces": { 5 | "openingPolicy": "after", 6 | "closingPolicy": "before" 7 | } 8 | } 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | private static function normalizeUVT(uvt:Vector, skipT:Bool = false):{ max:Float, uvt:Vector } 16 | { 17 | .... 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | private static function normalizeUVT(uvt:Vector, skipT:Bool = false):{ max:Float, uvt:Vector } { 25 | .... 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_380_incomplete_metadata.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | @ 6 | class Main { 7 | static function main() { 8 | } 9 | } 10 | 11 | @ 12 | class Test {} 13 | 14 | @ 15 | class Main { 16 | @ 17 | static function main() { 18 | } 19 | } 20 | 21 | @ 22 | class Main { 23 | @ 24 | function main() { 25 | @ 26 | super(); 27 | } 28 | } 29 | 30 | --- 31 | 32 | @class Main { 33 | static function main() {} 34 | } 35 | @class Test {} 36 | @class Main { 37 | @static function main() {} 38 | } 39 | @class Main { 40 | @function main() 41 | { 42 | @super() ; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_410_missing_semicolon_handling.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | trace("a") 8 | trace("b"); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | trace("a") 17 | trace("b"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_429_semicolon_after_conditional.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | return #if js 8 | html5.onMobile 9 | #elseif mobile 10 | true 11 | #else 12 | false 13 | #end; 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | static function main() { 21 | return #if js 22 | html5.onMobile 23 | #elseif mobile 24 | true 25 | #else 26 | false 27 | #end; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_43_multi_line_comments_in_line.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function new(swf:String, id:String, width:Int, height:Int, ver:String, color:String/*...*/ 7 | ):Void; 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | function new(swf:String, id:String, width:Int, height:Int, ver:String, color:String /*...*/):Void; 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_445_curly_with_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main 6 | { 7 | static function main() 8 | { 9 | if (foo) 10 | { // comment 11 | bar; 12 | } // comment 13 | if (foo) 14 | { 15 | // comment 16 | bar; 17 | } // comment 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | static function main() { 25 | if (foo) { // comment 26 | bar; 27 | } // comment 28 | if (foo) { 29 | // comment 30 | bar; 31 | } // comment 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_44_single_line_sharp.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public #if !cppia inline #end function addChar(c:Int):Void { 7 | var finalTokDef:TokenDef = #if (haxe_ver >= 4.0) Kwd(KwdFinal); #else Const(CIdent("final")); #end 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public #if !cppia inline #end function addChar(c:Int):Void { 15 | var finalTokDef:TokenDef = #if (haxe_ver >= 4.0) Kwd(KwdFinal); #else Const(CIdent("final")); #end 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_475_structure_type_param.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Foo { 6 | function toObjectVector() {} 7 | } 8 | 9 | --- 10 | 11 | class Foo { 12 | function toObjectVector() {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_47_dont_linebreak_structure_types.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function addFinalizable(instance : {function finalize() : Void; }, inPin : Bool) : Void {} 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | public static function addFinalizable(instance:{function finalize():Void;}, inPin:Bool):Void {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_53_line_end_after_typedefs.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Foo = String 6 | typedef Bar = Int 7 | typedef Bar2={} 8 | typedef Bar3 = Int 9 | 10 | --- 11 | 12 | typedef Foo = String 13 | typedef Bar = Int 14 | typedef Bar2 = {} 15 | typedef Bar3 = Int 16 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_53_line_end_after_typedefs_empty_lines.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines":{ 3 | "betweenSingleLineTypes": 1 4 | } 5 | } 6 | 7 | --- 8 | 9 | typedef Foo = String 10 | typedef Bar = Int 11 | typedef Bar2={} 12 | typedef Bar3 = Int 13 | 14 | --- 15 | 16 | typedef Foo = String 17 | 18 | typedef Bar = Int 19 | 20 | typedef Bar2 = {} 21 | 22 | typedef Bar3 = Int 23 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_578_metadata_multiline_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | @:jsRequire("openfl/display/Bitmap", "default") 6 | /** 7 | * The Bitmap class represents display objects that represent bitmap images. 8 | */ 9 | extern class Bitmap extends DisplayObject {} 10 | 11 | --- 12 | 13 | @:jsRequire("openfl/display/Bitmap", "default") 14 | /** 15 | * The Bitmap class represents display objects that represent bitmap images. 16 | */ 17 | extern class Bitmap extends DisplayObject {} 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_598_multiline_comment_var.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | /** 7 | * [Description] 8 | */ var foo:Int; 9 | /** 10 | * [Description] 11 | */ private /**/var foo:Int; 12 | /** 13 | * [Description] 14 | */ public /* 15 | */var foo:Int; 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | /** 22 | * [Description] 23 | */ 24 | var foo:Int; 25 | 26 | /** 27 | * [Description] 28 | */ 29 | private /**/ var foo:Int; 30 | 31 | /** 32 | * [Description] 33 | */ 34 | public /* 35 | */ 36 | var foo:Int; 37 | } 38 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_614_switch_semicolon.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function foobar() { 7 | switch foo { 8 | case bar: 9 | a = b - a + 1; 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | function foobar() { 18 | switch foo { 19 | case bar: 20 | a = b - a + 1; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_61_block_var_init.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var foo = { 8 | var bar = "foo"; 9 | bar; 10 | } 11 | trace(foo); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | var foo = { 20 | var bar = "foo"; 21 | bar; 22 | } 23 | trace(foo); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_626_overload_modifier.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract class Foo { 6 | static 7 | overload extern inline function foo() {} 8 | 9 | overload 10 | static extern inline function foo(i:Int) {} 11 | } 12 | 13 | overload 14 | static inline function foo(i:Int) {} 15 | 16 | --- 17 | 18 | abstract class Foo { 19 | static overload extern inline function foo() {} 20 | 21 | overload static extern inline function foo(i:Int) {} 22 | } 23 | 24 | overload static inline function foo(i:Int) {} 25 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_87_assignment_without_semicolon.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var foo = { 8 | 9 | } 10 | trace(""); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | var foo = {} 19 | trace(""); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_88_block_var_init.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var variableWithBlockInit:Int = { 8 | function foo():Int 9 | return 0; 10 | var bar = foo(); 11 | bar; 12 | }; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | public static function main() { 20 | var variableWithBlockInit:Int = { 21 | function foo():Int 22 | return 0; 23 | var bar = foo(); 24 | bar; 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/lineends/issue_9_dont_move_single_line_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | // foo 6 | class Main{ 7 | // foo 8 | static function main(){ 9 | trace("foo"); // foo 10 | // foo 11 | trace("bar"); 12 | // foo 13 | } 14 | } 15 | 16 | --- 17 | 18 | // foo 19 | class Main { 20 | // foo 21 | static function main() { 22 | trace("foo"); // foo 23 | // foo 24 | trace("bar"); 25 | // foo 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/lineends/line_end_character_auto.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "lineEndCharacter": "auto" 4 | } 5 | } 6 | 7 | --- 8 | 9 | public inline function test() { 10 | trace("test"); 11 | } 12 | 13 | --- 14 | 15 | public inline function test() { 16 | trace("test"); 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/line_end_character_cr.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "lineEndCharacter": "auto" 4 | } 5 | } 6 | 7 | --- 8 | 9 | public inline function test() { 10 | trace("test"); 11 | } 12 | 13 | --- 14 | 15 | public inline function test() { 16 | trace("test"); 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/line_end_character_crlf.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "lineEndCharacter": "CRLF" 4 | } 5 | } 6 | 7 | --- 8 | 9 | public inline function test() { 10 | trace("test"); 11 | } 12 | 13 | --- 14 | 15 | public inline function test() { 16 | trace("test"); 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/line_end_character_lf.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "lineEndCharacter": "LF" 4 | } 5 | } 6 | 7 | --- 8 | 9 | public inline function test() { 10 | trace("test"); 11 | } 12 | 13 | --- 14 | 15 | public inline function test() { 16 | trace("test"); 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/lineends/map_with_comment.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | final flags = [ 7 | CompilationServer => [ 8 | // server 9 | ], 10 | ]; 11 | 12 | --- 13 | 14 | final flags = [ 15 | CompilationServer => [ 16 | // server 17 | ], 18 | ]; 19 | -------------------------------------------------------------------------------- /test/testcases/lineends/simons_type_parameter_constraints.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | function hasIdent(name:T):T { 7 | return false; 8 | } 9 | 10 | --- 11 | 12 | function hasIdent(name:T):T { 13 | return false; 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/missing/issue_18_missing_modifier_in_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | #if !js 7 | inline 8 | #end 9 | static public function main() {} 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | #if !js 16 | inline 17 | #end 18 | static public function main() {} 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/other/callback_type_param.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class HaxeServer { 6 | var stopProgressCallback:Null<() -> Void>; 7 | } 8 | 9 | --- 10 | 11 | class HaxeServer { 12 | var stopProgressCallback:Null<() -> Void>; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/other/code_snippet.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | for (foo in bar) trace(foo); 6 | if (!emulated) { 7 | b2[0] = 0xCC; 8 | b2[0] == 0xCC; 9 | b[1] == 0xCC; 10 | } 11 | 12 | --- 13 | 14 | for (foo in bar) trace(foo); 15 | if (!emulated) { 16 | b2[0] = 0xCC; 17 | b2[0] == 0xCC; 18 | b[1] == 0xCC; 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/other/disabled_excluded.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "excludes": ["test\/testcases\/other\/disabled_excluded.hxtest"] 3 | } 4 | 5 | --- 6 | 7 | class Main { 8 | function main () { 9 | doSomething(); 10 | } 11 | } 12 | 13 | --- 14 | 15 | -------------------------------------------------------------------------------- /test/testcases/other/disabled_formatting.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "disableFormatting": true 3 | } 4 | 5 | --- 6 | 7 | class Main { 8 | function main () { 9 | doSomething(); 10 | } 11 | } 12 | 13 | --- 14 | 15 | -------------------------------------------------------------------------------- /test/testcases/other/ends_with_string_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | var foo = "bar" 7 | 8 | --- 9 | 10 | class Main { 11 | var foo = "bar" 12 | -------------------------------------------------------------------------------- /test/testcases/other/ends_with_string_literal_2.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | {"bar" 6 | 7 | --- 8 | 9 | { 10 | "bar" 11 | -------------------------------------------------------------------------------- /test/testcases/other/ends_with_string_literal_3.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | trace("foo" 8 | 9 | --- 10 | 11 | class Main { 12 | public static function main() { 13 | trace("foo" 14 | -------------------------------------------------------------------------------- /test/testcases/other/failing_issue_558_merge_conflict.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Foo { 6 | function foo() { 7 | switch (bar) { 8 | <<<<<<< .mine 9 | foobar 10 | ======= 11 | fubar 12 | >>>>>>> .rxxx 13 | } 14 | } 15 | } 16 | 17 | 18 | 19 | --- 20 | 21 | class Foo { 22 | function foo() { 23 | switch (bar) { 24 | case foo if (switch(bar) { case _: false; }): doSomething(); 25 | case foo if (true): doSomething(); 26 | case foo2: doSomething(); 27 | x >>>= 10; 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /test/testcases/other/fixConstAfterConst_exception.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | package flash.utils; 6 | 7 | typedef Function = Dynamic 8 | 9 | --- 10 | 11 | package flash.utils; 12 | 13 | typedef Function = Dynamic 14 | -------------------------------------------------------------------------------- /test/testcases/other/issue_154_crash_with_nested_ternary.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class FlxSimplex 6 | { 7 | static inline function getCornerNoise(a:Int):Float 8 | { 9 | y = b3 == 1 ? b0 == 1 ? -y : y : b2 == 0 ? b1 == 1 ? -y : y : 0; 10 | return t * t * (x + y); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class FlxSimplex { 17 | static inline function getCornerNoise(a:Int):Float { 18 | y = b3 == 1 ? b0 == 1 ? -y : y : b2 == 0 ? b1 == 1 ? -y : y : 0; 19 | return t * t * (x + y); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/other/issue_157_line_deleted_after_ternary.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function __dispatchEvent (event:Event):Bool { 7 | var parent = event.bubbles ? this.parent : null; 8 | var result = super.__dispatchEvent (event); 9 | return result; 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | function __dispatchEvent(event:Event):Bool { 17 | var parent = event.bubbles ? this.parent : null; 18 | var result = super.__dispatchEvent(event); 19 | return result; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/other/issue_163_macro_class_name.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var name = "Foo"; 8 | var cl = macro class $name { 9 | public function new() {} 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | var name = "Foo"; 19 | var cl = macro class $name { 20 | public function new() {} 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/other/issue_164_implements_extends.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Server implements ISocket extends BaseHandler 6 | { 7 | } 8 | 9 | --- 10 | 11 | class Server implements ISocket extends BaseHandler {} 12 | -------------------------------------------------------------------------------- /test/testcases/other/issue_165_conditionals_with_new.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var process = #if sys new sys.io.Process #elseif nodejs js.node.ChildProcess.spawn #end ('curl', []); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | var process = #if sys new sys.io.Process #elseif nodejs js.node.ChildProcess.spawn #end ('curl', []); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/other/issue_166_macro_patterns.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class ExtendedLoops { 6 | static public function apply(e:Expr) 7 | return switch e { 8 | case macro for ($i{_} in $_) $_: e; 9 | case macro for ($head) $body: e; 10 | default: e; 11 | } 12 | } 13 | 14 | --- 15 | 16 | class ExtendedLoops { 17 | static public function apply(e:Expr) 18 | return switch e { 19 | case macro for ($i{_} in $_) $_: e; 20 | case macro for ($head) $body: e; 21 | default: e; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/other/issue_191_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Cson { 6 | static function tokenize(text: String): Array { 7 | tokens.push(#if cpp sub(text, #else text.sub( #end from, i - from + 1)); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Cson { 14 | static function tokenize(text:String):Array { 15 | tokens.push(#if cpp sub(text, #else text.sub(#end from, i - from + 1)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/other/issue_200_interesting_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | #if cs 8 | pony.cs.Synchro.lock(isRead, function() { 9 | #end 10 | // some code 11 | #if cs 12 | }); 13 | #end 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | #if cs 22 | pony.cs.Synchro.lock(isRead, function() { 23 | #end 24 | // some code 25 | #if cs 26 | }); 27 | #end 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/other/issue_203_multiline_interpolation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | trace(' 8 | ${ 9 | "foo" 10 | } 11 | '); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | trace(' 20 | ${"foo"} 21 | '); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/other/issue_228_typedef_withoug_assign.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Testtype { // <- "=" assignment is forgotten! 6 | something: String 7 | } 8 | 9 | --- 10 | 11 | typedef Testtype { // <- "=" assignment is forgotten! 12 | something:String 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/other/issue_23_execption_hashmap.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract HashMap(HashMapData) { 6 | 7 | } 8 | 9 | 10 | --- 11 | 12 | abstract HashMap(HashMapData) {} 13 | -------------------------------------------------------------------------------- /test/testcases/other/issue_24_empty_exception.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | 6 | 7 | --- 8 | 9 | -------------------------------------------------------------------------------- /test/testcases/other/issue_259_inline_conditionals_truncate.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | interface IPerson { 6 | function getName():String; 7 | } 8 | 9 | interface IPet #if (extends_iperson) extends IPerson #end { 10 | 11 | #if (!extends_iperson) 12 | function getName():String; 13 | #end 14 | 15 | function getPetType():String; 16 | } 17 | 18 | --- 19 | 20 | interface IPerson { 21 | function getName():String; 22 | } 23 | 24 | interface IPet #if (extends_iperson) extends IPerson #end { 25 | #if (!extends_iperson) 26 | function getName():String; 27 | #end 28 | 29 | function getPetType():String; 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/other/issue_25_import_completion_exception.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | import MyModule. 6 | 7 | --- 8 | 9 | import MyModule. 10 | -------------------------------------------------------------------------------- /test/testcases/other/issue_28_exception_with_bom.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() {} 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | static function main() {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/other/issue_29_execption_conditionals_before_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if foo @:keep #end 6 | class Foo {} 7 | 8 | 9 | --- 10 | 11 | #if foo @:keep #end 12 | class Foo {} 13 | -------------------------------------------------------------------------------- /test/testcases/other/issue_30_exception_with_guard.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Foo { 6 | function foo() { 7 | switch (bar) { 8 | case foo if (switch(bar) { case _: false; }): doSomething(); 9 | case foo if (true): doSomething(); 10 | case foo2: doSomething(); 11 | } 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Foo { 18 | function foo() { 19 | switch (bar) { 20 | case foo if (switch (bar) { 21 | case _: false; 22 | }): 23 | doSomething(); 24 | case foo if (true): 25 | doSomething(); 26 | case foo2: 27 | doSomething(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/other/issue_33_macro_class_reification.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Macro { 6 | static function foo() { 7 | macro class { 8 | public function new() {} 9 | } 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Macro { 16 | static function foo() { 17 | macro class { 18 | public function new() {} 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/other/issue_34_switch_this.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Foo { 6 | public function toString() { 7 | return switch this { 8 | case Right(e): 9 | Type.getEnumName(e); 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Foo { 17 | public function toString() { 18 | return switch this { 19 | case Right(e): 20 | Type.getEnumName(e); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/other/issue_480_conditional_with_dot_ident.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | #if target.sys 8 | trace("Test"); 9 | #end 10 | #if marco.sys 11 | trace("Test"); 12 | #end 13 | 14 | return foo #if target .sys #end; 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | static function main() { 22 | #if target.sys 23 | trace("Test"); 24 | #end 25 | #if marco.sys 26 | trace("Test"); 27 | #end 28 | 29 | return foo #if target .sys #end; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/testcases/other/issue_558_not_merge_conflict.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Foo { 6 | function foo() { 7 | switch (bar) { 8 | <<<<<<< .mine 9 | foobar 10 | ======= 11 | fubar 12 | >>>>>>> .rxxx 13 | } 14 | } 15 | } 16 | 17 | 18 | 19 | --- 20 | 21 | class Foo { 22 | function foo() { 23 | switch (bar) { 24 | << << << < .mine 25 | foobar == == == = fubar >>> >>> > .rxxx 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/other/issue_58_missing_modifiers_of_final.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public final foo:Int; 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | public final foo:Int; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/other/issue_96_incomplete_code_snippet.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | (function() {}) 6 | 7 | --- 8 | 9 | (function() {}) 10 | -------------------------------------------------------------------------------- /test/testcases/other/issue_97_incomplete_code_snippet.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | Foo(function(i) return i); 6 | pack.Foo(function(i) return i); 7 | return e2 == null ? { t : HDyn } : bar(e2); 8 | 9 | --- 10 | 11 | Foo(function(i) return i); 12 | pack.Foo(function(i) return i); 13 | return e2 == null ? {t: HDyn} : bar(e2); 14 | -------------------------------------------------------------------------------- /test/testcases/other/issue_97_incomplete_code_snippet_empty_lines.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines":{ 3 | "betweenSingleLineTypes": 1 4 | } 5 | } 6 | 7 | --- 8 | 9 | Foo(function(i) return i); 10 | pack.Foo(function(i) return i); 11 | return e2 == null ? { t : HDyn } : bar(e2); 12 | 13 | --- 14 | 15 | Foo(function(i) return i); 16 | 17 | pack.Foo(function(i) return i); 18 | return e2 == null ? {t: HDyn} : bar(e2); 19 | -------------------------------------------------------------------------------- /test/testcases/other/private_final_class.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "emptyLines": { 3 | "maxAnywhereInFile": 0 4 | } 5 | } 6 | 7 | --- 8 | 9 | package; 10 | private final class Test { 11 | public function new() { 12 | } 13 | } 14 | 15 | --- 16 | 17 | package; 18 | private final class Test { 19 | public function new() {} 20 | } 21 | -------------------------------------------------------------------------------- /test/testcases/other/safe_navigation_operator.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | private function new() { 7 | var obj:Null<{ field:Null }> = null; 8 | trace(obj!.field!.length); //null 9 | obj = { field:'hello' }; 10 | trace(obj!.field!.length); //5 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | private function new() { 18 | var obj:Null<{field:Null}> = null; 19 | trace(obj!.field!.length); // null 20 | obj = {field: 'hello'}; 21 | trace(obj!.field!.length); // 5 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/other/sharp_error.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | #if java 6 | #error "please implement" 7 | #end 8 | 9 | class Main 10 | { 11 | public function new() 12 | { 13 | } 14 | } 15 | 16 | --- 17 | 18 | #if java 19 | #error "please implement" 20 | #end 21 | class Main { 22 | public function new() {} 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/other/sharp_if_parens_macro_hang.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | #if (macro) 7 | static function main() { 8 | } 9 | #end 10 | #if (!macro) 11 | static function main() {} 12 | #end 13 | #if !macro 14 | static function main() {} 15 | #end 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | #if (macro) 22 | static function main() {} 23 | #end 24 | 25 | #if (!macro) 26 | static function main() {} 27 | #end 28 | 29 | #if !macro 30 | static function main() {} 31 | #end 32 | } 33 | -------------------------------------------------------------------------------- /test/testcases/other/unicode_regex.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | static final ctrlCharacters = ~/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/g; 6 | 7 | --- 8 | 9 | static final ctrlCharacters = ~/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/g; 10 | -------------------------------------------------------------------------------- /test/testcases/sameline/anon_type_hint_with_curly_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | } 5 | 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | var test:{x:Int}; 12 | var test:{x:Int} = build(); 13 | } 14 | 15 | --- 16 | 17 | class Main 18 | { 19 | var test:{x:Int}; 20 | var test:{x:Int} = build(); 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/sameline/anon_type_hint_with_curly_next_and_space.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | }, 5 | "whitespace": { 6 | "typeHintColonPolicy": "around" 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | var test:{x:Int}; 14 | var test:{x:Int} = build(); 15 | } 16 | 17 | --- 18 | 19 | class Main 20 | { 21 | var test : {x : Int}; 22 | var test : {x : Int} = build(); 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_104_typedef_with_finals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef HaxeMethodResult = { 6 | final ?additionalTimes:{ 7 | final arrival:Float; 8 | final beforeProcessing:Float; 9 | final afterProcessing:Float; 10 | } 11 | } 12 | 13 | --- 14 | 15 | typedef HaxeMethodResult = { 16 | final ?additionalTimes:{ 17 | final arrival:Float; 18 | final beforeProcessing:Float; 19 | final afterProcessing:Float; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_105_expressionIf_with_untyped.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | return untyped if( e.params == null ) [] else e.params; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | return untyped if (e.params == null) [] else e.params; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_113_object_literal_binop.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | if (haxeVersion >= {major: 4, minor: 0, patch: 0}) 8 | return new Haxe4DisplayOffsetConverter(); 9 | else 10 | return new Haxe3DisplayOffsetConverter(); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | if (haxeVersion >= {major: 4, minor: 0, patch: 0}) 19 | return new Haxe4DisplayOffsetConverter(); 20 | else 21 | return new Haxe3DisplayOffsetConverter(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_119_expression_case.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionCase": "same" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | var foo = switch (true) { 12 | case 1: false; 13 | case _: trace(""); false; 14 | } 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | public static function main() { 22 | var foo = switch (true) { 23 | case 1: false; 24 | case _: 25 | trace(""); 26 | false; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_11_else_if_next_line.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "elseIf": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | if (false) {trace("");} else if (true) {trace("");} 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | if (false) { 20 | trace(""); 21 | } else 22 | if (true) { 23 | trace(""); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_11_else_if_same_line.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | if (false) {trace("");} else if (true) {trace("");} 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | if (false) { 16 | trace(""); 17 | } else if (true) { 18 | trace(""); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_122_function_call_on_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | return {start: 0}.isEmpty(); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | return {start: 0}.isEmpty(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_125_expression_case_and_comment_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionCase": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | return switch (foo) { 12 | case bar: "hello world"; // test 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | return switch (foo) { 22 | case bar: 23 | "hello world"; // test 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_125_expression_case_and_comment_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionCase": "same" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | return switch (foo) { 12 | case bar: "hello world"; // test 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | return switch (foo) { 22 | case bar: "hello world"; // test 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_127_expression_case_in_call.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionCase": "same" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | trace(switch (Math.random() > 0.5) { 12 | case true: "yes"; 13 | case false: "no"; 14 | }); 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | public static function main() { 22 | trace(switch (Math.random() > 0.5) { 23 | case true: "yes"; 24 | case false: "no"; 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_131_conditional_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static var gl:#if (lime >= "7.0.0") WebGLRenderContext #else WebGLContext #end; 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | static var gl:#if (lime >= "7.0.0") WebGLRenderContext #else WebGLContext #end; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_133_array_comprehension_without_block.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | return avoidDuplicates([for (arg in args) if (arg.name != null) arg.name else guessName(arg.type)]); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | return avoidDuplicates([for (arg in args) if (arg.name != null) arg.name else guessName(arg.type)]); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_137_array_comprehension.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionIf": "keep" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | var fixes = [ 12 | for (key in map.keys()) 13 | if (key.code == DKUnusedImport) 14 | {range: patchRange(doc, key.range), newText: ""} 15 | ]; 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | public static function main() { 23 | var fixes = [ 24 | for (key in map.keys()) 25 | if (key.code == DKUnusedImport) 26 | {range: patchRange(doc, key.range), newText: ""} 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_142_abstract_on_anon_struct.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract Foo({i:Int}) {} 6 | 7 | --- 8 | 9 | abstract Foo({i:Int}) {} 10 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_143_abstract_from_anon_struct.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract Foo(Bar) from {a:String} {} 6 | 7 | --- 8 | 9 | abstract Foo(Bar) from {a:String} {} 10 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_148_typedefs_same_line.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | private typedef HaxeTaskDefinition = TaskDefinition & {args:String}; 6 | 7 | --- 8 | 9 | private typedef HaxeTaskDefinition = TaskDefinition & {args:String}; 10 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_161_if_body_in_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | { 8 | foo: { 9 | if (foo) 10 | bar; 11 | ""; 12 | } 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | { 22 | foo: { 23 | if (foo) 24 | bar; 25 | ""; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_167_abstract_with_multiple_froms.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract ServerOptions(Dynamic) from Executable from {run:Executable, debug:Executable} from {run:NodeModule, debug:NodeModule} from NodeModule {} 6 | 7 | 8 | --- 9 | 10 | abstract ServerOptions(Dynamic) from Executable from {run:Executable, debug:Executable} from {run:NodeModule, debug:NodeModule} from NodeModule {} 11 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_178_return_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main 10 | { 11 | public static function main() 12 | { 13 | return 14 | {original: this, warmer: warmer, colder: colder}; 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main 21 | { 22 | public static function main() 23 | { 24 | return {original: this, warmer: warmer, colder: colder}; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_185_function_call_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main 10 | { 11 | public static function main() 12 | { 13 | values.push( 14 | {name: f.name, value: value}); 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main 21 | { 22 | public static function main() 23 | { 24 | values.push({name: f.name, value: value}); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_19_ternary_style_if.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | var foo = if (foo) foo else foo; 8 | return if (foo) foo else foo; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | var foo = if (foo) foo else foo; 17 | return if (foo) foo else foo; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_20_for_body_in_array_comprehension.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | var a = [for (i in 0...10) i]; 8 | } 9 | } 10 | 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | var a = [for (i in 0...10) i]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_235_keep_if_else.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "elseBody": "keep", 4 | "ifElse": "keep" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | 12 | static function main():Void { 13 | if (true) { 14 | trace(1); 15 | } else trace(2); 16 | 17 | if (true) { 18 | trace(1); 19 | } else { 20 | trace(2); 21 | } 22 | } 23 | 24 | } 25 | 26 | --- 27 | 28 | class Main { 29 | static function main():Void { 30 | if (true) { 31 | trace(1); 32 | } else trace(2); 33 | 34 | if (true) { 35 | trace(1); 36 | } else { 37 | trace(2); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_26_function_body_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() trace("foo"); 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main() 17 | trace("foo"); 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_26_function_body_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "same" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() trace("foo"); 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main() trace("foo"); 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_271_arrow_switch.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | var f = () -> switch (false) { 9 | case true: 1; 10 | case false: 0; 11 | } 12 | var f = () -> if (false) 1 else 0; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | public static function main() { 20 | var f = () -> switch (false) { 21 | case true: 1; 22 | case false: 0; 23 | } 24 | var f = () -> if (false) 1 else 0; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_272_binop_switch.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | directionIndex += switch (instruction.turn) { 9 | case Left: -1; 10 | case Right: 1; 11 | } 12 | directionIndex += if (instruction.turn == Left) -1 else 1; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | public static function main() { 20 | directionIndex += switch (instruction.turn) { 21 | case Left: -1; 22 | case Right: 1; 23 | } 24 | directionIndex += if (instruction.turn == Left) -1 else 1; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_316_line_comment_after_else.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main 7 | { 8 | public static function main() 9 | { 10 | if (foo) 11 | { 12 | bar; 13 | } 14 | else // comment 15 | { 16 | bar; 17 | } 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | public static function main() { 25 | if (foo) { 26 | bar; 27 | } else // comment 28 | { 29 | bar; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_316_line_comment_after_else_curly_both.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "lineEnds": { 3 | "leftCurly": "both" 4 | }, 5 | "sameLine": { 6 | "ifElse": "next" 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main 13 | { 14 | public static function main() 15 | { 16 | if (foo) 17 | { 18 | bar; 19 | } 20 | else // comment 21 | { 22 | bar; 23 | } 24 | } 25 | } 26 | 27 | --- 28 | 29 | class Main 30 | { 31 | public static function main() 32 | { 33 | if (foo) 34 | { 35 | bar; 36 | } 37 | else // comment 38 | { 39 | bar; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_316_line_comment_after_else_on_newline.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main 7 | { 8 | public static function main() 9 | { 10 | if (foo) 11 | { 12 | bar; 13 | } 14 | else 15 | // comment 16 | { 17 | bar; 18 | } 19 | } 20 | } 21 | 22 | --- 23 | 24 | class Main { 25 | public static function main() { 26 | if (foo) { 27 | bar; 28 | } else 29 | // comment 30 | { 31 | bar; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_328_braceless_if_with_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | if (bufsize == null) 9 | #if php 10 | bufsize = 8192; 11 | #else 12 | bufsize = (1 << 14); 13 | #end 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | if (bufsize == null) 22 | #if php 23 | bufsize = 8192; 24 | #else 25 | bufsize = (1 << 14); 26 | #end 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_41_ternary_style_if_in_call.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | trace(if (Math.random() > 0.5) true else false); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | trace(if (Math.random() > 0.5) true else false); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_42_if_after_assign_with_blocks.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var foo = if (bar) { 8 | ""; 9 | } else { 10 | ""; 11 | }; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | var foo = if (bar) { 20 | ""; 21 | } else { 22 | ""; 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_42_if_after_assign_with_blocks_indent_assignment_expr.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "indentation": { 3 | "indentComplexValueExpressions": true 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | var foo = if (bar) { 12 | ""; 13 | } else { 14 | ""; 15 | }; 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | public static function main() { 23 | var foo = if (bar) { 24 | ""; 25 | } else { 26 | ""; 27 | }; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_42_if_after_assign_with_blocks_on_same_line.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionIfWithBlocks": true 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | var foo = if (bar) { 12 | ""; 13 | } else { 14 | ""; 15 | }; 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | public static function main() { 23 | var foo = if (bar) {"";} else {"";}; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_48_metadata_max_length.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | @:allow(haxeLanguageServer.server.HaxeServer) var displayServerConfig:DisplayServerConfig; 7 | @:allow(haxeLanguageServer.server.HaxeServer) 8 | var displayServerConfig:DisplayServerConfig; 9 | @:optional var foo:Int; 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | @:allow(haxeLanguageServer.server.HaxeServer) var displayServerConfig:DisplayServerConfig; 16 | @:allow(haxeLanguageServer.server.HaxeServer) 17 | var displayServerConfig:DisplayServerConfig; 18 | @:optional var foo:Int; 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_498_nested_array_comprehension.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main():Void { 7 | var a = [for (e in [[]]) for (x in e) x]; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main():Void { 15 | var a = [for (e in [[]]) for (x in e) x]; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_509_try_catch_expression.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "tryCatch": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | var applicationName = try ProjectUtils.getApplicationFile(FileSystem.fullPath(project.projectXmlPath)) catch (_:Dynamic) project.name; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | var applicationName = try ProjectUtils.getApplicationFile(FileSystem.fullPath(project.projectXmlPath)) catch (_:Dynamic) project.name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_509_try_catch_expression_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "tryCatch": "next", 4 | "expressionTry": "same" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | static function main() { 12 | var applicationName = try ProjectUtils.getApplicationFile(FileSystem.fullPath(project.projectXmlPath)) catch (_:Dynamic) project.name; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | var applicationName = try ProjectUtils.getApplicationFile(FileSystem.fullPath(project.projectXmlPath)) catch (_:Dynamic) project.name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_54_return_sharp_multiple_passes.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static inline function get_onMobile():Bool 7 | { 8 | return 9 | #if js 10 | html5.onMobile; 11 | #elseif mobile 12 | true; 13 | #else 14 | false; 15 | #end 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | static inline function get_onMobile():Bool { 23 | return #if js 24 | html5.onMobile; 25 | #elseif mobile 26 | true; 27 | #else 28 | false; 29 | #end 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_63_do_while_all_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "doWhileBody": "same", 4 | "doWhile": "same" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | public static function main() { 12 | do trace(""); while (true); 13 | do { 14 | trace(""); 15 | } while (true); 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | public static function main() { 23 | do trace(""); while (true); 24 | do { 25 | trace(""); 26 | } while (true); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_63_do_while_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "doWhile": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | do trace(""); while (true); 12 | do { 13 | trace(""); 14 | } while (true); 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | public static function main() { 22 | do 23 | trace(""); 24 | while (true); 25 | do { 26 | trace(""); 27 | } 28 | while (true); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_63_do_while_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "doWhile": "same" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | do trace(""); while (true); 12 | do { 13 | trace(""); 14 | } while (true); 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | public static function main() { 22 | do 23 | trace(""); while (true); 24 | do { 25 | trace(""); 26 | } while (true); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_63_do_while_same_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "doWhileBody": "same", 4 | "doWhile": "next" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | public static function main() { 12 | do trace(""); while (true); 13 | do { 14 | trace(""); 15 | } while (true); 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | public static function main() { 23 | do trace(""); 24 | while (true); 25 | do { 26 | trace(""); 27 | } 28 | while (true); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_76_function_new_body_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | function new() {} 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | function new() {} 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_80_expression_try_catch_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "expressionTry": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | var xml = try Xml.parse(data).firstElement() catch (_:Any) null; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | var xml = try 20 | Xml.parse(data).firstElement() 21 | catch (_:Any) 22 | null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_80_expression_try_catch_same.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var xml = try Xml.parse(data).firstElement() catch (_:Any) null; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | var xml = try Xml.parse(data).firstElement() catch (_:Any) null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_81_while_array_comprehension.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | var b = [while (i < 10) i++]; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | var b = [while (i < 10) i++]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_83_anon_function_body_all_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "same", 4 | "anonFunctionBody": "same" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | public static function main() { 12 | [1, 2, 3].map(function() trace(i)); 13 | } 14 | public static function main2() [1, 2, 3].map(function() trace(i)) 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | [1, 2, 3].map(function() trace(i)); 22 | } 23 | 24 | public static function main2() [1, 2, 3].map(function() trace(i)) 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_83_anon_function_body_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "next", 4 | "anonFunctionBody": "next" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | public static function main() { 12 | [1, 2, 3].map(function() trace(i)); 13 | } 14 | public static function main2() [1, 2, 3].map(function() trace(i)) 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | [1, 2, 3].map(function() 22 | trace(i)); 23 | } 24 | 25 | public static function main2() 26 | [1, 2, 3].map(function() 27 | trace(i)) 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_83_anon_function_body_same.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "next" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | [1, 2, 3].map(function() trace(i)); 12 | } 13 | public static function main2() [1, 2, 3].map(function() trace(i)) 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | public static function main() { 20 | [1, 2, 3].map(function() trace(i)); 21 | } 22 | 23 | public static function main2() 24 | [1, 2, 3].map(function() trace(i)) 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_83_anon_function_body_same_next.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "same", 4 | "anonFunctionBody": "next" 5 | } 6 | } 7 | 8 | --- 9 | 10 | class Main { 11 | public static function main() { 12 | [1, 2, 3].map(function() trace(i)); 13 | } 14 | public static function main2() [1, 2, 3].map(function() trace(i)) 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | [1, 2, 3].map(function() 22 | trace(i)); 23 | } 24 | 25 | public static function main2() [1, 2, 3].map(function() 26 | trace(i)) 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_93_expression_if_with_binop.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | Sys.println(" \n" + if (hasError) "Failed!" else "Success."); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | Sys.println(" \n" + if (hasError) "Failed!" else "Success."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/issue_99_expressionIf_in_structure_field_assignment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | items.push({ label: if (anon.fields.length == 0) "{}" else "{fields...}" }); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | items.push({label: if (anon.fields.length == 0) "{}" else "{fields...}"}); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/sameline/return_if_else_if.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | return if (difference > 0) 1 8 | else if (difference < 0) -1 9 | else 10 | 0; 11 | return if (difference > 0) 1; 12 | else if (difference < 0) -1; 13 | else 14 | 0; 15 | } 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | static function main() { 22 | return if (difference > 0) 1 else if (difference < 0) -1 else 0; 23 | return if (difference > 0) 1; else if (difference < 0) -1; else 0; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/whitespace/abstract_over_array_of_anon_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | abstract SymbolStack(Array<{level:SymbolLevel, symbol:DocumentSymbol}>) { 7 | } 8 | 9 | --- 10 | 11 | abstract SymbolStack(Array<{level:SymbolLevel, symbol:DocumentSymbol}>) {} 12 | -------------------------------------------------------------------------------- /test/testcases/whitespace/block_metadata.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static inline function downcast(value:T, c:Class):S @:privateAccess { 7 | return if (js.Boot.__downcastCheck(value, c)) cast value else null; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static inline function downcast(value:T, c:Class):S @:privateAccess { 15 | return if (js.Boot.__downcastCheck(value, c)) cast value else null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/call_with_array.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function main () { 7 | token.filter([Kwd(KwdElse)], FIRST)[0]; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | function main() { 15 | token.filter([Kwd(KwdElse)], FIRST)[0]; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/conditionalised_case.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | 5 | --- 6 | 7 | 8 | class Main { 9 | static function main() { 10 | switch (prev.tok) { 11 | case #if (haxe_ver < 4.0) Kwd(KwdIn) #else Binop(OpIn) #end : 12 | return true; 13 | } 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | static function main() { 21 | switch (prev.tok) { 22 | case #if (haxe_ver < 4.0) Kwd(KwdIn) #else Binop(OpIn) #end: 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/whitespace/final_space_removed_from_javadoc_comments_2.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main{ 6 | /** 7 | * [Description] 8 | */ 9 | static function main(){} 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | /** 16 | * [Description] 17 | */ 18 | static function main() {} 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/imports_mult.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | import haxe.*; 6 | using haxe.*; 7 | 8 | --- 9 | 10 | import haxe.*; 11 | 12 | using haxe.*; 13 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_101_comment_in_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var struct = { 8 | field: "" // some comment 9 | }; 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | public static function main() { 17 | var struct = { 18 | field: "" // some comment 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_103_missing_space_around_arrow_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | fields.map(field -> field.type); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | fields.map(field -> field.type); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_108_at_new.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class TestMeta { 6 | @new public function new() {} 7 | @new 8 | public function new() {} 9 | } 10 | 11 | --- 12 | 13 | class TestMeta { 14 | @new public function new() {} 15 | 16 | @new 17 | public function new() {} 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_112_detect_arrow_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | protocol.logError = message -> protocol.sendNotification(Methods.LogMessage, {type: Warning, message: message}); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | protocol.logError = message -> protocol.sendNotification(Methods.LogMessage, {type: Warning, message: message}); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_117_dollar_and_binop.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function testPrintFunctionDeclaration() { 7 | markers.push(macro $v{Std.parseInt(name)} => $v{pos}); 8 | markers.push(macro $v{Std.parseInt(name)}* $v{pos}); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | function testPrintFunctionDeclaration() { 16 | markers.push(macro $v{Std.parseInt(name)} => $v{pos}); 17 | markers.push(macro $v{Std.parseInt(name)} * $v{pos}); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_12_space_before_unary_minus.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | var value = 1; 8 | trace(-value); 9 | n += (Math.ceil( -n) >> 1) << 1; 10 | var dx:Float = (SpriteA.x + SpriteA.origin.x) -(SpriteB.x + SpriteB.origin.x); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | static function main() { 18 | var value = 1; 19 | trace(-value); 20 | n += (Math.ceil(-n) >> 1) << 1; 21 | var dx:Float = (SpriteA.x + SpriteA.origin.x) - (SpriteB.x + SpriteB.origin.x); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_134_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | /* 7 | TODO: 8 | 9 | - finish completion 10 | - diagnostics 11 | - codeLens 12 | - workspaceSymbols ("project/symbol"?) 13 | */ 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | /* 20 | TODO: 21 | 22 | - finish completion 23 | - diagnostics 24 | - codeLens 25 | - workspaceSymbols ("project/symbol"?) 26 | */ 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_135_string_interpolation_with_escaped_dollar.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | '${i+1}'; 8 | '$${i+1}'; 9 | '$$${i+1}'; 10 | '$${'; 11 | ' ${i+1}'; 12 | ' $${'; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | public static function main() { 20 | '${i + 1}'; 21 | '$${i+1}'; 22 | '$$${i + 1}'; 23 | '$${'; 24 | ' ${i + 1}'; 25 | ' $${'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_135_string_interpolation_with_escaped_dollar_noformat.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "formatStringInterpolation": false 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | public static function main() { 11 | '${i+1}'; 12 | '$${i+1}'; 13 | '$$${i+1}'; 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | public static function main() { 21 | '${i+1}'; 22 | '$${i+1}'; 23 | '$$${i+1}'; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_140_assignment_in_anon_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var content:{?name:String} = Json.parse(File.getContent(haxelibFile)); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | var content:{?name:String} = Json.parse(File.getContent(haxelibFile)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_145_overload_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | @:overload(function():Void {}) 7 | function foo():Void; 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | @:overload(function():Void {}) 14 | function foo():Void; 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_14_space_before_inline_structure.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function foo(s : { i : Int }):{ i : Int } {call({s:{i:5}});} 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | function foo(s:{i:Int}):{i:Int} { 13 | call({s: {i: 5}}); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_150_overload_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var args = signature.args.map(arg -> { 8 | name: if (arg.name == "") null else arg.name 9 | }); 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | public static function main() { 17 | var args = signature.args.map(arg -> { 18 | name: if (arg.name == "") null else arg.name 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_152_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | token.setCallback(function() sendNotification(CANCEL_METHOD, {id: id})); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | token.setCallback(function() sendNotification(CANCEL_METHOD, {id: id})); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_159_unstable_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | /*public static function main() { 7 | }*/ 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | /*public static function main() { 14 | }*/ 15 | } 16 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_162_space_at_start_of_single_line_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | //foo 7 | //<- foo 8 | //******* 9 | //--------- 10 | //////////// 11 | public static function main() { 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | // foo 19 | // <- foo 20 | //******* 21 | //--------- 22 | //////////// 23 | public static function main() {} 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_172_type_check.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var item = ({title: "Edit settings"} : vscode.MessageItem); 8 | var output = (result.stderr:Buffer).toString().trim(); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var item = ({title: "Edit settings"} : vscode.MessageItem); 17 | var output = (result.stderr : Buffer).toString().trim(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_173_optional_arrow_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var f:Int->?Int->Void; 8 | var f:Int->?Int->?Int->?Int->?Int->Void; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var f:Int->?Int->Void; 17 | var f:Int->?Int->?Int->?Int->?Int->Void; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_181_property_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef ITokenizeLineResult = { 6 | var tokens(default, null) : Array; 7 | } 8 | 9 | --- 10 | 11 | typedef ITokenizeLineResult = { 12 | var tokens(default, null):Array; 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_183_type_check_this.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | return switch ((this:DiagnosticsKind)) {} 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | return switch ((this : DiagnosticsKind)) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_184_type_hint_in_overload.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | @:overload(function(key : String, defaultValue : T):T {}) 7 | @:overload(function(key : String):T {}) 8 | function get(key:String):Null; 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | @:overload(function(key:String, defaultValue:T):T {}) 15 | @:overload(function(key:String):T {}) 16 | function get(key:String):Null; 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_194_untyped_ternary.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class PrePreloader extends Sprite { 6 | public function new() { 7 | _url = (l_loaderInfo != null) ? untyped l_loaderInfo.parameters.gameUrl : _GAME_URL; 8 | _init(); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class PrePreloader extends Sprite { 15 | public function new() { 16 | _url = (l_loaderInfo != null) ? untyped l_loaderInfo.parameters.gameUrl : _GAME_URL; 17 | _init(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_196_ternary_anon_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var guarded = !AnyTypes.toBool(guard) ? function(t0, t1) return t0 == t1 : guard; 8 | foo; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var guarded = !AnyTypes.toBool(guard) ? function(t0, t1) return t0 == t1 : guard; 17 | foo; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_197_ternary_floats.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class TestManifold extends TestCase { 6 | override function _onMouseWheel(delta:Int):Void { 7 | var angle = UI.get().isShiftDown ? 1. : 5.; 8 | s.body.transform(p.x, p.y, a); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class TestManifold extends TestCase { 15 | override function _onMouseWheel(delta:Int):Void { 16 | var angle = UI.get().isShiftDown ? 1. : 5.; 17 | s.body.transform(p.x, p.y, a); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_201_ternary_with_opnot.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class ListControlRow 6 | { 7 | public function select(inIndex:Int,inFlags:Int=0) 8 | { 9 | mMultiSelect[s] = toggle ? !mMultiSelect[s] : true; 10 | mMultiSelect[s] = toggle ? ~1 : true; 11 | onMultiSelect(mMultiSelect); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class ListControlRow { 18 | public function select(inIndex:Int, inFlags:Int = 0) { 19 | mMultiSelect[s] = toggle ? !mMultiSelect[s] : true; 20 | mMultiSelect[s] = toggle ? ~1 : true; 21 | onMultiSelect(mMultiSelect); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_204_nested_while_loop.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Earcut { 6 | function foo() { 7 | do { 8 | while (true) {} 9 | } while (true); 10 | } 11 | 12 | function bar() { 13 | do { 14 | while (true) {} 15 | } while (true); 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Earcut { 22 | function foo() { 23 | do { 24 | while (true) {} 25 | } while (true); 26 | } 27 | 28 | function bar() { 29 | do { 30 | while (true) {} 31 | } while (true); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_205_ternary_with_macro_reification.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Macros { 6 | public static function buildNetworkSerializable() { 7 | macro { 8 | if (id < (isRPC ? $v{firstRPCID} : $v{firstFID})) {} 9 | } 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Macros { 16 | public static function buildNetworkSerializable() { 17 | macro { 18 | if (id < (isRPC ? $v{firstRPCID} : $v{firstFID})) {} 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_206_typedef_function_type_with_structure.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef ValueXYListenerCallback = {x:Float, y:Float}->Void; 6 | 7 | --- 8 | 9 | typedef ValueXYListenerCallback = {x:Float, y:Float}->Void; 10 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_217_type_hint_on_number.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var a = (10:A); 8 | var a = (10.0:A); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var a = (10 : A); 17 | var a = (10.0 : A); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_218_macro_reification_parens.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | macro function() { 8 | $i{field.name} (); 9 | } 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | public static function main() { 17 | macro function() { 18 | $i{field.name}(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_219_macro_reification_comma.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | cases.push(macro {name: $v{tp.name} , exec: new $tp()}); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | cases.push(macro {name: $v{tp.name}, exec: new $tp()}); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_22_is_operator_spacing.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | trace(("" is String)); 8 | is String; 9 | String String; 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main() { 17 | trace(("" is String)); 18 | is String; 19 | String 20 | String; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_241_metadata_with_parameter.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | 7 | class Main { 8 | @:overload(function()) 9 | static function main() { 10 | trace(@:privateAccess (X).object); 11 | } 12 | } 13 | 14 | 15 | --- 16 | 17 | class Main { 18 | @:overload(function()) 19 | static function main() { 20 | trace(@:privateAccess (X).object); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_251_space_after_anon_function.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "parenConfig": { 4 | "anonFuncParamParens": { 5 | "openingPolicy": "before" 6 | } 7 | } 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | function loadAndTrace() { 15 | load().handle(function (res) trace(res)); 16 | } 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | function loadAndTrace() { 23 | load().handle(function (res) trace(res)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_251_space_after_anon_function_empty.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "parenConfig": { 4 | "anonFuncParamParens": { 5 | "openingPolicy": "around", 6 | "closingPolicy": "around", 7 | "removeInnerWhenEmpty": false 8 | } 9 | } 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | function loadAndTrace() { 17 | load().handle(function () trace(res)); 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | function loadAndTrace() { 25 | load().handle(function ( ) trace(res)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_263_metatdata_do.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | 7 | class Main { 8 | function loadAndTrace() { 9 | @when(connectionEstablished) @do(cnx) cnx.send(message); 10 | } 11 | } 12 | 13 | 14 | --- 15 | 16 | class Main { 17 | function loadAndTrace() { 18 | @when(connectionEstablished) @do(cnx) cnx.send(message); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_273_arrow_function_type_hint_in_call.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | 7 | class Main { 8 | public static function main() { 9 | var f = (a:Int, b:Int) -> 0; 10 | foo((a:Int, b:Int) -> 0); 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static function main() { 18 | var f = (a:Int, b:Int) -> 0; 19 | foo((a:Int, b:Int) -> 0); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_284_type_check_in_array_comprehension.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | [for (i in 0...1) ("" : String).length]; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | [for (i in 0...1) ("" : String).length]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_308_whitespace_after_comma.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | foo(a, (b, c) -> d); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | foo(a, (b, c) -> d); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_31_space_before_comma_in_objects.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | trace([{i:0},{i:1}]); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | trace([{i: 0}, {i: 1}]); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_327_between_conditional_and_metadata.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | var foo = #if js @:privateAccess foo.bar; #else bar.foo; #end 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var foo = #if js @:privateAccess foo.bar; #else bar.foo; #end 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_335_missing_space_after_conditional.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | add(#if (php || as3) (v ? 'true' : 'false') #else v #end); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | add(#if (php || as3) (v ? 'true' : 'false') #else v #end); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_337_type_parameter_with_structure_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | function foo() {} 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | function foo() {} 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_345_conditionalised_function_parameters.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | static function foo(#if openfl ?vector:openfl.Vector #end) {} 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | static function foo(#if openfl ?vector:openfl.Vector #end) {} 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_348_unary_after_condition.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | function test () { 8 | if (#if openfl_power_of_two! image.powerOfTwo || #end (!image.premultiplied && image.transparent)) 9 | {} 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | function test() { 17 | if (#if openfl_power_of_two !image.powerOfTwo || #end (!image.premultiplied && image.transparent)) {} 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_35_space_after_gt_return_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "sameLine": { 3 | "functionBody": "same" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Foo { 10 | function foo():Option return None; 11 | } 12 | 13 | --- 14 | 15 | class Foo { 16 | function foo():Option return None; 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_361_else_with_echecktype.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | return if (!Std.is(raw(), Array)) list(raw()) else (raw() : Array); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | return if (!Std.is(raw(), Array)) list(raw()) else (raw() : Array); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_36_space_remove_after_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main {function foo():{i:Int}{return{i:0};}} 6 | 7 | --- 8 | 9 | class Main { 10 | function foo():{i:Int} { 11 | return {i: 0}; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_374_echecktype_detection.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | ((cast e).__constructs__ : Array).copy(); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | ((cast e).__constructs__ : Array).copy(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_37_ternary_with_comparison.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function main() { 7 | setNext(transform != null?transform.alphaMultiplier:1.0); 8 | angle = ((y < 0) ? -angle:angle) * FlxAngle.TO_DEG; 9 | len == null?foo:bar; 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | function main() { 17 | setNext(transform != null ? transform.alphaMultiplier : 1.0); 18 | angle = ((y < 0) ? -angle : angle) * FlxAngle.TO_DEG; 19 | len == null ? foo : bar; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_395_echecktype_with_conditional.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | __bytePointer.set(#if flash byteArray #else (byteArray : ByteArrayData) #end, byteArray.position); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | __bytePointer.set(#if flash byteArray #else (byteArray : ByteArrayData) #end, byteArray.position); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_39_space_in_const_type_parameter.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | abstract Tls(hl.Abstract<"hl_tls">) {} 6 | 7 | --- 8 | 9 | abstract Tls(hl.Abstract<"hl_tls">) {} 10 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_426_arrow_function_map_literal.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | var map:MapSomeEnum> = ["a" => _ -> Foo]; 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | var map:MapSomeEnum> = ["a" => _ -> Foo]; 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_441_array_literal_block_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | [ /* foo */]; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | [/* foo */]; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_446_conditional_function_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function foo() #if foo :SomeType #end { 7 | bar; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function foo() #if foo :SomeType #end { 15 | bar; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_46_at_final_spacing.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | @:final static function main() {} 7 | @:final 8 | static function main() {} 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | @:final static function main() {} 15 | 16 | @:final 17 | static function main() {} 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_513_return_popen.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | return () -> trace("hello world"); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | return () -> trace("hello world"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_543_ifPolicy_after_else.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "ifPolicy": "onlyBefore" 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main { 10 | static function main() { 11 | return if(self == id) self else id; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | return if(self == id) self else id; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_55_semicolon_after_sharp_end.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static inline function get_onMobile():Bool { 7 | return #if foo true #else false #end 8 | ; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static inline function get_onMobile():Bool { 16 | return #if foo true #else false #end; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_562_arrow_function.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | var f = a -> a; 9 | return { 10 | x: a -> a, 11 | y: a -> a.id 12 | } 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | var f = a -> a; 21 | return { 22 | x: a -> a, 23 | y: a -> a.id 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_563_typed_interface_final.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | interface V { 7 | final v:Null; 8 | } 9 | 10 | --- 11 | 12 | interface V { 13 | final v:Null; 14 | } 15 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_588_anon_type_param.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "typeParamOpenPolicy": "after", 4 | "typeParamClosePolicy": "before" 5 | } 6 | } 7 | 8 | --- 9 | 10 | typedef Type = Array< {key:Int} >; 11 | 12 | --- 13 | 14 | typedef Type = Array< {key:Int} >; 15 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_591_call_parens.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "parenConfig": { 4 | "callParens": { 5 | "openingPolicy": "onlyAfter", 6 | "closingPolicy": "before" 7 | } 8 | }, 9 | "compressSuccessiveParenthesis": false 10 | } 11 | } 12 | 13 | --- 14 | 15 | 16 | var foo = bar1( {baz1: 0} ); 17 | var foo = macro bar2( ${baz2} ); 18 | 19 | 20 | --- 21 | 22 | var foo = bar1( {baz1: 0} ); 23 | var foo = macro bar2( ${baz2} ); 24 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_593_doc_comment_trailing_whitespace.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | 7 | /** 8 | * Line1 9 | * Line2 10 | */ 11 | class Main {} 12 | 13 | --- 14 | 15 | /** 16 | * Line1 17 | * Line2 18 | */ 19 | class Main {} 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_594_metatdata_in.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | 4 | --- 5 | 6 | class Main { 7 | @in var someVar = 123; 8 | @in(true) var someVar = 123; 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | @in var someVar = 123; 15 | @in(true) var someVar = 123; 16 | } 17 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_599_null_safe_navigation_operator.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | function main() { 6 | foo(bar)!.method(); 7 | } 8 | 9 | --- 10 | 11 | function main() { 12 | foo(bar)!.method(); 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_59_compress_parens_without_semicolon.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var x = {i: 0} 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | var x = {i: 0} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_607_anon_object_with_meta.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | return @patch { 8 | status: InProgress(v), 9 | } 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main() { 17 | return @patch 18 | { 19 | status: InProgress(v), 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_60_object_literal_with_string_identifier.hxtest: -------------------------------------------------------------------------------- 1 | 2 | {} 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | var x = {"i":0}; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var x = {"i": 0}; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_613_type_hints_in_arrow_function.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | foo((data:Some) -> { 8 | trace(1); 9 | }, (error:Error) -> { 10 | trace(2); 11 | }); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | foo((data:Some) -> { 20 | trace(1); 21 | }, (error:Error) -> { 22 | trace(2); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_615_bool_or_and_assign.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | x &&= y; 8 | x ||= z; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | static function main() { 16 | x &&= y; 17 | x ||= z; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_622_bracket.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | private typedef Init = haxe.macro.MacroType<[cdb.Module.build("data.cdb")]>; 6 | 7 | --- 8 | 9 | private typedef Init = haxe.macro.MacroType<[cdb.Module.build("data.cdb")]>; 10 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_62_case_with_pattern_guard.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | switch ["foo"] { 8 | case [value] if (value.indexOf("f") != -1): 9 | trace(value); 10 | case _: 11 | } 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | public static function main() { 19 | switch ["foo"] { 20 | case [value] if (value.indexOf("f") != -1): 21 | trace(value); 22 | case _: 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_634_is_as_import.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | import Std.is as isOfType; 6 | 7 | #if (haxe_ver >= 4.2) 8 | import Std.isOfType; 9 | #else 10 | import Std.is as isOfType; 11 | #end 12 | 13 | --- 14 | 15 | import Std.is as isOfType; 16 | #if (haxe_ver >= 4.2) 17 | import Std.isOfType; 18 | #else 19 | import Std.is as isOfType; 20 | #end 21 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_638_complextype_reification_ternary.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function main() { 7 | final type = true ? macro:String : macro:Int; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | function main() { 15 | final type = true ? macro :String : macro :Int; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_642_arrow_function_with_optional_arg.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | final f = (?options:{?foo:Bool, ?bar:Int}) -> {} 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | final f = (?options:{?foo:Bool, ?bar:Int}) -> {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_64_space_before_unary_minus.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | var foo = -1; 8 | var bar = -foo; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | var foo = -1; 17 | var bar = -foo; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_659_enum_type_params.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | enum Foo { 6 | Bar(options : Array); 7 | } 8 | 9 | --- 10 | 11 | enum Foo { 12 | Bar(options:Array); 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_660_macro_colon_type.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | function test() { 6 | switch type { 7 | case Foo: 8 | macro :Float; 9 | } 10 | } 11 | 12 | --- 13 | 14 | function test() { 15 | switch type { 16 | case Foo: 17 | macro :Float; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_66_whitespace_at_end_of_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | package; 6 | /** Test */ 7 | class Main {} 8 | 9 | --- 10 | 11 | package; 12 | 13 | /** Test */ 14 | class Main {} 15 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_67_whitespace_around_untyped.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | if (untyped false || !!document.documentMode) 8 | return untyped (o:IHxObject).__hx_getField(field, false, false, true); 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | public static function main() { 16 | if (untyped false || !!document.documentMode) 17 | return untyped (o : IHxObject).__hx_getField(field, false, false, true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_71_array_as_if_body.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | trace(if (false) [] else null); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | trace(if (false) [] else null); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_75_non_operator_is.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | if (is("")) {} 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | if (is("")) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_7_spaces_in_type_params_with_braces.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main{ 6 | static function main() { 7 | var a:Array<{value:Int}>; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | static function main() { 15 | var a:Array<{value:Int}>; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_84_type_parameter.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function equals(a1:Array, a2:Array):Bool {} 7 | } 8 | 9 | --- 10 | 11 | class Main { 12 | public static function equals(a1:Array, a2:Array):Bool {} 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_92_detect_function_style.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef RequestHandler = P->CancellationToken->(R->Void)->(ResponseError->Void)->Void; 6 | 7 | --- 8 | 9 | typedef RequestHandler = P->CancellationToken->(R->Void)->(ResponseError->Void)->Void; 10 | -------------------------------------------------------------------------------- /test/testcases/whitespace/issue_95_optional_enum_constuctor_arg.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | enum Item { 6 | Staff(block:Float, ?magic:Int); 7 | } 8 | 9 | --- 10 | 11 | enum Item { 12 | Staff(block:Float, ?magic:Int); 13 | } 14 | -------------------------------------------------------------------------------- /test/testcases/whitespace/mark_arrow_npe_with_conditionals.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | function prepareToSong() 6 | { 7 | #if (target.threaded) 8 | Thread.create(() -> { 9 | #end 10 | completedThread(); 11 | #if (target.threaded) 12 | }); 13 | #end 14 | } 15 | 16 | --- 17 | 18 | function prepareToSong() { 19 | #if (target.threaded) 20 | Thread.create(() -> { 21 | #end 22 | completedThread(); 23 | #if (target.threaded) 24 | }); 25 | #end 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/whitespace/negative_int.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | var exitCode:Int = try Sys.command(cmd, args) catch (e:Dynamic) -1; 9 | var exitCode:Int = if (true) -1 else -2; 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | static function main() { 17 | var exitCode:Int = try Sys.command(cmd, args) catch (e:Dynamic) -1; 18 | var exitCode:Int = if (true) -1 else -2; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/testcases/whitespace/not_with_popen.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "parenConfig": { 4 | "funcParamParens": { 5 | "openingPolicy": "before" 6 | }, 7 | "callParens": { 8 | "openingPolicy": "before" 9 | } 10 | } 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | function main() { 18 | var x = (! (last is PfostenGruppe)); 19 | } 20 | } 21 | 22 | --- 23 | 24 | class Main { 25 | function main () { 26 | var x = (!(last is PfostenGruppe)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/testcases/whitespace/single_line_comments.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main{ 6 | //************************* 7 | // Test 8 | // Test 9 | //Test 10 | /////////////////////////// 11 | static function main(){} 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | //************************* 18 | // Test 19 | // Test 20 | // Test 21 | /////////////////////////// 22 | static function main() {} 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/whitespace/single_line_comments_no_space.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace" : { 3 | "addLineCommentSpace": false 4 | } 5 | } 6 | 7 | --- 8 | 9 | class Main{ 10 | //************************* 11 | // Test 12 | // Test 13 | //Test 14 | /////////////////////////// 15 | static function main(){} 16 | } 17 | 18 | --- 19 | 20 | class Main { 21 | //************************* 22 | // Test 23 | // Test 24 | //Test 25 | /////////////////////////// 26 | static function main() {} 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/whitespace/space_in_anonymous_object.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main 6 | { 7 | static public function main() 8 | { 9 | var report = { 10 | coverage:{ 11 | 12 | } 13 | }; 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | static public function main() { 21 | var report = { 22 | coverage: {} 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testcases/whitespace/space_inside_anon_type_hint.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "indentation": { 3 | "character": " " 4 | }, 5 | "whitespace" : { 6 | "bracesConfig": { 7 | "anonTypeBraces": { 8 | "openingPolicy": "around", 9 | "closingPolicy": "around", 10 | "removeInnerWhenEmpty": false 11 | } 12 | } 13 | } 14 | } 15 | 16 | --- 17 | 18 | interface Test { 19 | public function peer():{ host:Host }; 20 | } 21 | 22 | --- 23 | 24 | interface Test { 25 | public function peer():{ host:Host }; 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/whitespace/static_locals.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | static final @Test a = 1, b = 2; 9 | static var c, d; 10 | final e = 2; 11 | var f; 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | static final @Test a = 1, b = 2; 20 | static var c, d; 21 | final e = 2; 22 | var f; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/whitespace/typedef_extension_gt_space.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | typedef Foo = {}; 6 | 7 | typedef Foo = {} 8 | 9 | typedef Bar = { 10 | > Foo, var foo:Int; var bar:Int; 11 | } 12 | 13 | --- 14 | 15 | typedef Foo = {}; 16 | typedef Foo = {} 17 | 18 | typedef Bar = { 19 | > Foo, 20 | var foo:Int; 21 | var bar:Int; 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/whitespace/var_meta_data.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | function main () { 7 | var @:name name = 'Foo'; 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | function main() { 15 | var @:name name = 'Foo'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/testcases/whitespace/whitespace_after_object_literal.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | 7 | class Main { 8 | static function main() { 9 | switch (foo) { 10 | case {kind: TkIdent, text: "error"}: 11 | doSomething(); 12 | } 13 | {f: macro ${a},} 14 | } 15 | } 16 | 17 | --- 18 | 19 | class Main { 20 | static function main() { 21 | switch (foo) { 22 | case {kind: TkIdent, text: "error"}: 23 | doSomething(); 24 | } 25 | {f: macro ${a},} 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/testcases/whitespace/whitespace_after_type_parameter.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "whitespace": { 3 | "parenConfig": { 4 | "funcParamParens": { 5 | "openingPolicy": "before" 6 | } 7 | } 8 | } 9 | } 10 | 11 | 12 | --- 13 | 14 | 15 | class Main { 16 | static function main():Array {} 17 | } 18 | 19 | --- 20 | 21 | class Main { 22 | static function main ():Array {} 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/wrapping/array_of_3_objects.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | var fields:Array = [{field: "type", expr: macro "object"}, 7 | {field: "properties", expr: props}, 8 | {field: "additionalProperties", expr: macro false}]; 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | var fields:Array = [ 15 | {field: "type", expr: macro "object"}, 16 | {field: "properties", expr: props}, 17 | {field: "additionalProperties", expr: macro false} 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_155_single_line_comments_in_array.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main 6 | { 7 | public static inline function hex2rgb(hex:Int):Array { 8 | return [hex >> 16 & 0xFF, //R 9 | hex >> 8 & 0xFF, //G 10 | hex & 0xFF]; //B 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | public static inline function hex2rgb(hex:Int):Array { 18 | return [hex >> 16 & 0xFF, // R 19 | hex >> 8 & 0xFF, // G 20 | hex & 0xFF]; // B 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_180_middle_of_function_call.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function main() { 7 | commands.executeCommand("editor.action.showReferences", Uri.parse(uri), copyPosition(position), locations).then(function(s) trace(s), function(s) trace("err: " + s)); 8 | } 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function main() { 15 | commands.executeCommand("editor.action.showReferences", Uri.parse(uri), copyPosition(position), locations) 16 | .then(function(s) trace(s), function(s) trace("err: " + s)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_192_wrapping_function_with_comment.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | public static function open(url:String = null, floating:Bool = false, 7 | ?useWideViewPort:Bool = false // Android only 8 | ):Void {} 9 | } 10 | 11 | --- 12 | 13 | class Main { 14 | public static function open(url:String = null, floating:Bool = false, ?useWideViewPort:Bool = false // Android only 15 | ):Void {} 16 | } 17 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_238_keep_wrapping_array.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "wrapping": { 3 | "arrayWrap": { 4 | "defaultWrap": "keep", 5 | "rules": [] 6 | } 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | static function main():Void { 14 | var arr = [ 15 | 0, 16 | 0, 0, //test comment 17 | 0, 0, 18 | 0, 19 | ]; 20 | } 21 | } 22 | 23 | --- 24 | 25 | class Main { 26 | static function main():Void { 27 | var arr = [ 28 | 0, 29 | 0, 0, // test comment 30 | 0, 0, 31 | 0, 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_238_keep_wrapping_call.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "wrapping": { 3 | "callParameter": { 4 | "defaultWrap": "keep", 5 | "rules": [] 6 | } 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | static function main():Void { 14 | g.drawImage( 15 | tileset.img, 16 | ix * tileSize, 17 | iy * tileSize, 18 | tileSize, tileSize 19 | ); 20 | } 21 | } 22 | 23 | --- 24 | 25 | class Main { 26 | static function main():Void { 27 | g.drawImage( 28 | tileset.img, 29 | ix * tileSize, 30 | iy * tileSize, 31 | tileSize, tileSize 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_238_keep_wrapping_function_signature.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "wrapping": { 3 | "functionSignature": { 4 | "defaultWrap": "keep", 5 | "rules": [] 6 | } 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | public static inline function matrix( 14 | scaleX = 1.0, skewX = 0.0, 15 | moveX = 0.0, skewY = 0.0, 16 | scaleY = 1.0, moveY = 0.0 17 | ):FastMatrix3 { 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | public static inline function matrix( 25 | scaleX = 1.0, skewX = 0.0, 26 | moveX = 0.0, skewY = 0.0, 27 | scaleY = 1.0, moveY = 0.0 28 | ):FastMatrix3 {} 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_238_keep_wrapping_return_call.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "wrapping": { 3 | "callParameter": { 4 | "defaultWrap": "keep", 5 | "rules": [] 6 | } 7 | } 8 | } 9 | 10 | --- 11 | 12 | class Main { 13 | static function main():Void { 14 | return new FastMatrix3( 15 | scaleX, skewX, moveX, 16 | skewY, scaleY, moveY, 17 | 0, 0, 1 18 | ); 19 | } 20 | } 21 | 22 | --- 23 | 24 | class Main { 25 | static function main():Void { 26 | return new FastMatrix3( 27 | scaleX, skewX, moveX, 28 | skewY, scaleY, moveY, 29 | 0, 0, 1 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_311_line_break_before_popen.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | public static function main() { 8 | window.showQuickPick(items, {placeHolder: "Select Haxe Completion Provider"}).then(item -> if (item != null) 9 | displayArguments.selectProvider(item.label)); 10 | } 11 | } 12 | 13 | --- 14 | 15 | class Main { 16 | public static function main() { 17 | window.showQuickPick(items, {placeHolder: "Select Haxe Completion Provider"}) 18 | .then(item -> if (item != null) displayArguments.selectProvider(item.label)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_439_wrapping_function_header.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | override function setFunctionBreakPointsRequest(response:SetFunctionBreakpointsResponse, args:SetFunctionBreakpointsArguments) { 8 | foo; 9 | } 10 | } 11 | 12 | --- 13 | 14 | class Main { 15 | override function setFunctionBreakPointsRequest(response:SetFunctionBreakpointsResponse, args:SetFunctionBreakpointsArguments) { 16 | foo; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_443_matrix_wrapping_with_comments.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | foo([ 9 | a, // 10 | b // 11 | ]); 12 | } 13 | } 14 | 15 | --- 16 | 17 | class Main { 18 | static function main() { 19 | foo([ 20 | a, // 21 | b // 22 | ]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_444_array_wrapping_with_comments.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | class Main { 7 | static function main() { 8 | actualArgs = actualArgs.concat([ 9 | "-D", 10 | "display-details", // get more details in completion results, 11 | "--no-output" // prevent any generation 12 | ]); 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | static function main() { 20 | actualArgs = actualArgs.concat([ 21 | "-D", 22 | "display-details", // get more details in completion results, 23 | "--no-output" // prevent any generation 24 | ]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_472_comment_parameter.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | --- 5 | 6 | extern class Foo { 7 | public function new(thickness:Float = 0 /*NaN*/, pixelHinting:Bool = false, ?scaleMode:LineScaleMode, ?caps:CapsStyle, ?joints:JointStyle, 8 | miterLimit:Float = 3, fill:IGraphicsFill = null); 9 | } 10 | 11 | --- 12 | 13 | extern class Foo { 14 | public function new(thickness:Float = 0 /*NaN*/, pixelHinting:Bool = false, ?scaleMode:LineScaleMode, ?caps:CapsStyle, ?joints:JointStyle, 15 | miterLimit:Float = 3, fill:IGraphicsFill = null); 16 | } 17 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_516_literal_wrapping_with_postfix_exclamation.hxtest: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | --- 4 | 5 | class Main { 6 | static function main() { 7 | var object = { 8 | a: b, 9 | c: d!.e 10 | }; 11 | } 12 | } 13 | 14 | --- 15 | 16 | class Main { 17 | static function main() { 18 | var object = { 19 | a: b, 20 | c: d!.e 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_561_multiline_string_call_parameter_keep.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | "wrapping": { 3 | "callParameter": { 4 | "defaultWrap": "keep" 5 | } 6 | } 7 | } 8 | 9 | --- 10 | 11 | class Main 12 | { 13 | private function someFunc() 14 | { 15 | return hxx(' 16 |
17 | '); 18 | } 19 | } 20 | 21 | --- 22 | 23 | class Main { 24 | private function someFunc() { 25 | return hxx(' 26 |
27 | '); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/testcases/wrapping/issue_617_wrapping_of_arrow_function.hxtest: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | 4 | 5 | --- 6 | 7 | class Main { 8 | public static function main() { 9 | return [ 10 | foo.bar(dummy, dummy, dummy, dummy, dummy, dummy), 11 | () -> foo.bar(dummy, dummy, dummy, dummy, dummy), 12 | ]; 13 | } 14 | } 15 | 16 | --- 17 | 18 | class Main { 19 | public static function main() { 20 | return [ 21 | foo.bar(dummy, dummy, dummy, dummy, dummy, dummy), 22 | () -> foo.bar(dummy, dummy, dummy, dummy, dummy), 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /uglifyFormatter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p bin 4 | 5 | npx uglify-js-es6 run.js -o bin/formatter.uglify.js 6 | 7 | echo '#!/usr/bin/env node' > bin/formatter.js 8 | echo "" >> bin/formatter.js 9 | cat bin/formatter.uglify.js >> bin/formatter.js 10 | chmod 755 bin/formatter.js 11 | 12 | rm bin/formatter.uglify.js 13 | --------------------------------------------------------------------------------