Skip to content

Indentation issues in multiline template literals #152

Open
@jonsmithers

Description

@jonsmithers

Description

Auto-indent affects the indentation of all lines within a template literal. It seems to me that template literal contents should not be changed at all. Additionally, indentation for lines following a template literal should not be affected by indentation of the contents of the template literal.

To Reproduce

  1. Run vim --clean (to test runtime file packaged with vim)
  2. set ft=typescript
  3. Paste the following
const string = `
  when auto-indented, this line should not be changed
`;

const string = `
  (arbitrary nonsense)`;
  log('when auto-indented, this line should de-dented');
  1. Auto-indent line 2 (2G==). Observe that it is de-dented. It is expected to be unchanged.
  2. Auto-indent line 7 (7G==). Observe that it is not de-dented. It is expected to be de-dented.

Environment:

  • Vim: 8.1.2402
  • OS: Fedora 30
  • Terminal: Tilix

Additional context

(FYI, this issue is of interest to me because I currently maintain a "vim-html-template-literals" plugin that amends various js/ts syntax plugins to support html syntax inside of tagged template literals, which is useful when working with lit-html).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions