File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 13
13
using System . IO ;
14
14
using System . Linq ;
15
15
using System . Text ;
16
- using System . Threading ;
17
16
using CSharp . Core ;
18
17
19
18
namespace CodeIngestLib ;
@@ -83,7 +82,7 @@ public Ingester(IngestOptions options)
83
82
progress . Progress = ( int ) ( 100.0 * ( i + 1.0 ) / sourceFiles . Length ) ;
84
83
}
85
84
86
- using var reader = new StreamReader ( sourceFile . OpenRead ( ) , Encoding . UTF8 ) ;
85
+ using var reader = new StreamReader ( sourceFile . FullName , Encoding . UTF8 ) ;
87
86
88
87
writer . WriteLine ( $ "// File: { ( m_options . UseFullPaths ? sourceFile . FullName : sourceFile . Name ) } ") ;
89
88
@@ -136,9 +135,18 @@ private static string GetCodeLine(string line)
136
135
var commentIndex = line . IndexOf ( "//" , StringComparison . Ordinal ) ;
137
136
if ( commentIndex >= 0 )
138
137
line = line [ ..commentIndex ] ;
138
+
139
+ if ( line . Contains ( '\t ' ) )
140
+ line = line . Replace ( '\t ' , ' ' ) ;
141
+ if ( ! line . Contains ( ' ' ) )
142
+ return line ;
139
143
144
+ // Strip spaces around operators.
140
145
foreach ( var expr in SymbolsToCollapse )
141
- line = line . Replace ( $ "{ expr } ", expr ) . Replace ( $ " { expr } ", expr ) ;
146
+ {
147
+ if ( line . Contains ( expr ) )
148
+ line = line . Replace ( $ "{ expr } ", expr ) . Replace ( $ " { expr } ", expr ) ;
149
+ }
142
150
143
151
while ( line . Contains ( " " ) )
144
152
line = line . Replace ( " " , " " ) ;
You can’t perform that action at this time.
0 commit comments