Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refine the hg-style.xml specification #2457

Merged
merged 5 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true

[*.{java,xml,py}]
indent_style = space
indent_size = 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why delete this code?

Copy link
Contributor Author

@returnToInnocence returnToInnocence Feb 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry sir, I didn't describe this clearly in main change

The reason for this change is that we encountered a problem while formatting the java code,

The intended effect of format is to automatically wrap and indent a line when it exceeds the maximum length of 100, which is a special case where the number of indented Spaces is eight

If the changes in the.editorConfig do not change, the indentation will change to 4, even though the code style has been set to 8

Before modification

img_v3_028c_a7aac239-0ec9-4b39-bc7f-3aa42f6f1cag

After modification

img_v3_028c_492f8f97-bc13-47a0-ba66-b4f675c0851g

Copy link
Contributor Author

@returnToInnocence returnToInnocence Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, but I've found a new solution that doesn't require deleting the above, but instead enables a special option in.editorconfig for indenting more than the maximum line wrap of a single character

I'll make a new commit, which will undo my changes to the.editorconfig section and add the options above

Mainly refer to the configuration of the spring-cloud project

30 changes: 27 additions & 3 deletions hugegraph-style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<option name="SOFT_MARGINS" value="100" />
<JavaCodeStyleSettings>
<option name="JD_P_AT_EMPTY_LINES" value="true" />
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
<option name="ANNOTATION_PARAMETER_WRAP" value="1" />
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="100" />
Expand All @@ -42,9 +44,6 @@
</value>
</option>
</JavaCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
Expand Down Expand Up @@ -74,8 +73,33 @@
<option name="WRAP_LONG_LINES" value="true" />
<option name="PARAMETER_ANNOTATION_WRAP" value="1" />
<option name="ENUM_CONSTANTS_WRAP" value="2" />
<option name="WRAP_ON_TYPING" value="1" />
<option name="SOFT_MARGINS" value="100" />
<option name="RIGHT_MARGIN" value="100" />
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_BLANK_LINES_BETWEEN_PACKAGE_DECLARATION_AND_HEADER" value="1" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="BLANK_LINES_AROUND_CLASS" value="1" />
<indentOptions>
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<option name="RIGHT_MARGIN" value="120" />
<option name="WRAP_ON_TYPING" value="1" />
<option name="SOFT_MARGINS" value="120" />
</codeStyleSettings>
Comment on lines +88 to +92
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good, set max 120 chars for xml is better (could avoid some bugs when format with 100)

<XML>
<option name="XML_TEXT_WRAP" value="0" />
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
<option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
</XML>
<Properties>
<option name="KEEP_BLANK_LINES" value="true" />
</Properties>
<codeStyleSettings language="yaml">
<option name="SPACE_WITHIN_BRACKETS" value="false" />
<option name="SPACE_WITHIN_BRACES" value="false" />
</codeStyleSettings>
</code_scheme>
Loading