Skip to content

Commit

Permalink
refactor baseline code into a class, move some duplicated logic from …
Browse files Browse the repository at this point in the history
…both the language server and cli to the class and fix some bugs with the automatic baseline updating
  • Loading branch information
DetachHead committed Oct 2, 2024
1 parent 16f4a73 commit de76209
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 237 deletions.
7 changes: 5 additions & 2 deletions packages/pyright-internal/src/analyzer/sourceFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { SourceMapper } from './sourceMapper';
import { SymbolTable } from './symbol';
import { TestWalker } from './testWalker';
import { TypeEvaluator } from './typeEvaluatorTypes';
import { sortDiagnosticsAndMatchBaseline } from '../baseline';
import { BaselineHandler } from '../baseline';

// Limit the number of import cycles tracked per source file.
const _maxImportCyclesPerFile = 4;
Expand Down Expand Up @@ -1247,7 +1247,10 @@ export class SourceFile {
// Now add in the "unnecessary type ignore" diagnostics.
diagList = diagList.concat(unnecessaryTypeIgnoreDiags);

diagList = sortDiagnosticsAndMatchBaseline(this.fileSystem, configOptions.projectRoot, this._uri, diagList);
diagList = new BaselineHandler(this.fileSystem, configOptions.projectRoot).sortDiagnosticsAndMatchBaseline(
this._uri,
diagList
);

// If we're not returning any diagnostics, filter out all of
// the errors and warnings, leaving only the unreachable code
Expand Down
Loading

0 comments on commit de76209

Please sign in to comment.