ts-morph#IndentationText TypeScript Examples
The following examples show how to use
ts-morph#IndentationText.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: options.ts From gengen with MIT License | 6 votes |
generatorsOptions: ProjectOptions = {
compilerOptions: {
target: ScriptTarget.ES2018,
module: ModuleKind.CommonJS,
strict: true,
esModuleInterop: true
},
manipulationSettings: {
newLineKind: NewLineKind.CarriageReturnLineFeed,
quoteKind: QuoteKind.Single,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
indentationText: IndentationText.FourSpaces
}
}
Example #2
Source File: instructions.ts From adonis5-jwt with MIT License | 6 votes |
/**
*
* @returns
*/
async function getIntendationConfigForTsMorph(projectRoot: string) {
const indentConfig = await parseEditorConfig(projectRoot + "/.editorconfig");
let indentationText:IndentationText;
if (indentConfig.indent_style === "space" && indentConfig.indent_size === 2) {
indentationText = IndentationText.TwoSpaces;
} else if (indentConfig.indent_style === "space" && indentConfig.indent_size === 4) {
indentationText = IndentationText.FourSpaces;
} else if (indentConfig.indent_style === "tab") {
indentationText = IndentationText.Tab;
} else {
indentationText = IndentationText.FourSpaces;
}
let newLineKind:NewLineKind;
if (indentConfig.end_of_line === "lf") {
newLineKind = NewLineKind.LineFeed;
} else if (indentConfig.end_of_line === "crlf") {
newLineKind = NewLineKind.CarriageReturnLineFeed;
} else {
newLineKind = NewLineKind.LineFeed;
}
return { indentationText, newLineKind };
}