Last active
April 15, 2022 04:42
-
-
Save itssimmons/e2765eeba1781c7185ced3187b3bbda0 to your computer and use it in GitHub Desktop.
Debug deno on vscode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @description create a to recreate the fibonacci sequence and returns it into an array | |
* @param n total of loops | |
* @returns and array filled with fibonacci sequence | |
* @example [0,1,1,2,3,5,8,13,21...] | |
*/ | |
export function fibonashi(n: number): unknown[] { | |
const a: number[] = [0, 1]; | |
if (n === 1) return [0]; | |
if (n === 2) return [0, 1]; | |
for (let i = 2; i < n; ++i) { | |
a[i] = a[i - 1] + a[i - 2]; | |
} | |
return a; | |
} | |
console.log(fibonashi(9)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"request": "launch", | |
"name": "Launch Program", | |
"type": "node", | |
"program": "${workspaceFolder}/index.ts", // replace to your main file | |
"cwd": "${workspaceFolder}", | |
"runtimeExecutable": "deno", | |
"outputCapture": "std", // this will output things on DEBUG CONSOLE | |
"runtimeArgs": [ | |
"run", | |
"--unstable", | |
"--inspect-brk", | |
// ^ important, see the quote on https://deno.land/manual@v1.19.1/getting_started/debugging_your_code#debugging-your-code | |
"--allow-all" | |
], | |
"attachSimplePort": 9229 | |
} | |
] | |
} |
Error at lauch.json because is not a .jsonc file, but in vscode work as .jsonc, so don't worry about it
⚠️ you must have openchrome://inspect
in the browser, and configure your network targets to work with your current debugging session, when you will see your file in Remote Target it is because everything is working fine!
If you have errors at the key "type" in launch.json surely it is because you don't have anything to run the node debugger so I recommend you to install: https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug-nightly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The quote says: