vscode: Untitled file service doesn't work with notebook view types

  • VS Code Version: Insiders
  • OS Version: Windows

Steps to Reproduce:

  1. Currently developing the .NET Interactive Notebooks extension (ms-dotnettools.dotnet-interactive-vscode)
  2. Our extension registers the notebook view type dotnet-interactive for files of type *.dib.
  3. When we try to create a new untitled notebook, we get an error: The file working copy resource untitled:Untitled-1.dib does not have an associated file system provider.

The following all fail in similar ways and all have the following code immediately preceeding this failure:

const viewType = 'dotnet-interactive'; // this was registered in `package.json`
const fileName = 'Untitled-1.dib'; // note, there is no existing editor with this name
const newUri = vscode.Uri.file(fileName).with({ scheme: 'untitled', path: fileName });
  1. vscode.commands.executeCommand('vscode.openWith', newUri);
  2. vscode.commands.executeCommand('vscode.openWith', newUri, viewType);
  3. vscode.notebook.openNotebookDocument(newUri);

This one just opens a text document, not a notebook:

  • vscode.commands.executeCommand('workbench.action.files.newUntitledFile', viewType);

Does this issue occur when all extensions are disabled?: N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Close as done

API proposal for creating untitled notebooks:

export function openNotebookDocument(viewType: string, data: NotebookData | undefined): Thenable<NotebookDocument>

Not really, no, because my understanding is that the content provider API is getting removed in the next stable release in ~1 week and we’ll be forced on to the serializer API.

The old API will stay around but we aren’t planning to finalize it any time soon and aren’t planning to fix issues for it

Independent on how we are going to implement the internals: on the API-level we should have something like openNotebookDocument({viewType: string, content?: Unit8Array }) which then allows to create a new, untitled notebook for a given view type and with some content