-
Notifications
You must be signed in to change notification settings - Fork 17
add docs for JS debugger in language docs #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Karthik Ganeshram <kganeshr@akamai.com>
Signed-off-by: Karthik Ganeshram <kganeshr@akamai.com>
|
|
||
| {{ details "Unique ID generator" "- [nanoid](https://www.npmjs.com/package/nanoid)\n- [ulidx](https://www.npmjs.com/package/ulidx)\n- [uuid](https://www.npmjs.com/package/uuid)" }} | ||
|
|
||
| ## Debugging in VSCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given some of the limitations, should this be noted as "preview" or "experimental"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tschneidereit do you have any thoughts here?
|
|
||
| #### Setup | ||
|
|
||
| First, make sure that the extension is installed. Next verify that the templates are new enough to support debugging. This can be verified by looking `.vscode/setting.json` and verifying if something like the following is configured: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the remark "new enough" I think it would be good to document what's the earliest version of the templates which support this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the version would be the templates that get downloaded with spin v3.5 and later. I do not believe templates themselves actually have versions. @itowlson is there a way a user can tell what version of a template they have installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can document the current versions of the templates and VS Code as the setup that works here and that we support.
Co-authored-by: Mikkel Mork Hegnhoj <12242001+mikkelhegn@users.noreply.github.com>
|
|
||
| ## Debugging in VSCode | ||
|
|
||
| The [StarlingMonkey Debugger](https://marketplace.visualstudio.com/items?itemName=BytecodeAlliance.starlingmonkey-debugger) enables debugging components built using the SDK. The debugger currently only works with the HTTP trigger and needs to be restarted for every request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The [StarlingMonkey Debugger](https://marketplace.visualstudio.com/items?itemName=BytecodeAlliance.starlingmonkey-debugger) enables debugging components built using the SDK. The debugger currently only works with the HTTP trigger and needs to be restarted for every request. | |
| You can use the [StarlingMonkey Debugger](https://marketplace.visualstudio.com/items?itemName=BytecodeAlliance.starlingmonkey-debugger) to debug JavaScript HTTP components. |
We do need to mention the "restart with every request" but that needs to be a warning in the usage section rather than part of the intro material.
Or if we feel it really needs to be right up front, pull it out as a warning with context:
> The debugger is a work in progress, and has some known issues and limitations. In particular, you will need to restart it for each request.
But I still think it probably belongs with the "using" section.
|
|
||
| #### Setup | ||
|
|
||
| First, make sure that the extension is installed. Next verify that the templates are new enough to support debugging. This can be verified by looking `.vscode/setting.json` and verifying if something like the following is configured: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe split this into "installing the extension" (once) and "setting up the project" (each project).
| } | ||
| ``` | ||
|
|
||
| If it does not exist, setup the configuration using the [testcase](https://github.com/spinframework/spin-js-sdk/tree/main/test/debugger-testing/spin-ts/.vscode) as a reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If it does not exist, setup the configuration using the [testcase](https://github.com/spinframework/spin-js-sdk/tree/main/test/debugger-testing/spin-ts/.vscode) as a reference. | |
| If it does not exist, set up the configuration using the [test case](https://github.com/spinframework/spin-js-sdk/tree/main/test/debugger-testing/spin-ts/.vscode) as a reference. |
I notice this refers to the directory, not the file. If they need copy both settings.json and launch.json, we should be explicit about that.
|
|
||
| #### Setup | ||
|
|
||
| First, make sure that the extension is installed. Next verify that the templates are new enough to support debugging. This can be verified by looking `.vscode/setting.json` and verifying if something like the following is configured: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| First, make sure that the extension is installed. Next verify that the templates are new enough to support debugging. This can be verified by looking `.vscode/setting.json` and verifying if something like the following is configured: | |
| The first time you want to use the debugger with a project, check that debugging is set up. (Projects created with recent Spin templates will have this already, but projects created using older templates may not.) Your project is ready for debugging if it has a `.vscode/settings.json` file containing a configuration section similar to: |
although I think it would need a launch.json as well, or is that magically created on demand?
|
|
||
| If it does not exist, setup the configuration using the [testcase](https://github.com/spinframework/spin-js-sdk/tree/main/test/debugger-testing/spin-ts/.vscode) as a reference. | ||
|
|
||
| Once that is setup, we need to update the configuration in `spin.toml` to build the debug component. This can be done by updating the build command in `spin.toml` to be `npm run build:debug`. We also need to add `"tcp://127.0.0.1:*"` to the list of `allowed_outbound_hosts`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Once that is setup, we need to update the configuration in `spin.toml` to build the debug component. This can be done by updating the build command in `spin.toml` to be `npm run build:debug`. We also need to add `"tcp://127.0.0.1:*"` to the list of `allowed_outbound_hosts`. | |
| Once that is set up, we need to update the configuration in `spin.toml` to build the debug component. This can be done by setting the build command in `spin.toml` to be `npm run build:debug`. We also need to add `"tcp://127.0.0.1:*"` to the list of `allowed_outbound_hosts`. |
(just trying to avoid repeating "updating")
|
|
||
| #### Attaching the Debugger | ||
|
|
||
| We can start the app and attach the debugger to it using the `F5` key or using the start debugger button as show below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| We can start the app and attach the debugger to it using the `F5` key or using the start debugger button as show below: | |
| We can start the app and attach the debugger to it using the `F5` key or using the Start Debugger button as show below: |
|
|
||
|  | ||
|
|
||
| **Note:** that the debugger currently does not follow sourcemaps for npm dependencies as some packages may not bundle the source code in the pacakge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **Note:** that the debugger currently does not follow sourcemaps for npm dependencies as some packages may not bundle the source code in the pacakge. | |
| **Note:** The debugger currently does not follow sourcemaps for NPM dependencies, as some packages do not bundle the source code in the package. |
|
|
||
| **Note:** that the debugger currently does not follow sourcemaps for npm dependencies as some packages may not bundle the source code in the pacakge. | ||
|
|
||
| ## Caveats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure but it feels like this has come adrift from the stuff about APIs and packages that it more naturally lives with perhaps?
Adds docs for using the StarlingMonkey debugger with the JavaScript SDK for Spin.