Add diagnostics for markdown links (#148578)

* Initial work on md link diagnostics

* Adding settings to enable/disable validation

* Add delay for recomputing diagnostics

* 💄

* Split test on diagnostics compute vs management

* Validate on file open

* Remove dianostics on file close

* Allow paths to folders

* Add validation configuration option
This commit is contained in:
Matt Bierner
2022-05-02 16:06:00 -07:00
committed by GitHub
parent 2108837fc1
commit eba8ef0547
11 changed files with 589 additions and 9 deletions

View File

@@ -222,7 +222,7 @@ export class MdLinkProvider implements vscode.DocumentLinkProvider {
document: SkinnyTextDocument,
token: vscode.CancellationToken
): Promise<vscode.DocumentLink[]> {
const allLinks = await this.getAllLinks(document);
const allLinks = await this.getAllLinks(document, token);
if (token.isCancellationRequested) {
return [];
}
@@ -256,8 +256,12 @@ export class MdLinkProvider implements vscode.DocumentLinkProvider {
}
}
public async getAllLinks(document: SkinnyTextDocument): Promise<MdLink[]> {
public async getAllLinks(document: SkinnyTextDocument, token: vscode.CancellationToken): Promise<MdLink[]> {
const codeInDocument = await findCode(document, this.engine);
if (token.isCancellationRequested) {
return [];
}
return Array.from([
...this.getInlineLinks(document, codeInDocument),
...this.getReferenceLinks(document, codeInDocument),