microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.64k stars 28.67k forks source link

Error: Cannot register more than one working copy #113307

Closed jrieken closed 3 years ago

jrieken commented 3 years ago
Cannot register more than one working copy with the same resource vscode-notebook:/Users/jrieken/Code/_samples/devfest/foo/98172.github-issues
jrieken commented 3 years ago

This is a funny bug because it's how uri are handled internally. A cell-uri looks like this vscode-notebook-cell:/some/path.ghnb#000003. The fragment is the cell handle and needed for identification. The bug here is caused by

  1. the modes hover replacing the fragment with line/column numbers so that that opener service interprets them correctly
  2. the opener service looking for numeric fragments, removing them and using its value as selection-object

I have pushed two changes which

  1. fix the modes hover so that in uses a selection-object instead of changing the fragment
  2. prefixing the cell uri fragment with ch so that it doesn't get parsed as line number by the opener service.

So, the new format for cell uris is vscode-notebook-cell:/some/path.ghnb#ch000003 (ch stands for "cell handle"). fyi @weinand since I believe that you have a dependency on the format.