mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user