mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge from master
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as ts from 'typescript';
|
||||
import { PackageDocument } from './packageDocumentHelper';
|
||||
@@ -22,10 +20,10 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
const _linkProvider = new class implements vscode.DocumentLinkProvider {
|
||||
|
||||
private _cachedResult: { key: string; links: vscode.DocumentLink[] };
|
||||
private _cachedResult: { key: string; links: vscode.DocumentLink[] } | undefined;
|
||||
private _linkPattern = /[^!]\[.*?\]\(#(.*?)\)/g;
|
||||
|
||||
async provideDocumentLinks(document: vscode.TextDocument, token: vscode.CancellationToken): Promise<vscode.DocumentLink[]> {
|
||||
async provideDocumentLinks(document: vscode.TextDocument, _token: vscode.CancellationToken): Promise<vscode.DocumentLink[]> {
|
||||
const key = `${document.uri.toString()}@${document.version}`;
|
||||
if (!this._cachedResult || this._cachedResult.key !== key) {
|
||||
const links = await this._computeDocumentLinks(document);
|
||||
@@ -41,7 +39,7 @@ const _linkProvider = new class implements vscode.DocumentLinkProvider {
|
||||
const lookUp = await ast.createNamedNodeLookUp(text);
|
||||
|
||||
this._linkPattern.lastIndex = 0;
|
||||
let match: RegExpMatchArray;
|
||||
let match: RegExpMatchArray | null = null;
|
||||
while ((match = this._linkPattern.exec(text))) {
|
||||
|
||||
const offset = lookUp(match[1]);
|
||||
|
||||
Reference in New Issue
Block a user