@@ -132,7 +132,7 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
132
132
var diagnostics []api.Diagnostic
133
133
var diagnosticsLock sync.Mutex
134
134
errorsCount := 0
135
-
135
+
136
136
// Track source files for encoding
137
137
sourceFiles := make (map [string ]* ast.SourceFile )
138
138
var sourceFilesLock sync.Mutex
@@ -185,12 +185,7 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
185
185
186
186
diagnostics = append (diagnostics , diagnostic )
187
187
errorsCount ++
188
-
189
- // Track source file for encoding
190
- sourceFilesLock .Lock ()
191
- filePath := tspath .ConvertToRelativePath (d .SourceFile .FileName (), comparePathOptions )
192
- sourceFiles [filePath ] = d .SourceFile
193
- sourceFilesLock .Unlock ()
188
+
194
189
}
195
190
196
191
// Run linter
@@ -200,6 +195,11 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
200
195
allowedFiles ,
201
196
utils .ExcludePaths ,
202
197
func (sourceFile * ast.SourceFile ) []linter.ConfiguredRule {
198
+ // Track source file for encoding
199
+ sourceFilesLock .Lock ()
200
+ filePath := tspath .ConvertToRelativePath (sourceFile .FileName (), comparePathOptions )
201
+ sourceFiles [filePath ] = sourceFile
202
+ sourceFilesLock .Unlock ()
203
203
return utils .Map (rulesWithOptions , func (r RuleWithOption ) linter.ConfiguredRule {
204
204
205
205
return linter.ConfiguredRule {
@@ -219,7 +219,7 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
219
219
if diagnostics == nil {
220
220
diagnostics = []api.Diagnostic {}
221
221
}
222
-
222
+
223
223
// Create response
224
224
response := & api.LintResponse {
225
225
Diagnostics : diagnostics ,
@@ -232,7 +232,7 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
232
232
encodedSourceFiles := make (map [string ]api.ByteArray )
233
233
for filePath , sourceFile := range sourceFiles {
234
234
encoded , err := api .EncodeAST (sourceFile , filePath )
235
-
235
+
236
236
if err != nil {
237
237
// Log error but don't fail the entire request
238
238
fmt .Fprintf (os .Stderr , "warning: failed to encode source file %s: %v\n " , filePath , err )
0 commit comments