Skip to content

Instantly share code, notes, and snippets.

@itssimmons
Last active April 15, 2022 04:42
Show Gist options
  • Save itssimmons/e2765eeba1781c7185ced3187b3bbda0 to your computer and use it in GitHub Desktop.
Save itssimmons/e2765eeba1781c7185ced3187b3bbda0 to your computer and use it in GitHub Desktop.
Debug deno on vscode
/**
* @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));
{
"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
}
]
}
@itssimmons
Copy link
Author

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