zed icon indicating copy to clipboard operation
zed copied to clipboard

Dart Autoformatting Issue with Semicolons in Code `;`

Open steevedevops opened this issue 11 months ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the feature

Dart formatting is encountering an unexpected behavior where adding a semicolon; at the end of a line of code triggers an automatic reformatting of the entire code block. This issue disrupts the intended formatting and layout, leading to inconsistencies and potential errors in the code. It's also important to note that we have already attempted to disable autoformatting in the editor, but the problem persists.

If applicable, add mockups / screenshots to help present your vision of the feature

image image

steevedevops avatar Feb 27 '24 12:02 steevedevops

I guess this behavior is triggered by "On Type Formatting" of the Dart LSP.

Try adding the following setting to deactivate this:

{
    "use_on_type_format": false 
}

PS: to avoid this more generally in Dart / Flutter, try using trailing commas

flo80 avatar Mar 03 '24 16:03 flo80

I guess this behavior is triggered by "On Type Formatting" of the Dart LSP.

Try adding the following setting to deactivate this:

{
    "use_on_type_format": false 
}

PS: to avoid this more generally in Dart / Flutter, try using trailing commas

Thankyou @flo80 it work nice now

steevedevops avatar Mar 04 '24 01:03 steevedevops