You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to figure out how to insert an import statement after a comment block at the top of a file. The sample input is:
/** * This is a code block I want to add an import statement after */// something else constthar='that';
and I'd like to insert:
import{SomeClass}from'my-module';
after the first block to produce:
/** * This is a code block I want to add an import statement after */import{SomeClass}from'my-module';// something else constthar='that';
I wrote a visitor look for comments and append my import declaration, but it seems like when I run that code it doesn't change the output at all. Here's the transformer I came up with:
what's more curious is that if I reduce the input script to just the top comment block, then running this transformer actually removes all the code in the input.
The text was updated successfully, but these errors were encountered:
Hi, I'm trying to figure out how to insert an
import
statement after a comment block at the top of a file. The sample input is:and I'd like to insert:
after the first block to produce:
I wrote a visitor look for comments and append my import declaration, but it seems like when I run that code it doesn't change the output at all. Here's the transformer I came up with:
(view in astexplorer)
what's more curious is that if I reduce the input script to just the top comment block, then running this transformer actually removes all the code in the input.
The text was updated successfully, but these errors were encountered: