svelte-intellij icon indicating copy to clipboard operation
svelte-intellij copied to clipboard

Long function calls inside Svelte expressions aren't wrapped

Open ghost opened this issue 4 years ago • 7 comments

ghost avatar Aug 11 '20 16:08 ghost

Please update to 0.13.0

tomblachut avatar Aug 11 '20 17:08 tomblachut

Update isn't available in the Plugin page of PhpStorm and even after trying to install 0.13.0 with the zip PhpStorm rejects it with "Plugin 'Svelte' is incompatible with this installation".

ghost avatar Aug 12 '20 15:08 ghost

I guess you have version 2019. Sorry about that but I don't have capacity to maintain compatibility with older products. This is an evening side project

tomblachut avatar Aug 13 '20 08:08 tomblachut

I updated now but it still doesn't seem to break long lines. Do I have to do something other than execute the action "Reformat Code"?

ghost avatar Aug 13 '20 15:08 ghost

It should work, maybe there is a bug :) Please paste the code you want to format.

tomblachut avatar Aug 14 '20 13:08 tomblachut

Of course. Here you go:

<table class="uk-table uk-table-small uk-table-divider">
	<tbody>
		<tr>
			<td>Stars</td>
			<td>{stats.player.achievements.bedwars_level}</td>
		</tr>
		<tr>
			<td>Wins</td>
			<td>{stats.player.achievements.bedwars_wins}</td>
		</tr>
		<tr>
			<td>Games Played</td>
			<td>{stats.player.stats.Bedwars.games_played_bedwars_1}</td>
		</tr>
		<tr>
			<td>Winstreak</td>
			<td>{Math.max(stats.player.stats.Bedwars.eight_one_winstreak, stats.player.stats.Bedwars.eight_two_winstreak, stats.player.stats.Bedwars.eight_two_ultimate_winstreak, stats.player.stats.Bedwars.four_three_winstreak, stats.player.stats.Bedwars.four_four_winstreak)}</td>
		</tr>
		<tr>
			<td>Games Played</td>
			<td>{stats.player.stats.Bedwars.games_played_bedwars_1}</td>
		</tr>
	</tbody>
</table>

ghost avatar Aug 14 '20 16:08 ghost

image Well this is certainly weird.

For now you'll need to add newlines yourself or use Prettier. And to be honest this expression should be refactored to dedicated variable/function/component

tomblachut avatar Aug 15 '20 10:08 tomblachut

Migrated to WEB-61846 Svelte: format long markup expressions

tomblachut avatar Jul 05 '23 16:07 tomblachut