We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When declaring a new file with the leadingTrivia option, the comments are not added at the very top (= leading) section of the file.
leadingTrivia
Added imports will supersede the comments and comments will be bumped down.
Version: 20.0.0
To Reproduce
From playground.
import { Project, VariableDeclarationKind } from 'ts-morph'; export default function transform(project: Project) { project.getSourceFile('index.ts').delete() const f = project.createSourceFile('index.ts', { leadingTrivia: '// trivia', }) f.addImportDeclaration({ moduleSpecifier: 'vite', namedImports: ['defineConfig'], }) f.addVariableStatement({ declarationKind: VariableDeclarationKind.Const, declarations: [ { name: 'config', initializer: '1', }, ], }) };
Result:
import { defineConfig } from "vite"; // trivia const config = 1;
Expected behavior
Comments (trivia) to be added to the top of the file.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When declaring a new file with the
leadingTrivia
option, the comments are not added at the very top (= leading) section of the file.Added imports will supersede the comments and comments will be bumped down.
Version: 20.0.0
To Reproduce
From playground.
Result:
Expected behavior
Comments (trivia) to be added to the top of the file.
The text was updated successfully, but these errors were encountered: