microsoft / vscode-docs

Public documentation for Visual Studio Code
http://code.visualstudio.com/docs
Other
5.71k stars 4.65k forks source link

How to add Open with VS Code context menu in Nautilus #873

Closed Tyriar closed 4 years ago

Tyriar commented 7 years ago

Might be worth adding a section to setup/linux

Context: https://github.com/Microsoft/vscode/issues/22036

fennecinspace commented 6 years ago

this would be great

ajomadlabs commented 6 years ago

Can I take up this issue

Tyriar commented 6 years ago

@ajomadlabs please 😃 a section in the FAQ here would be great https://github.com/Microsoft/vscode-docs/blob/master/docs/setup/linux.md#common-questions

ajomadlabs commented 6 years ago

@Tyriar Since this my first contribution can you tell me where to start off

gregvanl commented 6 years ago

Hi @ajomadlabs Have a look at this repo's README and CONTRIBUTING pages. Feel free to reach out to me if you have questions about providing content.

harry-cpp commented 6 years ago

On a related note, I tried @RicardoEPRodrigues extension, and turns out, its buggy and its missing stuff:

And so, I have decided to write one from scratch, enjoy: https://gist.github.com/cra0zy/f8ec780e16201f81ccd5234856546414

PS. I tried to do a cross between Tilix extension for Nautilus and Windows VS Code integration naming schemes

RicardoEPRodrigues commented 6 years ago

@cra0zy thank you for trying out my extension. It was just a prototype, so it's good enough to work, but it's still a long way to go!

Not allowing to open vs code from the current folder is a problem with using Nautilus Python extensions (or maybe my lack of experience), since I wasn't able to show the options in the current folder.

I'll try your extension and check in later.

harry-cpp commented 6 years ago

Not allowing to open vs code from the current folder is a problem with using Nautilus Python extensions (or maybe my lack of experience), since I wasn't able to show the options in the current folder.

No, its a separate method, my extension already fixed it all: vscodeext

RicardoEPRodrigues commented 6 years ago

Tested your extension. Yup, its very good! :smile:

Thank you!

Maybe one feature I would like is, when only one file is selected, open it without --new-window, but I it's more consistent this way.

harry-cpp commented 6 years ago

Maybe one feature I would like is, when only one file is selected, open it without --new-window, but I it's more consistent this way.

Hmmm, yea, makes sense, I've modified the script, by default --new-window is now set only if you are trying to open at least 1 folder.

damogallagher commented 6 years ago

I just tried this on Ubuntu Artful but it doesnt work Does anyone have any suggestions on how I could get @cra0zy's script to work on Artful?

harry-cpp commented 6 years ago

You need python-nautilus package installed (its called something like that, might also be nautilus-python).

ranolfi commented 6 years ago

For those using Nemo (the file browser for the Linux Mint's Cinnamon environment) I'm providing a solution here: https://gitlab.com/snippets/1712370

syntaxlexx commented 6 years ago

Got mine working by installing python-nautilus package, then creating a new entry:

sudo ln -s /usr/bin/code /usr/local/bin/code
# With this action I can also open vscode via the terminal by typing 
# code . 

Followed by entering the following options in the command section: Parameters:

. --working-directory=%d/%b
# Mind the dot at the start

image

Ubuntu 18.04 LTS

harry-cpp commented 6 years ago

Still better to use my extension, since your way does not seem to take into account a lot of stuff like folder opening, new window creation etc.

Also your PATH env variable seems messed up if you needed to create that symlink.

https://gist.github.com/cra0zy/f8ec780e16201f81ccd5234856546414

MEXdave1997 commented 6 years ago

@ajomadlabs do you have any progress made on this? I am making some changes that can potentially be a starting point(?)

sdabhi23 commented 6 years ago

Any updates on the extensions?

Will each distro require a separate extension? (I guess yes, coz many of them use different file managers)

Also I would like to take this up

harry-cpp commented 6 years ago

Each file manager would require its own extension, the extension I wrote above is Nautilus only.

githubsaturn commented 5 years ago

@cra0zy you may want to update your script. I believe the command code is now changed to vscode

harry-cpp commented 5 years ago

Have the newest visual studio code, and code is still the valid command for it. Where did you install it from? I could add a list of fallback commands in case it from one of the official sources.

githubsaturn commented 5 years ago

That's bizarre... I am running version 1.32.3 on Ubuntu 18 installed from snap.

harry-cpp commented 5 years ago

Hmm, wrong package installed maybe?

Official package link: https://snapcraft.io/code

Snapcrafters package link: https://snapcraft.io/vscode

githubsaturn commented 5 years ago

Oh! Had no idea there are 2 packages!

I'm gonna uninstall my vscode and install code as it seems to be the official one. But if it's possible, i think it's not a bad idea to add vscode as a fallback to your snippet.

gregvanl commented 4 years ago

Closing old issue. Looks like people have various solutions and no one has responded to the help wanted label.

Coderx7 commented 4 years ago

@harry-cpp 's solution worked well for me(ubuntu18.04). Thank you very much really appreciate it. The previous links are dead here, since he changed his username. This is the new link : https://github.com/harry-cpp/code-nautilus And this one liner adds code to the right click menu:

wget -qO- https://raw.githubusercontent.com/harry-cpp/code-nautilus/master/install.sh | bash
mwpowellhtx commented 4 years ago

I am trying to find the nautilus-actions or filemanager-actions as some blogs indicated, but cannot seem to find them. Have the repository(ies) vanished? Thank you.

kowalski7cc commented 4 years ago

I think VSCode on Linux should have something like @harry-cpp plugin out of the box. Working really well on Fedora 32.