I am using Mads Kristensen's Command Task Runner extension in Visual Studio 2017, to help when working with a colleague's JS work. I have set up a commands.json file, which we use to Lint and Build his work:
{
"commands": {
"chat-lint": {
"fileName": "powershell.exe",
"workingDirectory": "./Scripts/Chat",
"arguments": "-Command yarn run lint:fix"
},
"chat-build": {
"fileName": "powershell.exe",
"workingDirectory": "./Scripts/Chat",
"arguments": "-Command yarn run build"
}
},
"-vs-binding": {
"BeforeBuild": [],
"AfterBuild": []
}
}
I would like to be able to execute two commands within one of the steps: that is, to execute yarn install before yarn run build, within the "chat-build" task. Is that possible, or do I really need to create a .ps1 file to do that? Would be great if I can execute two commands sequentially.
Of course, I could just put two Powershell commands there, separated by a semicolon: "arguments": "-Command yarn install; yarn run build"
Related
I have configured a custom task of type shell from vscode.
This task will be a simple one and I do not expect any errors, hence just to save one click, I would like to skip the prompt to select for which kind of errors or warnings to scan the output.
Any ideas on how I can achieve this or is this even possible? Many thanks!
Prompt can be skipped with setting problemMatcher property as empty array in specific task:
{
"label": "echo hello world",
"type": "shell",
"command": "echo Hello",
"problemMatcher": []
}
What I'm trying to do seems simple enough, but it's been crazy hard to actually get there. I have a Django application that runs in a docker-compose environment, and I want to run and debug the unit tests with breakpoints in Vscode.
Since this is a big project with a team that doesn't necessarily use vscode, I can't add libraries willy-nilly (like ptvsd, for example). I'm hoping there's a magic configuration for tasks.json and launch.json that will makes things work.
I have a container for a postgres database, one for django, and one for redis, all defined in docker-compose.yml. There's a command that I can run in the terminal that will run the tests, it's:
docker-compose run --rm app python manage.py test
where app is the django app container. I'd love to be able to run this command in such a way that it can hit breakpoints in vscode.
My incomplete stab at the launch.json file looks like this:
{
"configurations": [{
"name": "Docker: Python - Django",
"type": "docker",
"request": "launch",
"preLaunchTask": "compose-for-debug",
"python": {
"pathMappings": [{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}],
"projectType": "django"
}
}]
}
And my tasks.json:
{
"version": "2.0.0",
"tasks": [{
"type": "docker-build",
"label": "docker-build",
"platform": "python",
"dockerBuild": {
"tag": "dockerdebugging:latest",
"dockerfile": "${workspaceFolder}/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
}
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build"
],
"python": {
"args": [
"test",
"--nothreading",
"--noreload"
],
"file": "manage.py"
}
}
]
}
I think I need to convert the build task to a docker compose task somehow, but I just can't figure out how its done. It may also make sense to run the containers in the terminal, and somehow make vscode attach to them with breakpoints enabled.
Even some help with how to approach this would be great. I know it's a tricky one.
This question became somewhat popular, but a direct answer never came. If you've landed here looking for a way to hit breakpoints inside vscode using docker, my suggestion is to use the Remote Container extension.
When the container is up, right click it and open a vscode window inside of the container itself. Then everything will just work.
I am debugging my CPP code with VSCode. I need to use a preLaunchTask to set my environment before my code run. So my code should run after preLaunchTask right in the same terminal. But it start in two different terminal now. How can I do with this?
And btw how can I start the process in the same terminal next time? Some process will start another terminal next time, I am confuse.
My preLaunchTask:
{
"label": "source_setup",
"type": "shell",
"command": "source ./devel/setup.zsh && export ROS_MASTER_URI=http://localhost:11311/ "
},
As stated by #isidorn in this vscode GitHub issue this feature is currently not yet supported. In the meantime, people can achieve the desired behaviour by adding the following code to their .bashrc
# Source ros setup.bash if present
if [ -f '../devel/setup.bash' ]; then . "../devel/setup.bash";fi
If you don't want to manually switch to the terminal once the task has ran, here is a good workaround:
add this line to your launch.json config:
"internalConsoleOptions": "openOnSessionStart"
This will switch to the terminal view once the task script has finished running.
I think you could just use envFile property.
In my case launch for debugging looks like this (this one is used by python, but it also needs sourcing ./devel/setup.bash before running):
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current ROS File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/devel/setup.bash"
}
]
}
I'm trying to pack my application with flatpak and currently I'm stuck:
How do I make shure, that the runtimes are installed on the target system? I need mono, gtk-sharp2, SFML, CSFML. I learned about the basic runtime, but what about my dependencies?
How do I run the application? I tried
[sven#localhost flatpak]$ flatpak-builder --run build net.sourceforge.audiocuesheet.json /app/AudioCuesheetEditor/./AudioCuesheetEditor
bwrap: execvp /app/AudioCuesheetEditor/./AudioCuesheetEditor: No such file or directory
Some more information about the project:
net.sourceforge.audiocuesheet.json:
{
"app-id": "net.sourceforge.audiocuesheet",
"runtime": "org.gnome.Platform",
"runtime-version": "3.26",
"sdk": "org.gnome.Sdk",
"command": "/AudioCuesheetEditor/AudioCuesheetEditor",
"modules": [
{
"name": "AudioCuesheetEditor",
"buildsystem": "simple",
"build-commands": [
"cp -r AudioCuesheetEditor /app/AudioCuesheetEditor",
"chmod +x /app/AudioCuesheetEditor/AudioCuesheetEditor"
],
"sources": [
{
"type": "archive",
"path": "AudioCuesheetEditor-linux-x64-v2.4.2.zip",
"dest": "AudioCuesheetEditor"
}
]
}
]
}
As you can see, the archive has prebuild binaries, which I would like to deploy to the target maschines. I'm new to flatpak and not really shure, if I'm doing right, so maybe some help from you would be perfect.
Thanks
Sven
I have setup sublime REPL(Sublime 2, MAC) and able to run small Clojure programs like (+ 2 2). I have created a small project using lein lein new app clojure-noob and I am able to run it via lein repl. And it loads the main class defined inside the project. How can I load the same main class in Sublime REPL.
All you need to do is open your project's project.clj file in Sublime, make sure it has focus, then select Tools → SublimeREPL → Clojure → Clojure. This runs lein repl in project.clj's folder.
If you'd prefer to not have to go through so many submenus to open the REPL, you can do this:
Select Preferences → Browse Packages… to open the Packages folder (~/Library/Application Support/Sublime Text 3/Packages) in Finder.
Go to the User folder and create the following hierarchy: Packages/User/SublimeREPL/config/Clojure.
Create a new file in Clojure called Main.sublime-menu and open it in Sublime with the JSON syntax.
Add the following to the file:
[
{
"id": "tools",
"children":
[
{"command": "repl_open",
"caption": "Clojure",
"id": "repl_clojure",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": {"windows": ["lein.bat", "repl"],
"linux": ["lein", "repl"],
"osx": ["lein", "repl"]},
"soft_quit": "\n(. System exit 0)\n",
"cwd": {"windows":"c:/Clojure",
"linux": "$file_path",
"osx": "$file_path"},
"syntax": "Packages/Clojure/Clojure.tmLanguage",
"external_id": "clojure",
"extend_env": {"INSIDE_EMACS": "1"}
}
}
]
}
]
Once you save the file, you will now have a Tools → Clojure menu option.