In the vscode command palette, why is the `dotnet` command not appearing? - visual-studio-code

I'm trying to follow along with a tutorial here, and it asks me to use the Command Palette to do things like dotnet run and dotnet restore, by typing dotnet: Restore Packages into the Command Palette.
I have tried installing the C# extension, and restarting the program several times. Everything else seems to be working normally, but not the Command Palette.
I've found a work around, which is to just use the terminal, but I'd like to gain a better understanding of why I can't seem to get the same functionality as described in the tutorial.

Related

Elixir: VS Code ExUnit cannot find Mix

I cannot load or run my tests, from within VS Code.
I'm a new user to Elixir, and to VS Code. I'm running Lubuntu 21.10 (Impish). I've downloaded Erlang/OTP 25 (.deb), and Elixir 1.14 (precompiled binary in /usr/share/elixir), and can get anything I need running in a Bash terminal. Again, in a standard QTerminal window,
erl, iex, mix, elixir, etc. all work fine.
In VS Code, however, I get some errors. I feel stupid, but I'm coming from Sublime Text, so please forgive me.
In the left pane of VS Code, ExUnit shows an error (red):
Clicking on this error gives me this, on the bottom right pane. The command line options, passed to mix test, seem to be the default configuration:
This result is bizarre to me, because I can open the integrated terminal, execute /bin/sh, and then run the exact mix test line that's displayed:
/usr/share/elixir/bin has been added to my PATH variable, in ~/.bashrc, ~/.profile, and /etc/environment.
However, I am further confused by all tests being excluded, and wonder if there's some connection to the core issue:
Note that I can run my tests just fine, using different command line options. I've tried adding tags, but that didn't fix the problem.
I tried Google'ing this, and played around with my settings. Here is what I have configured in the "User" settings.json, and I made sure nothing overrides this in "Workspace" settings:
Changing the useNativeTesting setting doesn't solve the problem.
On another (?) note, I get a "failed to run elixir" upon VS Code startup:
Again, I have no problem running commands from a Linux terminal, or from a terminal within VS Code.
Plot twist: If I remove the precompiled Elixir 1.14, and downgrade to an older version, via apt, the problem goes away. But Lubuntu 21.10 doesn't offer Elixir 1.14, and I'm really into using the new dbg() feature.
But for now, I cannot load or run my tests, from within VS Code, apparently because Mix cannot be found.
Thanks to Daniel Imms, from the VS Code team, for answering my question on Twitter:
"Try moving where ever you init mix and elixir (.bashrc?) into your .bash_profile and then logging out and in again or restarting. I'm guessing it's in your bashrc which doesn't run in non-interactive sessions like in tasks."

Dedicated Command History panel in VS Code

I'd find it convenient to be able to quickly recall past commands issued in the terminal. In Matlab one can simply select any number of those from the Command HIstory panel, and reissue them in the Terminal all at once:
In VS Code (on Windows), I know there is a command to pull up the log text file:
(Get-PSReadlineOption).HistorySavePath
But I find this extremely cumbersome as a solution to call up multiple lines at a time. Is there an VS Code addon that creates a Matlab-like Command History panel with timestamped commands (didn't find any searching myself)? Or is such feedback taken into consideration by Microsoft?
See v1.70 release notes:
Triggering the Terminal: Run Recent Command... will bring up a QuickPick panel of recent terminal commands in which you can search, fuzzy or not, through the recent commands.
There are some examples of commands for going to the next item in the list, for example.
See the supported shells and OS's mentioned below. I believe it is still accurate. Git Bash on Windows doesn't work with this new recent command functionality, but powershell does. Support for MacOS and linux is stronger: bash, powershell and zsh.
And see v1.69 release notes: run recent command:
Some other functionality of the command:
In the current session section, there is a clipboard icon in the right
of the Quick Pick that will open the command output in an editor. Alt
can be held to write the text to the terminal without running it. The
amount of history stored in the previous session section is determined
by the terminal.integrated.shellIntegration.history setting.
There is currently no keybinding assigned by default but it can be
hooked up to Ctrl+Space for example with the
following keybinding:
{
"key": "ctrl+space", // whatever keybinding you want
"command": "workbench.action.terminal.runRecentCommand",
"when": "terminalFocus"
}
This might help (coming to v1.64):
Terminal shell integration
The terminal now features experimental opt-in shell integration which
allows VS Code to gain insights on what is going on within the
terminal as it was previously a black box. When enabled using
"terminal.integrated.enableShellIntegration": true, arguments to run
a shell integration script will be injected into your terminal profile
if possible. The script itself mostly just injects invisible sequences
into your prompt, providing us with information like where the prompt,
command and command output is, what the current working directory
(cwd) is for each command and the exit code of each command.
Shell integration enables the following new features:
Run recent command: Since we know what commands are run, we have
exposed a command that allows you to view and run them again in a
quick pick.
Developer: Run Recent Command run this command from the Command Palette
The current shells supported are pwsh for Windows and pwsh, bash and
zsh for Linux and macOS.
from release notes: terminal shell integration
Although I switched to powerShell on W11 to test this feature - which should be supported - I can't get it to work just now. I wanted to see if you could pick multiple command entries in the QuickPick to run a series of them, but I doubt you can. But at least you get a nice list of recent commands.

Can you take terminal commands and use them in a Python program?

In another thread, there is an excellent step by step to completely uninstall VSCode off my Mac so I could truly start over. The steps work perfectly. In my question to try a lot of configurations and extensions, I mess up VSCode pretty often.
Is there a way to build Python file so when I need to uninstall, I can open a terminal window and run a program and be ready to try again? It is not the end of the world to have to type one line at a time, I'm just assuming this is common and been fixed. I'm just not able to find the how.
After doing some studying of Python, I found the OS module. Once you import it, most, if not all the commands to clean up directories, delete files, etc. are in there. I took the list of commands that ran in a ZSH terminal and converted them to os.[relevantcommand] and it worked fine. Now, I can easily clean out a VSCode install by running my VSCleanup.py and start over.

Visual Studio Code terminal commands deletion

I was messing around in python and ran a few programs from terminal and noticed that using the up arrow you could backtrack to previously ran program. I thought this was a nice feature but I'm wondering where and which file I have to edit to delete past commands?
Note: Restarting VS Code doesn't remove these commands from terminal history

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.