Sublime Forum

Delete spaces at the end of string

#1

Hi

In some rows there is spacing at the end of string.
I dont know why it apears.
Is it possible to automatic clean it?

0 Likes

#2

you want a formatter (kind of) like php-cs-fixer. but your screenshot is not valid grammar. or maybe lsp + lsp-intelephense, which can do formatting as well.

0 Likes

#3

You mean for deleting such spaces i need code formatter like php-cs-fixer?
Maybe there is simple way? Thanks

0 Likes

#4

The two spaces are actually different. In you first screenshot, the spaces are in between a , & a ; (not trailing white spaces), but in your second screenshot, they appear to be trailing white spaces. For trailing white spaces, there is an easy way with the help of a setting

	// Controls where trailing white space is removed on save.
	// - "none": Do not remove any trailing white space on save.
	// - "all": Remove all trailing white space on save.
	// - "not_on_caret": Only remove white space that won't affect the caret.
	//                   When used in conjunction with "save_on_focus_lost" and
	//                   certain desktop environments that frequently make the
	//                   application lose focus this avoids the caret jumping
	//                   around a lot.
	"trim_trailing_white_space_on_save": "none",
2 Likes

#5

Thanks a lot!

0 Likes