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

Removes spaces in template literal strings (JS/TS) #359

Open
2 tasks done
lolmaus opened this issue Dec 12, 2023 · 0 comments
Open
2 tasks done

Removes spaces in template literal strings (JS/TS) #359

lolmaus opened this issue Dec 12, 2023 · 0 comments

Comments

@lolmaus
Copy link

lolmaus commented Dec 12, 2023

Please fill-in this template.

  • I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
  • I tried running code --disable-extensions and the issue did NOT present itself.

Delete the following condition if it doesn't apply to your case:

Issue

Visual Studio Code editorconfig-vscode
Version 1.85.0 2023-12-06 last updated 2021-11-09

Root .editorconfig File

# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false

Are there any other relevant .editorconfig files in your project? Yes / No

Visual Studio Code Setting Default User Workspace
editor.insertSpaces true ____ ____
editor.tabSize 4 2 _
editor.trimAutoWhitespace true ____ ____
files.autoSave "off" "___" "___"
files.insertFinalNewline false _____ _____
files.trimTrailingWhitespace false _____ _____

File opened

        expectTranspiled('templates/application.hbs').equalsCode(`          
          import { precompileTemplate } from "@ember/template-compilation";
          import helloWorld_ from "#embroider_compat/components/hello-world";
          import firstTarget_ from "#embroider_compat/components/first-target";
          import secondTarget_ from "#embroider_compat/components/second-target";
          export default precompileTemplate("<helloWorld_ @iAmAComponent={{firstTarget_}} /><helloWorld_ @iAmAComponent={{secondTarget_}} />", {
            moduleName: "my-app/templates/application.hbs",
            scope: () => ({
              helloWorld_,
              firstTarget_,
              secondTarget_,
            }),
          });
        `);

Expected behavior

The white space at the end of the first line is meaningful, i. e. it is part of a template literal string.

Actual behavior

The EditorConfig for VS Code extension removes trailing spaces on the first line on save, polluting the diff and breaking test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant