prmichaelsen / linenoteplus

Annotate lines of code with Markdown notes visible on hover.
https://marketplace.visualstudio.com/items?itemName=tkrkt.linenote
MIT License
3 stars 0 forks source link

Error trying to delete note with command, delete icon does nothing. #6

Open dokmanc opened 1 year ago

dokmanc commented 1 year ago

When I execute the command "Line Note Plus: Remove note at the current position (Delete Note)", I get the following error:

[Window Title] Visual Studio Code

[Main Instruction] Command 'Line Note Plus: Remove note at current position (Delete Note)' resulted in an error

[Content] cannot open d:%5CGitHub%5CTest%5CPGP%5CApplicationSettings.cs. Detail: Unable to resolve resource d:%5CGitHub%5CTest%5CPGP%5CApplicationSettings.cs

[OK]

It doesn't seem to matter where on the line I put the cursor, or whether the cursor is on the comment line that is added or the line immediately below that is being documented, the result is the same.

Holding the control key down and clicking the waste bin icon does nothing. I can manually delete the comment line.

prmichaelsen commented 1 year ago

Thanks for the bug report. Would you be able to provide your OS? I suspect it may be a problem with Windows.

dokmanc commented 1 year ago

Windows 11 Pro Version 22H2 Windows Feature Experience Pack 1000.22662.1000.0 Processor 13th Gen Intel(R) Core(TM) i9-13900KF 3.00 GHz Installed RAM 64.0 GB (63.8 GB usable) System type 64-bit operating system, x64-based processor

dokmanc commented 1 year ago

I get the same result on my other machine: Processor Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz 2.21 GHz Installed RAM 32.0 GB (31.8 GB usable) System type 64-bit operating system, x64-based processor Edition Windows 10 Enterprise Version 22H2 OS build 19045.3448 Experience Windows Feature Experience Pack 1000.19044.1000.0

prmichaelsen commented 1 year ago

Thanks again. I'll let you know as soon as I've had a chance to take a look.

dokmanc commented 5 months ago

Your welcome

prmichaelsen commented 5 months ago

Did some refactoring, will publish an update soon. Hopefully this resolves your issue

dokmanc commented 5 months ago

Patrick, I appreciate the follow up. Unfortunately, I am still unable to delete the note when I click on the delete link. I don't know if this is worth pointing out but what I find surprising is that the reported error references the file file being documented by a note, not the note file itself. See error screen shot:

LineNotePlus-2024-05-27-ErrorOnDelete

Please let me know if I can provide further information. Thanks, Chad

prmichaelsen commented 5 months ago

Sorry, my response wasn't exactly clear, I made some changes but didn't release them yet. I just published v4.0.0 but there's no guarantee it fixes this issue.

I believe it has to do with Windows paths, which unfortunately I don't have a way of testing directly since I don't have a Windows machine.

As far as the error message, when the delete link is clicked, the extension opens the noted document and runs editor commands to delete the line. This is why the error is related to junk1.txt and not the note itself.

    registerCommand("linenoteplus.removeNote", async (uuid?: string) => {
      const _uuid = uuid || Note.matchUuidOnActiveLine(getEditor());
      if (_uuid) {
        // remove specified note (when invoked from the hover text)
        const note = getNoteCache().get(_uuid);
        if (note.line > -1) {
          const uri = vscode.Uri.parse(note.targetPath);
          const document = await vscode.workspace.openTextDocument(uri);
          const line = document.lineAt(note.line);
          const edit = new vscode.WorkspaceEdit();
          edit.delete(uri, line.rangeIncludingLineBreak);
          vscode.workspace.applyEdit(edit);
        }
        await note.remove();
        decorateDebounce();
      }
    }),

If it still doesn't work with the refactored v4.0.0, I can take a deeper dive. Thank you for your investigation.

dokmanc commented 5 months ago

I tried version 4 and got the error

ERR cannot open d:%5CSaved%5CJunk%5Cjunk1.txt. Detail: Unable to resolve resource d:%5CSaved%5CJunk%5Cjunk1.txt: Error: cannot open d:%5CSaved%5CJunk%5Cjunk1.txt. Detail: Unable to resolve resource d:%5CSaved%5CJunk%5Cjunk1.txt at r.h (p:\Users\chad\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:189812)

I am willing to do a screen share using Live Share or webEx if you want to remotely debug my PC...

prmichaelsen commented 5 months ago

No worries, I have an old windows machine I'll boot up and give it a shot with

dokmanc commented 5 months ago

I look forward to a new version. Thanks!

prmichaelsen commented 5 months ago

Thank you for your patience. I wasn't able to test it on my windows machine, but I added some error logging so I can better track down what's happening. Would you mind trying again and then pasting the error from the Output here?

dokmanc commented 5 months ago

Thanks. Here it is: console.ts:137 [Extension Host] {"stack":"Error: Timeout\n at Timeout._onTimeout (c:\Users\chad\.vscode\extensions\nodemodules\.pnpm\@opentelemetry+sdk-trace-base@1.18.1@opentelemetry+api@1.7.0\node_modules\@opentelemetry\sdk-trace-base\src\export\BatchSpanProcessorBase.ts:177:16)\n at listOnTimeout (node:internal/timers:573:17)\n at processTimers (node:internal/timers:514:7)","message":"Timeout","name":"Error"} C @ console.ts:137 $logExtensionHostMessage @ mainThreadConsole.ts:39 S @ rpcProtocol.ts:458 Q @ rpcProtocol.ts:443 M @ rpcProtocol.ts:373 L @ rpcProtocol.ts:299 (anonymous) @ rpcProtocol.ts:161 y @ event.ts:1196 fire @ event.ts:1227 fire @ ipc.net.ts:650 U.onmessage @ localProcessExtensionHost.ts:378 4notificationsAlerts.ts:42 [Error_0001]: Note with uuid "unfiled/ih8usgHjLSBfEaq5kLJopd.md" not found in document "d:\GitHub\crud\FilmCrud\Client\Shared\MainLayout.razor". c @ notificationsAlerts.ts:42 (anonymous) @ notificationsAlerts.ts:28 y @ event.ts:1196 z @ event.ts:1207 fire @ event.ts:1231 addNotification @ notifications.ts:228 notify @ notificationService.ts:253 (anonymous) @ mainThreadMessageService.ts:86 f @ mainThreadMessageService.ts:51 $showMessage @ mainThreadMessageService.ts:45 S @ rpcProtocol.ts:458 Q @ rpcProtocol.ts:443 M @ rpcProtocol.ts:373 L @ rpcProtocol.ts:299 (anonymous) @ rpcProtocol.ts:161 y @ event.ts:1196 fire @ event.ts:1227 fire @ ipc.net.ts:650 U.onmessage @ localProcessExtensionHost.ts:378 console.ts:137 [Extension Host] {"stack":"Error: Timeout\n at Timeout._onTimeout (c:\Users\chad\.vscode\extensions\nodemodules\.pnpm\@opentelemetry+sdk-trace-base@1.18.1@opentelemetry+api@1.7.0\node_modules\@opentelemetry\sdk-trace-base\src\export\BatchSpanProcessorBase.ts:177:16)\n at listOnTimeout (node:internal/timers:573:17)\n at processTimers (node:internal/timers:514:7)","message":"Timeout","name":"Error"}