Skip to content

Expose "getNewLineCharacter" function #29581

@devversion

Description

@devversion

Suggestion

Make ts.getNewLineCharacter public

Use Cases

This is useful if developers create their own FormatDiagnosticsHost, but don't want to implement the logic to determine the newLine string based on the newLine compiler option.

Examples

    const formatHost: ts.FormatDiagnosticsHost = {
      getCurrentDirectory: () => projectDir || ts.sys.getCurrentDirectory(),
      getCanonicalFileName: fileName => fileName,
      getNewLine: () => ts.getNewLineCharacter(formatOptions)
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: APIRelates to the public API for TypeScriptIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions