Skip to content

Invoking rewrap creates null character #13

Closed

Description

@wycats

I attempted to invoke rewrap on this comment:

/**
 * Corresponds to a path in expression position.
 *
 * ```hbs
 * this
 * this.x
 * @x
 * @x.y
 * x
 * x.y
 * ```
 *
 * ## Note
 *
 * An expression is **not** an `ASTv2.PathExpression` if it is a bare identifier and that identifier
 * is not in scope or a known keyword.
 *
 * In strict mode, all identifiers resolve to {@linkcode PathExpressions} or syntax errors if they
 * refer to variables that are not in scope.
 *
 * In classic mode, they
 * may also resolve to {@linkcode ResolvedAppendable}s, {@linkcode ResolvedHelperCallee},
 * {@linkcode ResolvedModifierCallee} or {@linkcode ResolvedComponentCallee}s.
 *
 * ### `ResolvedAppendable`
 *
 * ```hbs
 * {{hello @world}}
 * ```
 *
 * In this example, `hello` is not an `ASTv2.PathExpression`, since it is not in scope. Instead, it
 * is represented as a {@linkcode ResolvedAppendable}, since it may either be a component or helper,
 * depending on the value of `hello` resolved at runtime.
 *
 * ### `ResolvedHelperCallee`
 *
 * In this example:
 *
 * ```hbs
 * {{#let (helper 'hello') as |hello|}}
 *   {{hello (world)}}
 * {{/let}}
 * ```
 *
 * - `hello` is a `PathExpression`, since it is an in-scope variable.
 * - `world` is a `ResolvedHelperCallee`, since the `()` syntax only allows free references to
 *   resolve to a helper.
 *
 * ### `PathExpression`
 *
 * Finally, in this example:
 *
 * ```hbs
 * {{#let @hello as |hello|}}
 *   {{hello @world}}
 *
 *   {{#let hello as |h|}}
 *      {{h @world}}
 *   {{/let}}
 * {{/let}}
 * </template>
 * ```
 *
 * Both `hello` and `h` are represented as `PathExpression`s, since they are in-scope variables.
 */

And rewrap replaced the spaces with nulls:

Image

I can reproduce the bug by creating a new file with just the comment in it, setting the language to TypeScript, and invoking rewrap.

Activity

  1. dnut commented on Oct 24, 2026

    @dnut
    Owner

    This has been fixed and released in version 18.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions