Add basic markdown link completions

For #140602

Only normal links for now. Will add reference links later. Should support the forms:

- `[](dir/file.md)`
- `[](./dir/file.md)`
- `[](/root-dir/file.md)`
- `[](#header)`
- `[](./dir/file.md#header)`
This commit is contained in:
Matt Bierner
2022-01-12 18:12:51 -08:00
parent 351aa03df4
commit a4e529c759
11 changed files with 366 additions and 38 deletions

View File

@@ -8,17 +8,11 @@ import 'mocha';
import * as vscode from 'vscode';
import LinkProvider from '../features/documentLinkProvider';
import { InMemoryDocument } from './inMemoryDocument';
import { noopToken } from './util';
const testFile = vscode.Uri.joinPath(vscode.workspace.workspaceFolders![0].uri, 'x.md');
const noopToken = new class implements vscode.CancellationToken {
private _onCancellationRequestedEmitter = new vscode.EventEmitter<void>();
public onCancellationRequested = this._onCancellationRequestedEmitter.event;
get isCancellationRequested() { return false; }
};
function getLinksForFile(fileContents: string) {
const doc = new InMemoryDocument(testFile, fileContents);
const provider = new LinkProvider();