NomarCub / obsidian-open-vscode

Open vault in VSCode button for Obsidian.md
MIT License
99 stars 6 forks source link

Plugin doesn't work on Linux with Flatpak #11

Open RenanSantos7 opened 1 year ago

RenanSantos7 commented 1 year ago

Such as related on #3, I click on ribbon button and nothing happens.

System info:

Obsidian

VSCode

RenanSantos7 commented 1 year ago

I've tried this:

But it still doesn't work.

However, when I run code ~/Documentos/OneDrive/Obsidian/ on terminal, VSCode is opened with the vault folder normally.

NomarCub commented 1 year ago

If you specify the full path it'll probably work. If you follow the issue you linked to its conclusion, that was it for them too. I'll also add this to the readme.


In case it does not:

This probably has to do with shell path or command aliases. I don't know much about the subject and won't fix this anytime soon, sorry. I'll provide the info I have and help you troubleshoot though. Is there an error on the browser dev console within Obsidian? What does it say? You can access it with F12 or Ctrl + Shift + I.

This issue I had with another plugin and the links there could help explain and solve the problem too. Other plugins that execute in shell also had this problem (one more example), and there are a lot of them.

RenanSantos7 commented 12 months ago

I've turn 'Path to VSCode Workspace' value to /home/renan/Documentos/OneDrive/Obsidian/Renan and still doesn't work.

Obs.: 'OneDrive' on "Documentos" folder is a link.

On console there's this error report:

[openVSCode] exec error: Error: Command failed: code "/home/renan/Insync/renansantos.jus@outlook.com/OneDrive/Documentos/Obsidian/Renan"
/bin/sh: line 1: code: comand not found

But, if I run code "/home/renan/Insync/renansantos.jus@outlook.com/OneDrive/Documentos/Obsidian/Renan" on terminal it works.

RenanSantos7 commented 12 months ago

Such as recommended, I run which code and the package folder is usr/bin/code. So, just for test, I run this path on terminal, and VSCode was opened.

But, when I change the value for 'Template for executingcode CLI settings' to usr/bin/code '{{vaultpath}}', it still doesn't work.

Now I'm thinking that this problem occurs because Obsidian is a flatpak and runs in a sandbox, so it cannot run commands on the system scope, only into the sandbox.

NomarCub commented 12 months ago

Flatpak may affect it too, I wouldn't know how to help with that. What is the error on console when you set the template to usr/bin/code '{{vaultpath}}'?

RenanSantos7 commented 12 months ago

Flatpak may affect it too, I wouldn't know how to help with that. What is the error on console when you set the template to usr/bin/code '{{vaultpath}}'?

'Command not found' too

NomarCub commented 12 months ago

Could you try a different installation method for Obsidian? They have some here: https://obsidian.md/download. So we can see if it really is flatpak that makes this not work.

RenanSantos7 commented 11 months ago

I've made the following tests:

In both cases, the plugin works perfectly. The problem is really the flatpak.