WebStorm debugging create-react-native-app - webstorm

What should I set in Run Debug Configuration in WebStorm to debug a app created by create-react-native-app?
I'm at a loss on how to debug since it doesn't use ~/.node_modules/lib/node_modules/react-native-cli but a custom module called react-native-scripts to start the compiling:
package.json:
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch",
"menu": "adb shell input keyevent 82"
},

You have to use Webstorm/Intellij 2018.1 (through EAP at the moment)
https://youtrack.jetbrains.com/issue/WEB-26951
https://blog.jetbrains.com/webstorm/2018/02/webstorm-2018-1-eap-181-3263/#debugging-expo

I dont think you can do this, at least not in an easy way, and why would you wan't to do it anyway?
React Native ships with great debugging capabilities "out of the box" via Chrome Developer Tools.
Here you can debug code, both running on emulators, and even better on a real device.
See here for details: https://facebook.github.io/react-native/docs/debugging.html

Related

VSCode+LLDB debugging not working properly in Vagrant-Ubuntu

I am using Vagrant to launch a VM of Ubuntu and compile my C++ code in Linux. The Linux version is 5.8.0-59-generic.
The makefile build command is exec: main.o other_lib.o ${CXX} ${CXX_FLAGS} -lc++abi bin/main.o bin/other_lib.o -o bin/exec -g -fstandalone-debug. After running make exec and ./bin/exec, the program can successfully run. However the debugging part is bugged. This is the launch.json config for LLDB:
{
"name": "debug exec lldb",
"type": "cppdbg",
"request": "launch",
"program": "/home/vagrant/bin/exec",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"miDebuggerPath": "/usr/bin/lldb-mi",
"preLaunchTask": "debug exec",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "settings set target.run-args ${input:lldb-debugger-args}"
}
]
}
The first time I ran this debugging config using F5, vscode prompted miDebuggerPath invalid. I found that there was no /usr/bin/lldb-mi executable file in the system, so I ran sudo apt-get install lldb. This is where things get weird:
I tried to run the debugging process via VSCode, and there is no miDebuggerPath invalid error. However, after hitting F5, the terminal will output [1] + Done(127) "/usr/bin/lldb-mi" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-ly4ql3cx.s1b" 1>"/tmp/Microsoft-MIEngine-Out-gfkz1mbe.fex" and print a new prompt that listens for the next command. The hovering debug toolbar of VSCode appeared, but there is a constantly running progress bar (see below). The whole debug process is stuck.
Using ls in /usr/bin/, the lldb-mi file appears red. Using ls -l /usr/bin/lldb-mi indicates that it is a broken link, pointing to another broken link lldb-mi-11:
/usr/bin/lldb is an existing executable. However lldb-mi seems to be a "machine interface" of lldb, and I'm not sure if using lldb as the miDebugger can work.
How can I fix this problem (finding a substitution of lldb-mi or somehow fixing the broken link problem of lldb-mi)?
lldb-mi used to be a part of the lldb project, but it languished for quite a while without a maintainer, and eventually it was broken out into a separate package on GitHub in the hopes that as a stand-alone thing it would get more support from the people who used it. There might be an apt-get for it as a standalone package? Not sure about that. But it's still available on GitHub, so if all else fails you can get and build it yourself. The source code is here: https://github.com/lldb-tools/lldb-mi, which has a README on how to build it.
But if you are primarily interested in using VSCode, you might try lldb-vscode instead. Rather than using the MI interface (which is pretty long in the tooth at this point), it uses MicroSoft's own debugging protocol, and is currently in active development. The lldb-vscode binary does get built as part of the regular lldb build.

How to hit Vscode breakpoints in unit tests from within a docker-compose setup running Django

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.

Is it possible to execute two commands sequentially using commands.json?

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"

Running (lein) REPL in VS CODE

Is there a way to use lein's REPL in VS Code? I mean, using tasks.js, or something.
I wanted an integrated enviroment to run, test and build my clojures applications. I think maybe I could achieve something like this using vs code, because it has support to third parties compilers.
I could use lein run, but it did not work with lein repl.
I've read tasks' documentation, but there's nothing related to REPL.
Here's the tasks.js code I've used:
{
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "lein",
"tasks":
[
{
"taskName": "run",
"showOutput": "always",
"args": ["run"],
"isBuildCommand": true,
"isWatching": false
},
{
"taskName": "repl",
"showOutput": "always",
"args": ["repl"],
"isWatching": true
}
],
"isShellCommand": true
}
As the author of Calva I can recommend it. 😀
Seriously, at the moment it is supporting interactive programming the best. There is a short summary of what it can do in the Editors section of the shadow-cljs user guide: https://shadow-cljs.github.io/docs/UsersGuide.html#_calva_vs_code
Updated (July 2021)
For Clojure and ClojureScript development in VSCode, Calva is the recommended plugin, as it has added a lot of support.
Original Answer (2016)
There's extension available now which you can use.
Github
VS Code Market Place
I don't believe a real REPL is possible at the moment in VSCode.
With that being said, this is currently being worked on over here: https://github.com/Microsoft/vscode/issues/547

Browserstack-runner tests are timing out with ember-qunit tests

I have an ember-cli project and all the tests are written using ember-qunit. I am using browserstack-runner to run the tests on Browserstack.
browserstack-runner provides the plugin for qunit which I am using. Below is my browserstack.json
{
"username": "USERNAME",
"key": "SECRETKEY",
"test_framework" : "qunit",
"test_path": ["tests/index.html"],
"timeout": "120",
"browsers": [
{
"browser": "chrome",
"browser_version": "latest",
"os": "Windows",
"os_version": "7",
"browserstack.debug": true
}
]
}
Tests are running correctly on browserstack. the only problem is, even after all the tests are run(passed) there is no activity and I am getting timeout error after specified value(120s).
I am not able to understand why it's happening. I guess it has something to do with plugin which is written specifically for qunit and not ember-qunit, which is a wrapper arount qunit.
Has anyone tried integrating browserstack with ember-cli project then please guide me.