Closed laike9m closed 4 years ago
Can you explain a bit more on why your extension wants to open the devtools ?
this is possible technically but I will let @bpasero drive the discussion about if this needs to be supported. Having more context about your extension and use case will help drive the discussion. Thanks!
Sure. I'm working on an extension that logs runtime information and visualize how each variable changed during execution. When users hover on a node (think of it as a variable at a specific point of execution), we use console.log
to print its value in console so users can see and inspect it.
I decided to use the console to display values because:
console.log
is nicely formatted, and is scalable to show data sturcture with a large number of elements (compared to values displayed in tree view and popup which are not able to show every element due to limited space).Therefore, I would like to open the devtools window when the extension launches, so users don't have to do it themselves.
From the API design perspective, it is more intuitive if consistency is kept. Even without specific use cases (though I'm sure there are many), having webview/non-webview devtools expose the same APIs, IMHO, is better than exposing different APIs.
This is an abuse of the developer tools. The developer tools should only be used for development of VS Code or for development of extensions, they should never be shown to users.
Instead, try using VS Code's debug console or output channels or finding some other way to surface this information in VS Code itself. Don't use the developer tools
Closing as the use case is invalid, even if the feature request for a new command is innocuous on its own.
I respectfully disagree. The debug console serves a different purpose and it is not capable of doing what the devtools console can do.
First, the debug console is not designed to support user interactions, but merely serves as a way to show logs.
Second and more importantly, the debug console is not able to display large data sturctures, like an array with thousands of elements.
The usage shouldn't be considered an abuse because currently there is no way of achieving the same behavior in VS Code. If it is not supported natively, I would have to ask users to open the devtools window themselves, as the debug tools is not capable of serving the purposes I need.
Meanwhile, I see no reason to support Open Webview Dev Tools
but not Open Dev Tools
. I hope the decision can be reconsidered.
If the current VS Code apis don't offer what you need, please file a feature request. Again, the developer tools are only for VS Code development. They will not work on web versions of VS Code and it is not a good user experience to pop up the chrome dev's tool of the editor instance itself in order to show logs
By "Visual Studio Codespaces" do you mean codespaces?
I will file a feature request.
Right now VS Code supports
Is it possible to support "Open (non-webview) Developer Tools" as well? It seems under the hood it's already supported, just not exposed to users: https://github.com/microsoft/vscode/blob/f74e473238aca7b79c08be761d99a0232838ca4c/src/vs/platform/electron/electron-main/electronMainService.ts#L461
To briefly describe my use case, I'm developing a VSC extension where I would like users to see Developer Tools window when the extension is activated. Right now since we only have the "toggle" operation, if the devtools is already opened, it would close the devtools window.