VSCode CLI : Disable electron logging - visual-studio-code

Is there a way to not display this electron loggings on executing code <path> command ?
I prefer the CLI to not livetail this logging so that I can proceed with other command lines.
I cannot find article for this inside the CLI doc https://code.visualstudio.com/docs/editor/command-line.
Somehow it will do a livetail for the first time we use the code <path> command. The subsequent usage will not show the livetail.

As suggested in this github issue, try running code.cmd in ~/AppData/Local/Programs/Microsoft\ VS\ Code/bin, not Code.exe in the parent folder.

Related

I'm trying to use "flutterfire configure" but I'm getting an error. Can somebody have an issue for me please? [duplicate]

I'm trying to install flutterfire_cli in my root project, so I typed this command:
FirebaseFirestore firestore = FirebaseFirestore.instance;
so after that, this is the output of my console:
PS C:\Users\PC\Desktop\eventually> dart pub global activate flutterfire_cli
Package flutterfire_cli is currently active at version 0.1.1+2.
Resolving dependencies...
The package flutterfire_cli is already activated at newest available version.
To recompile executables, first run `global deactivate flutterfire_cli`.
Installed executable flutterfire.
Warning: Pub installs executables into C:\Users\PC\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated flutterfire_cli 0.1.1+2.
To fix the warning I added C:\Users\PC\AppData\Local\Pub\Cache\bin to my Path in system variables environnement. (but it does not work, I'm still getting the warning)
Next, I'm trying to generate the firebase_options.dart file as the documentation says using this command:
flutterfire configure
But I'm getting an error in the console:
PS C:\Users\PC\Desktop\eventually> flutterfire configure
flutterfire : The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ flutterfire configure
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (flutterfire:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Could anyone tell me what I am missing, why I am getting this error even if the Firebase CLI already installed on my machine?
Go through this doc very carefully: https://firebase.flutter.dev/docs/cli/
Step 1: Install Firebase CLI
Step 2: Install FlutterFire CLI with this command dart pub global activate flutterfire_cli
While doing this you must notice the following warning
Warning: Pub installs executables into C:\Users\PC\AppData\Local\Pub\Cache\bin, which is not on your path. You can fix that by adding that directory to your system's "Path" environment variable. A web search for "configure windows path" will show you how.
This means you need to add C:\Users\*username*\AppData\Local\Pub\Cache\bin into your System's environment path.
Step 3: Now flutterfire configure should work.
If still not working play with Firebase commands
For Mac -> Execute this command:
export PATH="$PATH":"$HOME/.pub-cache/bin"
Three 3 steps for getting it work on Windows:
Run this command:
dart pub global activate flutterfire_cli
Type env into Windows search and open Edit the system environment variables --> Environment variables --> System variables( the one on the bottom of the window) --> Double click on Path --> New and enter this:
C:\Users\PutHereYourUsername\AppData\Local\Pub\Cache\bin
flutterfire configure command should work now - close and open again command prompt or other terminal. Sometimes there is a problem with other editors and terminals where flutterfire configure still does not work. In that case open Command Prompt and it works there for sure.
As for me, I have done everything correctly and the command works if I run in the Windows command prompt, but it fails to work if I type the command inside the VS code terminal.
So I just killed the terminal and opened it again, then it works.
Or, you can try restarting your machine.
Even after adding C:\Users\PC\AppData\Local\Pub\Cache\bin to the path for me flutterfire would not work from the command line, the reason being that it actually instally a flutterfire.bat file.
So I use flutterfire.bat in the command line as of now and that is working.
For Linux/Ubuntu run this command in the terminal,
export PATH="$PATH":"$HOME/.pub-cache/bin"
Which you will also notice in the terminal when you run the command ↓.
dart pub global activate flutterfire_cli
Make sure you are your project directory
run this export PATH="$PATH":"$HOME/.pub-cache/bin"
For Linux/Ubuntu you should do the following:
Open your .bashrc file using the command "sudo nano ~/.bashrc"
Add export PATH="$PATH":"$HOME/.pub-cache/bin" to the end of the file.
Final you can source the file using "source ~/.bashrc"
It should now be able to recognize the file.
for macOS Monterey edit ~/.zprofile instead .zshrc
This was the hack i used to solve mine. I copied and pasted the C:\Users\PC\AppData\Local\Pub\Cache\bin in my folder search bar to enter the folder, note I could not find any folder called AppData, but when I pasted it on the folder search it did take me to the bin folder.
In the bin folder, you will find a file called flutterfire.bat. Copy and paste the flutterfire.bat file in the root of your project and then run the .\flutterfire configure command. Please do note the dot (.) and forward-slash (\). You need to add it to work.
for mac m1 , add
export PATH="$PATH":"$HOME/.pub-cache/bin" at the top of users/username/.profile , works on (monterey)
For me, even after I installed everything correctly, restarting my IDE(VSCode) did the trick.
Flutter command not found
Here is very easy instructions for adding something to your path on Mac, It solved my issues with Flutter and Flutterfire.
The export PATH="$PATH":"$HOME/.pub-cache/bin" did not work on my Debian machine!
I removed the first line #!/usr/bin/env sh from $HOME/.pub-cache/bin/flutterfire file and the flutterfire command worked properly.
Use command prompt.. not the vsc terminal
if you followed the right answer and still not working, you need to restart your computer

'very_good' is not recognized as an internal or external command, operable program or batch file

I tried to activate very_good_cli in flutter with this command:
dart pub global activate very_good_cli
and result was this:
...
...
...
Building package executables...
Built very_good_cli:very_good.
Installed executable very_good.
Warning: Pub installs executables into ~\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated very_good_cli 0.7.2.
I also added ~\AppData\Local\Pub\Cache\bin to system Path, but this warning still persists and the error I get is:
'very_good' is not recognized as an internal or external command,
operable program or batch file
how can I solve this?
I just wanted to quickly put this together to make it obvious.
After running...
dart pub global activate very_good_cli
very_good.bat is added to your ~\AppData\Local\Pub\Cache\bin directory. So, you need your command-line shell to pick up on this change.
As mentioned above, if you run dart pub global activate very_good_cli a second time it will give you some good info in the form of a warning
Warning: Pub installs executables into `~\AppData\Local\Pub\Cache\bin`, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated very_good_cli 0.7.2.
So, if the warning states the ~\AppData\Local\Pub\Cache\bin is not in your path, you need to add it there. Something like this. This essentially allows your command-shell to recognize 'very_good' as a command.
Link to video showing the process of adding to path
Once you are done with that, you need your command-line shell(s) to pick up the change. Easiest way to do that is to close them completely and reopen them. A tricky situation you might run into is if you are using a shell inside of another process. I use powershell terminal in vscode. So, I had to close vscode to actually refresh the terminal.
Restarting your computer is the nuclear button that should get the issue resolved if your Environment Variables are setup correctly or if there isn't some other wonky issue with the shell you are using. Using the built in windows cmd is a good test to see if it is just a problem with your preferred shell.
So after running dart pub global activate very_good_cli and adding path to ...\Pub\Cache\bin to the Path in system environment variables, restarting the windows solved the issue.

Vscode : Open file locally using Remote-SSH through integrated terminal

I am using Remote-SSH plugin for remote development and would like to open a file in the existing editor using an integrated terminal (which is running a remote shell). A similar issue was posted on fit repository but it doesn't seem to work now.
https://github.com/microsoft/vscode-remote-release/issues/766
Local Machine
1.41.1
26076a4de974ead31f97692a0d32f90d735645c0
Windowsx64
Remote Machine
1.41.0
9579eda04fdb3a9bba2750f15193e5fafe16b959
CentOsx64
Can you help me to debug
Copying my answer from https://stackoverflow.com/a/68090934/319542
You shouldn't have to do anything. VSCode automatically sets the path/PATH to the code in the path/PATH environment variable depending on your shell. See this response. You might be overwriting your path/PATH like I was. I was accidentally overwriting path in ~/.cshrc and PATH in ~/.bashrc and was running into the same issue. After fixing it, I can run code on the command line. which code returns the location of the command.
Until I spent time to figure it out, I was using the two methods mentioned below. Both of which worked for me in bash; you can modify it for your shell as you see fit. But really fix your path/PATH rather than using these methods.
Adding location of code to the PATH in ~/.bashrc
export PATH=${VSCODE_GIT_ASKPASS_NODE%/*}/bin:$PATH
OR
Setting alias to code in ~/.bashrc
alias code="${VSCODE_GIT_ASKPASS_NODE%/*}/bin/code"
More on path vs. PATH here and here

Bazel tab auto complete in zsh not working

I use oh-my-zsh and I have a bazel project. I want tab complete. So that I can do bazel build //src/<tab> and get auto complete.
The first thing I tried was following:
https://docs.bazel.build/versions/master/completion.html. I included the _bazel file under a directory on my $fpath. Then I restarted my terminal and got no tab complete.
Next I tried using an oh-my-zsh plugin. https://github.com/jackwish/bazel. I cloned the plugin into the correct location, added bazel to my zshrc plugins and did source ~/.zshrc
Still no tab completion.
I installed bazel using brew. I have tried brew uninstall bazel and reinstalling it. No luck...
$ echo $fpath
... /Users/<username>/.oh-my-zsh/completions ...
$ ls /Users/<username>/.oh-my-zsh/completions
_bazel
I want to press tab and get a list of options and be able to tab through them.
You need to re-initialize the completion. The completion system in ZSH collects completion file in fpath and record them in a .zcompdump file as an index for existing completions. After a new completion file is added, you need to redo the process.
Solution
Put the following content into your .zshrc.
# add the _bazel into path
fpath+=(/path/to/_bazel)
Re-collect completions and generate .zcompdump. Run the following command in a new interactive ZSH shell.
rm -f ~/.zcompdump; compinit
I remember oh-my-zsh doesn't do the compinit for you. You may need to add the compinit into your .zshrc.
Check the optimization here to run compinit once a day.
Extended Reading
Command completion from archlinux wiki
I had to install zsh-completions (via brew) and follow the instructions after the install to get completions to work for me.

How to open VS Code and pass commands to integrated termianal via CLI

I wonder how to use the code command to open the VS Code with the integrated terminal launching within with some commands running that I pass directly to the integrated terminal.
Right now I need to do a couple of actions to get it done:
open VS Code via code .
manually open the built-in terminal and run a command like npm run start
Maybe it's possible to open VS Code like this: code . --exec 'npm run start', and it may open the editor and also run another command in the integrated terminal just after VS Code is ready for work.
I look through the documentation and I couldn't find anything useful for this case. Maybe I need to look for something like plugin or tricky bash/zsh script?
Reminder: it’s important to run these “passed” commands via CLI directly in the integrated (built-in) terminal of the newly opened VS Code instance. I know that it's possible to open the editor and then run commands, like code . && npm run start, but it will be just another command in sequence after code, it's not the same as running commands in integrated terminal.
Thanks.