提交 b60525c1 编写于 作者: R rebornix

fix #101827.

上级 c50be444
......@@ -98,7 +98,13 @@ export class NotebookEditorInput extends EditorInput {
}
async saveAs(group: GroupIdentifier, options?: ISaveOptions): Promise<IEditorInput | undefined> {
if (!this._textModel) {
if (!this._textModel || !this.viewType) {
return undefined;
}
const provider = this._notebookService.getContributedNotebookProvider(this.viewType!);
if (!provider) {
return undefined;
}
......@@ -108,6 +114,21 @@ export class NotebookEditorInput extends EditorInput {
return undefined; // save cancelled
}
if (!provider.matches(target)) {
const patterns = provider.selector.map(pattern => {
if (pattern.excludeFileNamePattern) {
return `${pattern.filenamePattern} (exclude: ${pattern.excludeFileNamePattern})`;
}
return pattern.filenamePattern;
}).join(', ');
throw new Error(`File name ${target} is not supported by ${provider.providerDisplayName}.
Please make sure the file name matches following patterns:
${patterns}
`);
}
if (!await this._textModel.object.saveAs(target)) {
return undefined;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册