how to open a file in vscode through a terminal? - bash

I want to open a project folder using terminal.
when type the command .code in terminal it open up vscode but the folder is empty and there is no file.
obviously I can open it with right-clicking and open with code but is there a way i could open it through terminal?
I'm running Ubuntu as my operating system.

You have to use cd to enter in the folder that you want to open in vs code.
After that you just need to use code . and it will open the current folder in vs code.

Related

Have WSL shell open to project directory in Windows Visual Studio Code

I have a windows subsystem for Linux Installed on my computer and am using it as the integrated terminal on Visual Studio Code. Every time I open a terminal however, it opens in the root directory rather than the current project directory like other terminals do.
Does anyone know of a fix for this?
I have tried messing with the Cwd of the integrated terminal settings but haven't had any luck.
Try using wsl.exe as the command for shell.
"terminal.integrated.shell.windows": "wsl.exe"
I know that is very late for this answer, but for me it just worked.
I put exactly as above and it launched in my home directory (that is /mnt/d/Users/Adrian).
I have the user setup of VSC, 1.30.1 and launch it from the Desktop shortcut.
After I configured terminal as wsl I go as below:
If I open a cmd windows I can launch it with code . it will launch in Windows home directory.
If move to some other folder (e.g Documents) and launch it with code . the bash will launch to that folder.
Otherwise I can launch it with code D:\Users\Adrian\Documents\VSC and the bash terminal will launch in \mnt\D\Users\Adrian\Documents\VSC
Tested the change both via menu File->Preferences->Settings and with Ctrl+Shift+P (Command Pallete), Terminal: Default Shell.
Tried with bash and wsl.
Maybe you have some other bash installed in the path? (e.g. git bash or MinGW bash?)

Automation of VScode project opening in Ubuntu

I'm complete beginner with linux (Ubuntu) but I have to use it and I'd like to automate some tasks that I do very often.
What I do:
Open VScode and open a project folder
Open new VScode window and open another project folder
Execute redis-server command in console
In second VScode window go to Debug and launch first configuration
and then second configuration (defined in launch.json file in
VSCode)
Open a chromium browser and a specific url
What could be the easiest way to achieve it? Are all the steps executable directly from console? Should I use any 3rd-party programs?

Open file with WebStorm from MacOS finder

In OSX El Capitan, I have set WebStorm to be the default application for opening .js files like so. This successfully opens WebStorm when opening a .js file via finder, or when cmd-clicking on the file from iterm2.
However, when WebStorm opens, the file I've chosen is not opened within WebStorm. The app simply has the same files I've opened before (whether or not the WebStorm app was running when I opened the file).
Using open -a /applications/WebStorm.app <filename> works fine, but it's less convenient than just clicking on the file I want, as I do for file extensions that I've set to open in Eclipse or Sublime.
Is there a way to get WebStorm to open the file I've selected?
Known issue, please follow IDEA-129532 for updates

where is the root of the Xcode app project directory located?

I'm following a app tutorial and it says:
"Next, create an empty file in the root of the Xcode app project directory and call the file Podfile. Open it with your favorite text editor and paste the following line in it:"
I'm confused exactly where this is? is it inside my Xcode program? or is it some folder inside my Xcode folder in finder?
Got it.
Open Terminal, navigate to the directory that has your project. Type it like this:
cd ~/Path/To/Folder/Containing/yourProject
I saved mine on my desktop so it was simple.
Then type: pod init
This creates the pod file.
Then type:
open -a Xcode Podfile
This will open the file so that you can edit it.
You should do it in Terminal.
Once in Terminal:
type cd (there is a space after cd)
drag your project to the Terminal window and press return. It points Terminal to your project.
type touch .Podfile, which will create an empty file in your project
type open -a TextEdit .Podfile, which will open the .Podfile file in TextEdit
paste your code in it and then save.
you can check that your Podfile has been created by typing ls -a in Terminal, which will show you all files and folders in your project
This should work.

I'm having issues with my Terminal

I'm having some issues trying to open up Atom in my terminal. I know I can open it manually but I'm trying to figure out what exactly is the issue.
This is what I'm getting when I try to open Atom in my Terminal.
Cannot locate Atom.app, it is usually located in /Applications. Set the ATOM_PATH environment variable to the directory containing Atom.app.
Anyone have an idea as to what the issue is???
If your application is called "Atom 2" or something, try this:
Open /usr/local/bin/atom
Change the line ATOM_APP_NAME=Atom.app to something like ATOM_APP_NAME='Atom 2.app'
lets get this fixed for you.
The error you're getting is indicating Atom isn't located where it should be, which is the Applications folder. Open up Applications and confirm it isn't there. If it isn't, locate where Atom is on your computer and drag it into the Applications folder. If you have Atom and Terminal both open, restart them. Then try opening Atom from the Terminal.

Resources