mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
Fix activation of linters on unopened files caused by markdown plugin (#80506)
* Fix bug causing a large number of linters to be activated due to the markdown extension opening TextDocuments during indexing * indentation problem * code review by @OmarTawfik * revert changed file * Code review: use nodejs' Buffer * fix ineffcient code code review comments * introduce SkinnyTextLine * refactor redundant code * revert changed files * formatting * remove empty line
This commit is contained in:
committed by
Matt Bierner
parent
9083016c89
commit
5db460d2fe
@@ -15,12 +15,17 @@ export interface TocEntry {
|
||||
readonly location: vscode.Location;
|
||||
}
|
||||
|
||||
export interface SkinnyTextLine {
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface SkinnyTextDocument {
|
||||
readonly uri: vscode.Uri;
|
||||
readonly version: number;
|
||||
readonly lineCount: number;
|
||||
|
||||
lineAt(line: number): SkinnyTextLine;
|
||||
getText(): string;
|
||||
lineAt(line: number): vscode.TextLine;
|
||||
}
|
||||
|
||||
export class TableOfContentsProvider {
|
||||
@@ -72,7 +77,8 @@ export class TableOfContentsProvider {
|
||||
text: TableOfContentsProvider.getHeaderText(line.text),
|
||||
level: TableOfContentsProvider.getHeaderLevel(heading.markup),
|
||||
line: lineNumber,
|
||||
location: new vscode.Location(document.uri, line.range)
|
||||
location: new vscode.Location(document.uri,
|
||||
new vscode.Range(lineNumber, 0, lineNumber, line.text.length))
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,13 +91,13 @@ export class TableOfContentsProvider {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const endLine = typeof end === 'number' ? end : document.lineCount - 1;
|
||||
const endLine = end !== undefined ? end : document.lineCount - 1;
|
||||
return {
|
||||
...entry,
|
||||
location: new vscode.Location(document.uri,
|
||||
new vscode.Range(
|
||||
entry.location.range.start,
|
||||
new vscode.Position(endLine, document.lineAt(endLine).range.end.character)))
|
||||
new vscode.Position(endLine, document.lineAt(endLine).text.length)))
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user