microsoft / microsoft/TypeScript
Expose "getNewLineCharacter" function
Open
Nobody has claimed this yet.
Domain: API
In Discussion
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
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)
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing ts.getNewLineCharacter implementation and its public compiler API declarations. Read how FormatDiagnosticsHost and the newLine compiler option are currently exposed, then make the function publicly callable and verify that the example use case can obtain the selected newline character.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100