Use MD LS for resolving all document links (#160238)

* Use MD LS for resolving all document links

This switches the markdown extension to use the markdown language service when resolving the link. This lets us delete a lot of code that was duplicated between the extension and the LS

* Pick up new ls version
This commit is contained in:
Matt Bierner
2022-09-07 20:55:14 -07:00
committed by GitHub
parent 0d6bf703ce
commit 2d27f8db6a
25 changed files with 84 additions and 980 deletions

View File

@@ -10,11 +10,8 @@ import { ILogger } from './logging';
import { MarkdownContributionProvider } from './markdownExtensions';
import { Slugifier } from './slugify';
import { ITextDocument } from './types/textDocument';
import { Disposable } from './util/dispose';
import { WebviewResourceProvider } from './util/resources';
import { isOfScheme, Schemes } from './util/schemes';
import { MdDocumentInfoCache } from './util/workspaceCache';
import { IMdWorkspace } from './workspace';
const UNICODE_NEWLINE_REGEX = /\u2028|\u2029/g;
@@ -434,27 +431,3 @@ function normalizeHighlightLang(lang: string | undefined) {
return lang;
}
}
export class MdParsingProvider extends Disposable implements IMdParser {
private readonly _cache: MdDocumentInfoCache<Token[]>;
public readonly slugifier: Slugifier;
constructor(
engine: MarkdownItEngine,
workspace: IMdWorkspace,
) {
super();
this.slugifier = engine.slugifier;
this._cache = this._register(new MdDocumentInfoCache<Token[]>(workspace, doc => {
return engine.tokenize(doc);
}));
}
public tokenize(document: ITextDocument): Promise<Token[]> {
return this._cache.getForDocument(document);
}
}