Skip to content

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

@lolmaus

Description

@lolmaus

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions