54
54
import org .openrewrite .kotlin .marker .*;
55
55
import org .openrewrite .kotlin .tree .K ;
56
56
import org .openrewrite .marker .Markers ;
57
+ import org .openrewrite .style .NamedStyles ;
57
58
58
59
import java .nio .charset .Charset ;
59
60
import java .nio .file .Path ;
@@ -79,6 +80,7 @@ public class KotlinParserVisitor extends FirDefaultVisitor<J, ExecutionContext>
79
80
private final String source ;
80
81
private final Charset charset ;
81
82
private final boolean charsetBomMarked ;
83
+ private final List <NamedStyles > styles ;
82
84
private final KotlinTypeMapping typeMapping ;
83
85
private final ExecutionContext ctx ;
84
86
private final FirSession firSession ;
@@ -90,12 +92,13 @@ public class KotlinParserVisitor extends FirDefaultVisitor<J, ExecutionContext>
90
92
91
93
private static final Pattern whitespaceSuffixPattern = Pattern .compile ("\\ s*[^\\ s]+(\\ s*)" );
92
94
93
- public KotlinParserVisitor (Path sourcePath , @ Nullable FileAttributes fileAttributes , EncodingDetectingInputStream source , JavaTypeCache typeCache , FirSession firSession , ExecutionContext ctx ) {
95
+ public KotlinParserVisitor (Path sourcePath , @ Nullable FileAttributes fileAttributes , EncodingDetectingInputStream source , List < NamedStyles > styles , JavaTypeCache typeCache , FirSession firSession , ExecutionContext ctx ) {
94
96
this .sourcePath = sourcePath ;
95
97
this .fileAttributes = fileAttributes ;
96
98
this .source = source .readFully ();
97
99
this .charset = source .getCharset ();
98
100
this .charsetBomMarked = source .isCharsetBomMarked ();
101
+ this .styles = styles ;
99
102
this .typeMapping = new KotlinTypeMapping (typeCache , firSession );
100
103
this .ctx = ctx ;
101
104
this .firSession = firSession ;
@@ -162,7 +165,7 @@ public J visitFile(FirFile file, ExecutionContext ctx) {
162
165
return new K .CompilationUnit (
163
166
randomId (),
164
167
Space .EMPTY ,
165
- Markers .EMPTY ,
168
+ Markers .build ( styles ) ,
166
169
sourcePath ,
167
170
fileAttributes ,
168
171
charset .name (),
0 commit comments