Can you get Warp terminal as the integrated terminal in VS Code? - visual-studio-code

I followed the directions on Warp's documentation, but this only replaces the external terminal (it opens as a separate window).
https://www.warp.dev/blog/how-to-open-warp-vscode
I would like Warp to replace vscode's usage of xterm in the integrated terminal, but I can't seem to figure out how to do that.
My attempt was to edit the profiles in my settings.json:
"terminal.integrated.profiles.osx": {
"bash": {
"path": "bash",
"args": [
"-l"
],
"icon": "terminal-bash"
},
"zsh": {
"path": "zsh",
"args": [
"-l"
]
},
"fish": {
"path": "fish",
"args": [
"-l"
]
},
"tmux": {
"path": "tmux",
"icon": "terminal-tmux"
},
"pwsh": {
"path": "pwsh",
"icon": "terminal-powershell"
},
"warp": {
"path": "/Applications/Warp.app/Contents/MacOS/stable",
"icon": "/Applications/Warp.app/Contents/Resources/Warp.icns"
}
},
"terminal.integrated.defaultProfile.osx": "warp",
but all this did was open up Warp in a separate window and the existing integrated terminal contained the output logs of Warp.
The Warp documentation doesn't include changing the integrated terminal and neither does the vscode documentation, so I highly suspect this is not feasible, but I was wondering if there was some less obvious workaround that someone might have found.

I guess that there's a misunderstanding of the terms
'warp' is a terminal emulator application
but VSCode integrates command shells like bash, zsh, etc.
terminal apps in most cases it's GUI apps that allow you to work with a command shell. In this case VSCode's terminal window it's a terminal app. that's why you can't just use 'warp' or any other GUI terminal emulator inside the VSCode environment.

It seems that Warp can't be accepted by vscode as the default integrated terminal.
Value is not accepted. Valid values: null, "bash", "csh", "dash",
"ksh", "sh", "tcsh", "zsh", "JavaScript Debug Terminal".

Once Warp starts building to WASM (looks like they're working on Windows, Linux, and WASM support), it might be embeddable into VS Code and/or Theia as a WebView Extension

Replacing the vscode integrated terminal is a feature in the warp team's backlog, but one of the engineers says:
"This is really really difficult eng wise. Just being transparent so people don't get their hopes up that this would come out anytime soon."
https://github.com/warpdotdev/Warp/issues/257#issuecomment-1274198741

Related

Use cmder as default shell in VSCode

Every other solution I can find to this question says to put the settings below inside my.vscode/settings.json
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/K",
"C:\\softwares\\cmder\\vendor\\init.bat"
],
This worked until recently, when I removed my settings file from a git repo. Now when I hover over the code above, I get this text in a popup
The path of the shell that the terminal uses on Windows (default:
C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe). Read more
about configuring the shell. This is deprecated, use
#terminal.integrated.defaultProfile.windows# instead(2)
This is a bit confusing to me, I'm not sure what I have to change to what. I tried changing the first setting to
"terminal.integrated.defaultProfile.windows": "C:\\WINDOWS\\System32\\cmd.exe",
But this has had no effect. Cmder is not being used as the default shell.
VSCode changed how integrated terminal profiles are handled in April 2021. Based on the args you provided in your question, adding this to your settings.json should work:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [
"/K",
"C:\\softwares\\cmder\\vendor\\init.bat"
],
"icon": "terminal-cmd"
}
},
"terminal.integrated.defaultProfile.windows": "Command Prompt"
cmder comes as an executable program. You do not need to use a batch script to open it. Just firing the exe starts the program.
(from the official download page:)
Unzip
(optional) Place your own executable files into the bin folder to be injected into
your PATH.
Run Cmder (Cmder.exe)
Therefore, you just need to add a single line to settings.json:
"terminal.integrated.shell.windows": "C:\\full\\path\\to\\unzipped\\cmder.exe"
This shouldn't need to take in any flags or commands, args, unless you are wanting to change it's default functionalities (such as changing the default folder that the cursor points to on launch). For default cmder, just run the exe...
try add follow config in settings.json
"terminal.integrated.automationShell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
A path that when set will override terminal.integrated.shell.windows and ignore shellArgs values for automation-related terminal usage like tasks and debug.

How to run Lua script from within VS Code

Have been using Notepad++ for awhile now, and adding scripts via Lua extensions. Now, I would like to get my feet wet using VS Code and was wondering what sort of extensibility I could leverage in that environment? Possible to run the same Lua scripts, for instance? Or are there other avenues I should consider? Thanks for any insights!
Please install the vs-code extensions "LuaDebug" and "extensionPath" provided by actboy168.
Add a file named .vscode/launch.json with the content:
{
"version": "0.2.0",
"configurations": [
{
"type": "lua",
"request": "launch",
"name": "Launch",
"program": "${workspaceFolder}/src/main.lua"
}
]
}
if your source to be executed is src/main.lua.
Then hit F5 or "Run"->"Start Debugging", select the lauch configuration and happy debugging.
An example is also shipped by the author of the plug-in (actboy128), which can be found here: https://github.com/actboy168/luamake
Please do not try to build it, simply load it in VS Code and debug it!
I'm using the following settings to run the interpreter from VSCode using the menu option "Terminal|Run Build Task":
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run Lua",
"type": "shell",
"command": "lua54",
"args": ["${file}"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
The file contains this settings must be named as "tasks.json". I suggest you to read the VSCode in order to learn how to create it properly.
NOTE: in the command property, where you read "lua54", you must write the name of the lua interpreter executable without the extension.
You would have to configure a task file to run lua from VS code and install lua on your pc if it's isn't done yet.
In order to debug lua you would have to install the extension lua debug which will add a ton of useful feature to help you debug lua such as breakpoint.
Your question seems to touch on several topics:
How to run a Lua script from VS Code: other answers here have already addressed it.
How to extend VS Code: pull up the extension view in VS Code, find an extension you like, and click install. More info here:
https://code.visualstudio.com/docs/editor/extension-marketplace
How to author VS Code extensions: they are written in TypeScript or JavaScript rather than Lua. More info here:
https://code.visualstudio.com/api/get-started/your-first-extension
you can type the following in cmd and it will run the command. Instead of installing extensions.
"C:\Program Files\LOVE\love.exe" "D:\game"
--> this is the path where your main.lua file is

Running simple terminal commands in command palette VS Code

Is it possible to run simple terminal commands in Command Palette? Or an extension for it?
For example, something like rm unwantedfile.txt would be super useful to do in via command palette rather than having to open up the integrated terminal or do the task via mouse (mainly interested in not having to take my hands off the keyboard).
I know there's Edit with Shell Command, but it doesn't appear to be able to edit outside the file itself.
You can either use VS Code built-in functionality using shortcuts. Just add to keybindings.json:
{
"key": "cmd+shift+R",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "clear; rails server\u000D"
}
},
Or you can take a look at this extension, Command Runner, that does exactly what you're looking for.

Can VSCode (Visual Studio Code) be used to run elm-make?

I am new to VSCode.
I am new to ELM.
I am perfectly capable of using VIM and command line tools to create an ELM Project, but I want to utilize an IDE. I have chosen VSCode on advice from the internet since it seems to pick up some nice pieces of VIM.
So now I have a few .elm files.
Main.elm
View.elm
Model.elm
I want to run elm-make on Model.elm to make sure it has no errors.
Then I want to run elm-make on Main.elm to create an index.html so I can view my project.
I think this is a pretty simple question for people familiar with how to customize VSCode, but as I stated previously, I am new to VSCode.
Try setting up a task for elm-make:
Create a ./vscode/tasks.json with the contents:
{
"version": "0.1.0",
"tasks": [
{
"taskName": "elm make",
"isBuildCommand": true,
"command": "elm-make",
"args": ["./main.elm"],
"isShellCommand": true
}
]
}
You can then use the build command to run the task, or run the task individually.
You may also want to look into the elm extension: https://marketplace.visualstudio.com/items?itemName=sbrink.elm

Does Visual Studio Code work with PowerShell in the Command Palette?

With Visual Studio Code (not the traditional Visual Studio IDEs), can you run PowerShell in the Command Palette? I ask because I commonly use it in the full IDE.
I have not seen PowerShell mentioned in the documentation, other than for basic syntax highlighting. I have tried it with no success. Is it unsupported, or is it an optional feature I can configure somehow?
Note: to those voting up the PowerGUI answer, it is not correct as it references the wrong edition of Visual Studio for this question. It is helpful if you are using the full IDE, but not the new editor named: Code.
This was the first problem I wanted to solve in VSCode. I did not find a way to
type PowerShell commands but I have found a way to create and run PowerShell tasks.
In the command palette type and choose Tasks: Configure Task Runner. It will
show you a json file configured for the default task runner.
I replaced the content with this
{
"version": "0.1.0",
"command": "PowerShell.exe",
"isShellCommand": true,
"args": [
"-NoProfile",
"Invoke-Build.ps1"
],
"tasks": [
{
"taskName": "Build",
"isBuildCommand": true,
"showOutput": "always"
},
{
"taskName": "Test",
"isTestCommand": true,
"showOutput": "always"
},
{
"taskName": "Build, Test",
"showOutput": "always"
}
]
}
As a result in the command palette I can choose and run my predefined tasks (Build, Test, and combined Build, Test). I can add other tasks and probably bind them to some hotkeys. This is not exactly what I would like to have in VSCode for PowerShell but for the preview it is at least something.
P.S. This just my first experiment that somewhat worked. It is not perfect, more likely. There are many configuration parameters for this json file that I have not tried yet.
With version 0.10.1 of Visual Studio Code, you can run and debug PowerShell. Here is a sample launch.json that I use:
{
"version": "0.2.0",
"configurations": [
{
"name": "PowerShell",
"type": "PowerShell",
"program": "MyScript.ps1",
"args": "-Verbose"
}
]
}
Unfortunately, I cannot get the args to work (for more details, see: https://github.com/PowerShell/vscode-powershell/issues/24). Another problem I have is that Read-Host does not work with VS Code (for more details, see: https://github.com/PowerShell/vscode-powershell/issues/29). Definitely some rough edges.
Here's how you can configure the Powershell task to execute the currently opened .ps1 file without any Invoke-Build dependency:
{
"version": "0.1.0",
"command": "PowerShell.exe",
"isShellCommand": true,
"args": [
"${file}"
],
"tasks": [
{
"taskName": "Build",
"isBuildCommand": true,
"showOutput": "always"
},
{
"taskName": "Test",
"isTestCommand": true,
"showOutput": "always"
},
{
"taskName": "Build, Test",
"showOutput": "always"
}
]
}
Note: This is just a slight modification of Roman's answer (My edit to his answer was rejected).
Open the Debug view, in the View Bar select Debug from the View menu or press Ctrl + Shift + D.
In the Launch Configuration dropdown (shown in the following screenshot), select Add Configuration...
The launch.json configuration will open in the editor, type PowerShell and select the debug configurations you want, as shown in the following screenshot.
Save the launch.json file and select the debug configuration you want from the Launch Configuration dropdown:
Now you can debug PowerShell scripts through VSCode.
The Scripting Guys wrote a comprehensive 2 part blog post on this topic, like everything else they write, it's well worth a read if you're new to VSCode and PowerShell.
https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/06/debugging-powershell-script-in-visual-studio-code-part-1/
https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/13/debugging-powershell-script-in-visual-studio-code-part-2/
EDIT: I am aware that this question is several years old, but I came across it before I found any up to date information on how to set up PowerShell debugging in VSCode
As of version 0.10.3 there is now a PowerShell extension written by Microsoft that will enable writing PowerShell with IntelliSense and highlighting in Visual Studio Code
http://blogs.msdn.com/b/powershell/archive/2015/11/17/announcing-windows-powershell-for-visual-studio-code-and-more.aspx
At least in V1.4 (July 2016) this has been made a lot simpler.
The relevant documentation can be found here:
https://code.visualstudio.com/docs/editor/integrated-terminal
Essentially all you're doing is adding an entry to the settings.json file for User Settings.
Adding the following value:
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
IMG: Shows the User Settings settings.json file and the successful Integrated Console showing the PowerShell prompt:
An "Integrated Terminal" is now integrated into Visual Studio Code. This is a PowerShell Terminal in Windows. (Likely BASH in Linux / MacOS). The terminal appears in a panel at the bottom of the code editor, not in the Command Pallete.
Keyboard Shortcut to open Terminal: CTRL + `
Sources:
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
https://code.visualstudio.com/docs/getstarted/keybindings
I confirmed in version 1.19.2. Not sure when the feature was first integrated.
There is a much easier way to run PowerShell, no configuration needed:
Install the Code Runner Extension
Open the PowerShell code file in Text Editor, then use shortcut Ctrl+Alt+N, or press F1 and then select/type Run Code, or right click the Text Editor and then click Run Code in context menu, the code will run and the output will be shown in the Output Window.
Besides, you could select part of the PowerShell code and run the code snippet. Very convenient!
PowerGUI tool provides a nice interface to Visual Studio. The goal of this extension is to bring PowerShell development into Visual Studio.
Here is how it looks -
Along with IntelliSense, the PowerGUI Visual Studio Extension provides the following features and more to make it easier to work with PowerShell.
PowerShell file and project types: You can create/edit PowerShell code files and assemble them into projects with more than one file.
PowerShell code snippets: The code snippet feature can be used for PowerShell code.
PowerShell console window: This feature provides the PowerShell console environment within Visual Studio IDE. This allows you to run commands or view output of scripts. Figure B shows the console window opened in the IDE.
PowerShell debugging: This feature is why I installed the extension; it provides a way to debug scripts within Visual Studio. It's a straight-forward way to locate syntax or logical problems in a script.
Syntax highlighting and script analysis: These are more Visual Studio features made available to PowerShell development.
In order to install the PowerGUI Visual Studio Extension, PowerGUI must be installed, with the caveat that the correct version of each product is installed.
Download Here
It also provides Debugging facility which is the best part I like as a developer.
Thanks!