Skip to content
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

doc: add code example to inspector.url() method #29496

Closed
wants to merge 5 commits into from

Conversation

juanarbol
Copy link
Member

Checklist

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. inspector Issues and PRs related to the V8 inspector protocol labels Sep 8, 2019
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
@juanarbol
Copy link
Member Author

ping @Trott

@Trott
Copy link
Member

Trott commented Sep 25, 2019

@Trott Trott added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Sep 25, 2019
@Trott
Copy link
Member

Trott commented Sep 25, 2019

@nodejs/documentation How do we feel about this sample code? It's not really a runnable code sample. It's really just "Here's what the output would be with three completely different invocations of Node.js." I'm OK with this because it's probably still an improvement over the current doc. But there's probably an even better way to show this that doesn't suggest that the value can change within a single process when it won't?

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 25, 2019
@juanarbol
Copy link
Member Author

juanarbol commented Sep 25, 2019

@Trott I'm not part of documentation working group, but I could change that JS sintax to Shell, so instead of:

// Node.js process was called with --inspect flag.
require('inspector').url()
Debugger listening on ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72
For help see https://nodejs.org/en/docs/inspector
ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72

Could be more like:

$ node --inspect -p "require('inspector').url()"
Debugger listening on ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72
For help see https://nodejs.org/en/docs/inspector
ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72

@Trott
Copy link
Member

Trott commented Sep 26, 2019

@Trott I'm not part of documentation working group, but I could change that JS sintax to Shell, so instead of:

// Node.js process was called with --inspect flag.
require('inspector').url()
Debugger listening on ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72
For help see https://nodejs.org/en/docs/inspector
ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72

Could be more like:

$ node --inspect -p "require('inspector').url()"
Debugger listening on ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72
For help see https://nodejs.org/en/docs/inspector
ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72

I could see that being a good option, especially if the commands in question work verbatim on Windows.

@juanarbol
Copy link
Member Author

I'm not a Windows expert, but, I'd love to see the @nodejs/documentation opinions before making a new change, but yeah! I can change this for making this better.

@Trott
Copy link
Member

Trott commented Sep 27, 2019

I'm not a Windows expert, but, I'd love to see the @nodejs/documentation opinions before making a new change, but yeah! I can change this for making this better.

I'm not a Windows expert, but I think those commands would work on Windows too. @nodejs/platform-windows

@Trott

This comment has been minimized.

doc/api/inspector.md Outdated Show resolved Hide resolved
@Trott Trott removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 27, 2019
@juanarbol
Copy link
Member Author

I found something: "Return the URL of the active inspector, or undefined if there is none.", and by the way, In default options, I see that, by default, debugger is 127.0.0.1:9229, maybe, maybe... say that could improves documentation:

"Return the URL of the active inspector, 127.0.0.1:9229 by default, or undefined if there is none." With better sintax, of course.

@juanarbol
Copy link
Member Author

Pong @Trott

@@ -52,6 +52,21 @@ parameter usage.

Return the URL of the active inspector, or `undefined` if there is none.

```console
$ node --inspect -p "require('inspector').url()"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since built-in modules are automatically loaded when Node.js is run this way, we could consider simplifying to something like this here and below?:

Suggested change
$ node --inspect -p "require('inspector').url()"
$ node --inspect -p 'inspector.url()'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And adding to the suggested change above, we can make the output easier to read by making it clear what part of the output is from inspector.url() since there are a couple other lines of output that might confuse the reader?:

Suggested change
$ node --inspect -p "require('inspector').url()"
$ node --inspect -p '`\ninspector.url() result: ${inspector.url()}\n`'```

That makes the command line a little bit harder to read, but the output easier to read, so...
¯\(ツ)

@Trott
Copy link
Member

Trott commented Oct 3, 2019

My comments above are suggestions only. If someone wants to run this on CI and land it as it is right now, I'm fine with that.

@juanarbol
Copy link
Member Author

Ping @Trott, I think this is ready, is it?

@BridgeAR BridgeAR requested a review from Trott December 9, 2019 22:47
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Dec 9, 2019

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 9, 2019
@targos
Copy link
Member

targos commented Dec 11, 2019

Landed in 4113601

@targos targos closed this Dec 11, 2019
targos pushed a commit that referenced this pull request Dec 11, 2019
PR-URL: #29496
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 13, 2019
PR-URL: #29496
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@MylesBorins MylesBorins mentioned this pull request Dec 13, 2019
targos pushed a commit that referenced this pull request Jan 14, 2020
PR-URL: #29496
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
PR-URL: #29496
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
@juanarbol juanarbol deleted the inspect-docs branch January 19, 2021 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants