alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.7k stars 163 forks source link

[BUG] - command 'bookmarks.toggle' not found error in V13.0.1 #395

Closed retrevino closed 3 years ago

retrevino commented 3 years ago

Hi Alessandro, good job with this Extension, I like so much, thanks for it!

Environment/version Windows

Steps to reproduce

  1. Open VSCode
  2. Open a Workspace that I already have; The workspace has many files open from various folders, using the File / Open File ... menu option.
  3. On any line, type Ctrl + Alt + K
  4. Show error command 'bookmarks.toggle' not found

Bookmark works fine if I open a single file or a Workspace from a Source Control, I don't use the Open Folder option.

The saveBookmarksInProject setting is off.

I read the issue #387, and followed the steps to uninstall and reinstall the extension, but it still won't activate for this particular case.

I've been using VSCode in Portable Mode for several versions of VSCode, just like this extension (Bookmark), and it was working all right.

Regards.

alefragnani commented 3 years ago

Hi @retrevino ,

Thanks for your kind words. I'm glad to know you like the extension 👍 .

About the issue, if VS Code version is not an issue, could you check for errors on the console? Call Developer Tools and select Console

Do this right after you open VS Code, and follow the opening of your workspace. Let's see if the extension raises some error, like #390.

I have found a fix for the Untitled files issue, and I guess "missing" files would follow a similar approach, but I still need to make it save/load the bookmarks, so it would be properly stored/restored when you reopen VS Code.

Hope this helps

retrevino commented 3 years ago

Thanks for your prompt response.

I followed the steps you show me.

  1. I started the VSCode, which by default loads the Workspace that was open the last time the VSCode was closed.
  2. I opened the Developer Tools.
  3. In the file shown by default, in which I was working, I selected a line and pressed Ctrl + Alt + K, and it showed the error, command 'bookmarks.toggle' not found.

I add the Log that the Console generated for the Bookmarks Extension.

/C:/PortableApps/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1734 Activating extension 'alefragnani.Bookmarks' failed: Cannot read property 'uri' of undefined.
_logMessageInConsole @ /C:/PortableApps/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1734
/C:/PortableApps/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:60 [Extension Host] Initialized vscode-mssql storage.
workbench.desktop.main.js:738 Command 'Bookmarks: Toggle' resulted in an error (command 'bookmarks.toggle' not found)
onDidChangeNotification @ workbench.desktop.main.js:738
(anonymous) @ workbench.desktop.main.js:738
fire @ workbench.desktop.main.js:55
addNotification @ workbench.desktop.main.js:740
error @ workbench.desktop.main.js:1604
accept @ workbench.desktop.main.js:646
async function (async)
accept @ workbench.desktop.main.js:646
(anonymous) @ workbench.desktop.main.js:623
fire @ workbench.desktop.main.js:55
(anonymous) @ workbench.desktop.main.js:560
fire @ workbench.desktop.main.js:55
(anonymous) @ workbench.desktop.main.js:560
samli111 commented 3 years ago

I also experienced this issue yesterday. After adding an empty folder to the workspace, it works for me now. Previously the workspace did not have any folder.

retrevino commented 3 years ago

I also experienced this issue yesterday. After adding an empty folder to the workspace, it works for me now. Previously the workspace did not have any folder.

Hi samli111! Thanks for your workarround. This worked for me too.

Greetings.

alefragnani commented 3 years ago

Hi @retrevino,

Thanks for the log. I'll dig on it to find out if it matches the scenarios I found

Just out of curiosity, when you say loads the Workspace that was open, are you referring to a VS Code Workspace (something.code-workspace file with multiple root folders) or is just some VS Code window, with random files (no folder at all)?

Could you show a print screen of your Explorer tab?

Thank you

alefragnani commented 3 years ago

Hi @samli111 ,

Thanks for your help 👍

Btw, could you provide the details on how your workspace is? Is it a something.code-workspace multi root folder, or a VS Code window with random files (no folder at all)?

Thank you

retrevino commented 3 years ago

Hi @alefragnani!

I don't use the workspace with folders, I use it with randomly opened files (no folders at all) and save it as something.code-workspace. I also use the VS Code with GitHub projects. In this scenario, Bookmarks does work. I attach an image with the Explorer tab of a Workspace where I only have random files.

WorkspaceBookmarks

retrevino commented 3 years ago

Hi @alefragnani!

I did the following exercise.

  1. I opened a new instance of VS Code.
  2. I added files from a folder, dragging them, I put several Bookmarks in several files, I saved the Workspace with the name Prueba.
  3. I closed the VS Code
  4. I opened another instance of VS Code.
  5. I opened the Prueba Workspace.

From here I checked how this turned out.

What I detected is that in certain files it does show the Bookmarks marks, but in others it does not, although it does have registered which files and lines are marked.

Prueba2

But in other cases it has a mark where it was not registered in the Bookmarks panel.

Hope this helps you.

Greetings and thanks for your great work.

samli111 commented 3 years ago

Hi @samli111 ,

Thanks for your help 👍

Btw, could you provide the details on how your workspace is? Is it a something.code-workspace multi root folder, or a VS Code window with random files (no folder at all)?

Thank you

Hi @alefragnani, again this bookmarks extension is very useful and thanks for the great job.

My workspace is something.code-workspace. It only contained some files, no folders. Today I added an empty folder to the workspace and the issue disappeared.

alefragnani commented 3 years ago

Hi @samli111 ,

Thanks for your kind words. That's always great to know the extension is useful 👍

TBH, I didn't know you could have a code-workspace with files only (no folder). I'm not sure how it works, because when you open Workspace Settings it does not show the file list, but only an empty folders entry. Anyway, I could reproduce the issue and I think the reason is only because of the random files scenario, when you you upgrade the extension (saved with v12 and opened in v13). If you create/save the bookmarks with v13 and load with 13, it works. It appears to be a migration issue (unsupported scenario).

I'm working on this, and I hope to release a fix ASAP. Since you found a workaround (add an empty folder on your workspace), I suggest you to wait for the fix.

alefragnani commented 3 years ago

Hi @retrevino ,

That's really weird 😕 . Showing bookmarks on the Side Bar, but not in the document is something that I didn't experienced. Could you please expand the side bar and double check the line/column it displays on details (just to be sure it's the you you expect)?

Thank you

alefragnani commented 3 years ago

Just published v13.0.2, which should fix the issue.

Feedbacks are welcome 😬

samli111 commented 3 years ago

Hi Alessandro, the issue can be reproduced with v13.0.2 as follows,

Environment/version: Windows 10 Extension version: 13.0.2 VSCode version: 1.53.2

Steps to reproduce,

  1. At VSCode, uninstall bookmarks extension. Close VSCode.
  2. Open VScode, install bookmarks extension (13.0.2). Close VScode.
  3. Open VScode, open a txt file
  4. Save workspace as test.code-workspace
  5. On any line, type Ctrl + Alt + K Show error command 'bookmarks.toggle' not found
alefragnani commented 3 years ago

Hi @samli111 ,

Couldn't reproduce the error with the steps you provided.

Just to be clear, the error I detected (and fixed) only happened when you upgrade the extension. I mean, the error occurred when your workspace with random files had bookmarks from v12 and you did upgrade to v13. In this case, the migration process was failing (uncovered scenario).

Otherwise, if you start a new VS Code window, opening random files and toggling bookmarks, it is working, at least on my tests, bot on MacOS and Windows (the only I have available).

Could you pleas open the Developer Tools / Console to better detect when the error occurs?

Hope this helps

samli111 commented 3 years ago

Hi @alefragnani, Please see attached screen shot.

toggleError