Ignore bulkedit previews for markdown references / renames (#148744)
Makes sure we don't pick up the fake documents created by the bulkedit-previewpull/148748/head
parent
d9ca0a3ef4
commit
c08941b87c
|
@ -90,7 +90,7 @@ export class VsCodeMdWorkspaceContents extends Disposable implements MdWorkspace
|
|||
|
||||
// Add opened files (such as untitled files)
|
||||
const openTextDocumentResults = await Promise.all(vscode.workspace.textDocuments
|
||||
.filter(doc => !foundFiles.has(doc.uri.toString()) && isMarkdownFile(doc)));
|
||||
.filter(doc => !foundFiles.has(doc.uri.toString()) && this.isRelevantMarkdownDocument(doc)));
|
||||
|
||||
return coalesce([...onDiskResults, ...openTextDocumentResults]);
|
||||
}
|
||||
|
@ -136,14 +136,18 @@ export class VsCodeMdWorkspaceContents extends Disposable implements MdWorkspace
|
|||
}));
|
||||
|
||||
this._register(vscode.workspace.onDidChangeTextDocument(e => {
|
||||
if (isMarkdownFile(e.document)) {
|
||||
if (this.isRelevantMarkdownDocument(e.document)) {
|
||||
this._onDidChangeMarkdownDocumentEmitter.fire(e.document);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private isRelevantMarkdownDocument(doc: vscode.TextDocument) {
|
||||
return isMarkdownFile(doc) && doc.uri.scheme !== 'vscode-bulkeditpreview';
|
||||
}
|
||||
|
||||
public async getMarkdownDocument(resource: vscode.Uri): Promise<SkinnyTextDocument | undefined> {
|
||||
const matchingDocument = vscode.workspace.textDocuments.find((doc) => doc.uri.toString() === resource.toString());
|
||||
const matchingDocument = vscode.workspace.textDocuments.find((doc) => this.isRelevantMarkdownDocument(doc) && doc.uri.toString() === resource.toString());
|
||||
if (matchingDocument) {
|
||||
return matchingDocument;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue