rebornix / logseq-open-in-code

MIT License
28 stars 5 forks source link

Path does not exist #7

Closed nikhilmaddirala closed 8 months ago

nikhilmaddirala commented 1 year ago

Hi, I'm getting this error when trying to open current page (titled "logseq-gtd") in VS Code

image
adxsoft commented 1 year ago

Same for me on Mac 0.9.1 version

rebornix commented 1 year ago

It seems like a breaking change from logseq. I'll take a look

compadrejunior commented 1 year ago

Same problem here in Windows 11.

mrdavidlaing commented 1 year ago

Same for me, with versions:

Open in VS Code: v0.0.5 OS: Mac OS 13.4 (22F66) Logseq: 0.9.8 (0.9.8) VS Code: 1.78.2 (Universal)

What happens

Whilst all the other menu options work, when I try the "Edit current page" option image

VS Code opens showing the following error:

image

What I expect to happen

The current page is opened in VSCode without an error

Ideas

It looks like its trying to open an absolute path - /pages/Note.md without including the full path to the graph folder.

adxsoft commented 1 year ago

Unfortunately this issue (a showstopper) is still not working after several months despite a PR with the fix being submitted. I understand the developer probably is busy but it would be appreciated by many logseq users if the PR could be integrated and the plugin re-issued.

This is such a useful plugin and its a shame not to be able to use it anymore.

TIA

mrdavidlaing commented 1 year ago

FWIW, you can manually patch the fix from https://github.com/rebornix/logseq-open-in-code/pull/8 into ~/.logseq/plugins/logseq-open-in-code/dist/assets/index.64104ec8.js by replacing:

async function Ai(e){const t=await logseq.DB.datascriptQuery(`[:find ?file
                :where
                [?b :file/path ?file]
                [(== ?b ${e})]
            ]`);return t&&t.length>0?t[0][0]:null}

with

async function Ai(e){const graph = await logseq.App.getCurrentGraph(); const t=await logseq.DB.datascriptQuery(`[:find ?file
                :where
                [?b :file/path ?file]
                [(== ?b ${e})]
            ]`);return t&&t.length>0?(graph.url.replace("logseq_local_", "") + "/" + t[0][0]):null}

Disable / enable the "Open in VS Code" plugin for the changes to have an effect

adxsoft commented 1 year ago

Thanks that works!

On Thu, 15 June 2023, 3:20 am David Laing, @.***> wrote:

FWIW, you can manually patch the fix from #8 https://github.com/rebornix/logseq-open-in-code/pull/8 into ~/.logseq/plugins/logseq-open-in-code/dist/assets/index.64104ec8.js by replacing:

async function Ai(e){const t=await logseq.DB.datascriptQuery([:find ?file :where [?b :file/path ?file] [(== ?b ${e})] ]);return t&&t.length>0?t[0][0]:null}

with

async function Ai(e){const graph = await logseq.App.getCurrentGraph(); const t=await logseq.DB.datascriptQuery([:find ?file :where [?b :file/path ?file] [(== ?b ${e})] ]);return t&&t.length>0?(graph.url.replace("logseqlocal", "") + "/" + t[0][0]):null}

Disable / enable the "Open in VS Code" plugin for the changes to have an effect

— Reply to this email directly, view it on GitHub https://github.com/rebornix/logseq-open-in-code/issues/7#issuecomment-1591692933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5V4HIV5MWCZEMH7PPKQQ3XLHXE7ANCNFSM6AAAAAAWVT572M . You are receiving this because you commented.Message ID: @.***>

sindoc commented 1 year ago

@mrdavidlaing Thanks for patching it here. If we make the change, as you describe it here, will it be safe after the potential future updates?

mrdavidlaing commented 1 year ago

In theory the next time the plugin is updated this "manual" patch will just get overwritten.

notuntoward commented 1 year ago

Hi, I'm getting this error when trying to open current page (titled "logseq-gtd") in VS Code image

Still broken in mid July. Windows 11.

e-zz commented 11 months ago

Hey guys, I just published a patched release here. Now you could manually reload from logseq the content in the released zip file to make it work.

And I also added two shortcuts for editting pages or graph folder in vscode. Check the plugin setting and change these shortcuts if you want.

rebornix commented 8 months ago

Fixed now via https://github.com/rebornix/logseq-open-in-code/pull/9

rebornix commented 8 months ago

0.0.7 has the fix released, thanks!