tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
485 stars 38 forks source link

EditorConfig options specific to IntelliJ are not applied in svelte components #183

Closed fehnomenal closed 1 year ago

fehnomenal commented 3 years ago

I tried to overwrite IntelliJ's default formatting options with a .editorconfig file. It works for the default options (like indent_size) but not for IntelliJ specific one (prefixed with ij_).

A little example:

# .editorconfig
root = true

[*]
indent_size = 2
indent_style = space

[{*.js, *.svelte}]
indent_size = 4

ij_javascript_force_semicolon_style = true
ij_javascript_use_semicolon_after_statement = true

ij_javascript_force_quote_style = true
ij_javascript_use_double_quotes = false
ij_javascript_spaces_within_imports = true
// util.js
export const utilityFunction = () => 34;
<!-- Component.js -->
<script>
    import {utilityFunction} from "util";

    const abc = utilityFunction()
</script>

<span>
    {abc}
</span>

I would expect the following changes after formatting the component file:

--- a/JsComponent.svelte
+++ b/JsComponent.svelte
@@ -1,7 +1,7 @@
 <script>
-    import {utilityFunction} from "util";
+    import { utilityFunction } from 'util';

-    const abc = utilityFunction()
+    const abc = utilityFunction();
 </script>

 <span>

These changes happen after configuring the code style in IntelliJ for JavaScript. So it seems that these additional options are ignored in the custom svelte HTML language.

tomblachut commented 1 year ago

We made lots of improvements around this problem during the last years. If the issue still persist please open another issue on YouTrack.