src/vs/workbench/api/common/extHostTelemetry.ts

343 LOC · 107 covered · 236 uncovered · 19 ranges · 47 concepts · 1 introducers · 42 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/workbench/api/common/extHostCommands.ts · 507 LOCcommon/extHostCommands.t…src/vs/workbench/api/common/extHostTerminalService.ts · 1338 LOCcommon/extHostTerminalSe…src/vs/workbench/api/common/extHostTestItem.ts · 197 LOCcommon/extHostTestItem.t…src/vs/workbench/services/extensions/common/extensionHostProtocol.ts · 163 LOCcommon/extensionHostProt…extHostMcp.test|title=ExtHostMcp IAuthMetadata properties should expose readonly properties|occurrence=1, extHostMcp.test|title=ExtHostMcp createAuthMetadata should create IAuthMetadata with fetched server metadata|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.ts ×1 · 3 introduced LOCextHostMcp.ts ×1extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should handle multiple Bearer challenges and use first scope|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when scopes are the same|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true and update scopes when WWW-Authenticate header contains new scopes|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when scopes are same but in different order|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true when updating from defined scopes to undefined (no scope in header)|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle non-401 status codes in update()|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should ignore non-Bearer schemes|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true when updating from undefined scopes to defined scopes|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.ts ×1 · 1 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×1 · 2 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×1 · 6 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×1 · 4 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×2 · 4 introduced LOCextHostMcp.ts ×2extHostMcp.ts ×1 · 1 introduced LOCextHostMcp.ts ×1extHostMcp.test|title=ExtHostMcp createAuthMetadata should fall back to default metadata when server metadata fetch fails|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.ts ×4 · 6 introduced LOCextHostMcp.ts ×4extHostMcp.test|title=ExtHostMcp createAuthMetadata should use scopes from WWW-Authenticate header when resource metadata has none|occurrence=1, extHostMcp.test|title=ExtHostMcp createAuthMetadata should use scopes from WWW-Authenticate header even when resource metadata has scopes_supported|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.ts ×1 · 2 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×1 · 6 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×4 · 13 introduced LOCextHostMcp.ts ×4extHostMcpNode.ts ×8 · 45 introduced LOCextHostMcpNode.ts ×8extHostMcp.test|title=ExtHostMcp createAuthMetadata should pass launch headers when fetching metadata from same origin|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.ts ×5 · 25 introduced LOCextHostMcp.ts ×5extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle invalid JSON in resource metadata response|occurrence=1 · 0 introduced LOCextHostMcp.test|title=Ex…extHostMcp.ts ×3 · 23 introduced LOCextHostMcp.ts ×3extHostMcp.ts ×1 · 2 introduced LOCextHostMcp.ts ×1extHostMcp.ts ×8 · 60 introduced LOCextHostMcp.ts ×8extHostMcp.ts ×43 · 874 introduced LOCextHostMcp.ts ×43extensionHostMain.ts ×1 · 2 introduced LOCextensionHostMain.ts ×1reset prepareStackTrace-callback|occurrence=1, extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 prevent rewrapping|occurrence=1 · 0 introduced LOCreset prepareStackTrace-…extensionHostMain.ts ×5 · 26 introduced LOCextensionHostMain.ts ×5f0f2e182082072efdaf0f8e1537d2cce Restored, too many uses before restoration|occurrence=1 · 0 introduced LOCf0f2e182082072efdaf0f8e1…extensionHostMain.ts ×1 · 3 introduced LOCextensionHostMain.ts ×1extensionHostMain.ts ×1 · 3 introduced LOCextensionHostMain.ts ×1extensionHostMain.ts ×11 · 164 introduced LOCextensionHostMain.ts ×11extHostExtensionService.ts ×64 · 1246 introduced LOCextHostExtensionService.…extHostTerminalService.ts ×31 · 156 introduced LOCextHostTerminalService.t…extHostTerminalShellIntegration.ts ×3 · 13 introduced LOCextHostTerminalShellInte…extHostTerminalShellIntegration.ts ×6 · 28 introduced LOCextHostTerminalShellInte…extHostTerminalShellIntegration.ts ×13 · 51 introduced LOCextHostTerminalShellInte…extHostTerminalShellIntegration.ts ×1 · 4 introduced LOCextHostTerminalShellInte…extHostTerminalShellIntegration.ts ×1 · 3 introduced LOCextHostTerminalShellInte…extHostTerminalShellIntegration.ts ×1 · 2 introduced LOCextHostTerminalShellInte…extHostTerminalShellIntegration.ts ×29 · 253 introduced LOCextHostTerminalShellInte…extHostTerminalService.ts ×109 · 894 introduced LOCextHostTerminalService.t…extHostMcp.test|title=ExtHostMcp IAuthMetadata properties should allow undefined scopes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata properties should allow undefined scopes|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata properties should expose readonly properties|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata properties should expose readonly properties|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should handle multiple Bearer challenges and use first scope|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should handle multiple Bearer challenges and use first scope|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should ignore non-Bearer schemes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should ignore non-Bearer schemes|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when no WWW-Authenticate header and scopes are already undefined|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when no WWW-Authenticate header and scopes are already undefined|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when scopes are same but in different order|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when scopes are same but in different order|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when scopes are the same|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return false when scopes are the same|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true and update scopes when WWW-Authenticate header contains new scopes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true and update scopes when WWW-Authenticate header contains new scopes|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true when updating from defined scopes to undefined (no scope in header)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true when updating from defined scopes to undefined (no scope in header)|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true when updating from undefined scopes to defined scopes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp IAuthMetadata update() should return true when updating from undefined scopes to defined scopes|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should create IAuthMetadata with fetched server metadata|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should create IAuthMetadata with fetched server metadata|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should fall back to default metadata when server metadata fetch fails|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should fall back to default metadata when server metadata fetch fails|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle empty scope string in WWW-Authenticate header|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle empty scope string in WWW-Authenticate header|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle invalid JSON in resource metadata response|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle invalid JSON in resource metadata response|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle malformed WWW-Authenticate header gracefully|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle malformed WWW-Authenticate header gracefully|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle non-401 status codes in update()|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should handle non-401 status codes in update()|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should pass launch headers when fetching metadata from same origin|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should pass launch headers when fetching metadata from same origin|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should use resource_metadata challenge URL from WWW-Authenticate header|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should use resource_metadata challenge URL from WWW-Authenticate header|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should use scopes from WWW-Authenticate header even when resource metadata has scopes_supported|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should use scopes from WWW-Authenticate header even when resource metadata has scopes_supported|occurrence=1extHostMcp.test|title=Ex…extHostMcp.test|title=ExtHostMcp createAuthMetadata should use scopes from WWW-Authenticate header when resource metadata has none|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostMcp.test|title=ExtHostMcp createAuthMetadata should use scopes from WWW-Authenticate header when resource metadata has none|occurrence=1extHostMcp.test|title=Ex…extHostTerminalService.test|title=ExtHostTerminalService $acceptTerminalClosed cancels in-flight link providers and clears the link cache|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalService.test|title=ExtHostTerminalService $acceptTerminalClosed cancels in-flight link providers and clears the link cache|occurrence=1extHostTerminalService.t…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration different execution unexpectedly ended|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration different execution unexpectedly ended|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand 4 multi-line commands with output|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand 4 multi-line commands with output|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand ^C to clear previous command|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand ^C to clear previous command|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand multi-line command comment followed by long second command|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand multi-line command comment followed by long second command|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand multi-line command line|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand multi-line command line|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand multi-line command with long second command|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration executeCommand multi-line command with long second command|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration no end event|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration no end event|occurrence=1extHostTerminalShellInte…extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration simple execution|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extHostTerminalShellIntegration.test|title=InternalTerminalShellIntegration simple execution|occurrence=1extHostTerminalShellInte…extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 basics|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 basics|occurrence=1extensionHostMain.test|t…f0f2e182082072efdaf0f8e1537d2cce Never restored, separate operations|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 https://gist.github.com/thecrypticace/f0f2e182082072efdaf0f8e1537d2cce Never restored, separate operations|occurrence=1f0f2e182082072efdaf0f8e1…f0f2e182082072efdaf0f8e1537d2cce Restored, separate operations|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 https://gist.github.com/thecrypticace/f0f2e182082072efdaf0f8e1537d2cce Restored, separate operations|occurrence=1f0f2e182082072efdaf0f8e1…f0f2e182082072efdaf0f8e1537d2cce Restored, too many uses before restoration|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 https://gist.github.com/thecrypticace/f0f2e182082072efdaf0f8e1537d2cce Restored, too many uses before restoration|occurrence=1f0f2e182082072efdaf0f8e1…extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 prevent rewrapping|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 prevent rewrapping|occurrence=1extensionHostMain.test|t…reset prepareStackTrace-callback|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 set/reset prepareStackTrace-callback|occurrence=1reset prepareStackTrace-…extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 wrap prepareStackTrace-callback|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/common/extensionHostMain.test|title=ExtensionHostMain#ErrorHandler - Wrapping prepareStackTrace can cause slowdown and eventual stack overflow #184926 wrap prepareStackTrace-callback|occurrence=1extensionHostMain.test|t…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg does not add stray ^ to argument values|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg does not add stray ^ to argument values|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg doubles embedded double quotes (cmd.exe convention)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg doubles embedded double quotes (cmd.exe convention)|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg neutralizes cmd.exe metacharacters inside quotes (CVE-2024-27980)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg neutralizes cmd.exe metacharacters inside quotes (CVE-2024-27980)|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with parentheses without injecting ^|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with parentheses without injecting ^|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with spaces|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with spaces|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg wraps simple values in double quotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg wraps simple values in double quotes|occurrence=1extHostMcpNode.test|titl…Focused file · src/vs/workbench/api/common/extHostTelemetry.ts · 343 LOCcommon/extHostTelemetry.…

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- extHostTerminalService.ts ×109
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import type * as vscode from 'vscode';
7 > import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';
8 > import { Event, Emitter } from '../../../base/common/event.js';
9 > import { ExtHostTelemetryShape } from './extHost.protocol.js';
10 > import { ICommonProperties, TelemetryLevel } from '../../../platform/telemetry/common/telemetry.js';
11 > import { ILogger, ILoggerService } from '../../../platform/log/common/log.js';
12 > import { IExtHostInitDataService } from './extHostInitDataService.js';
13 > import { ExtensionIdentifier, IExtensionDescription } from '../../../platform/extensions/common/extensions.js';
14 > import { UIKind } from '../../services/extensions/common/extensionHostProtocol.js';
15 > import { cleanData, cleanRemoteAuthority, TelemetryLogGroup } from '../../../platform/telemetry/common/telemetryUtils.js';
16 > import { mixin } from '../../../base/common/objects.js';
17 > import { Disposable } from '../../../base/common/lifecycle.js';
18 > import { localize } from '../../../nls.js';
19 >
20 > type ExtHostTelemetryEventData = Record<string, any> & {
21 > properties?: Record<string, any>;
22 > measurements?: Record<string, number>;
23 > };
24 >
25 > export class ExtHostTelemetry extends Disposable implements ExtHostTelemetryShape {
26 >
27 > readonly _serviceBrand: undefined;
28 >
29 > private readonly _onDidChangeTelemetryEnabled = this._register(new Emitter<boolean>());
30 > readonly onDidChangeTelemetryEnabled: Event<boolean> = this._onDidChangeTelemetryEnabled.event;
31 >
32 > private readonly _onDidChangeTelemetryConfiguration = this._register(new Emitter<vscode.TelemetryConfiguration>());
33 > readonly onDidChangeTelemetryConfiguration: Event<vscode.TelemetryConfiguration> = this._onDidChangeTelemetryConfiguration.event;
34 >
35 > private _productConfig: { usage: boolean; error: boolean } = { usage: true, error: true };
36 > private _level: TelemetryLevel = TelemetryLevel.NONE;
37 > private _oldTelemetryEnablement: boolean | undefined;
38 > private readonly _inLoggingOnlyMode: boolean = false;
39 > private readonly _outputLogger: ILogger;
40 > private readonly _telemetryLoggers = new Map<string, ExtHostTelemetryLogger[]>();
41 >
42 > constructor(
43 isWorker: boolean,
44 @IExtHostInitDataService private readonly initData: IExtHostInitDataService,
45 @ILoggerService loggerService: ILoggerService,
46 ) {
47 super();
48 this._inLoggingOnlyMode = this.initData.environment.isExtensionTelemetryLoggingOnly;
49 const id = initData.remote.isRemote ? 'remoteExtHostTelemetry' : isWorker ? 'workerExtHostTelemetry' : 'extHostTelemetry';
50 this._outputLogger = this._register(loggerService.createLogger(id,
51 {
52 name: localize('extensionTelemetryLog', "Extension Telemetry{0}", this._inLoggingOnlyMode ? ' (Not Sent)' : ''),
53 hidden: true,
54 group: TelemetryLogGroup,
55 }));
56 }
58 > getTelemetryConfiguration(): boolean {
59 return this._level === TelemetryLevel.USAGE;
60 }
62 > getTelemetryDetails(): vscode.TelemetryConfiguration {
63 return {
64 isCrashEnabled: this._level >= TelemetryLevel.CRASH,
65 isErrorsEnabled: this._productConfig.error ? this._level >= TelemetryLevel.ERROR : false,
66 isUsageEnabled: this._productConfig.usage ? this._level >= TelemetryLevel.USAGE : false
67 };
68 }
70 > instantiateLogger(extension: IExtensionDescription, sender: vscode.TelemetrySender, options?: vscode.TelemetryLoggerOptions) {
71 const telemetryDetails = this.getTelemetryDetails();
72 const logger = new ExtHostTelemetryLogger(
73 sender,
74 options,
75 extension,
76 this._outputLogger,
77 this._inLoggingOnlyMode,
78 this.getBuiltInCommonProperties(extension),
79 { isUsageEnabled: telemetryDetails.isUsageEnabled, isErrorsEnabled: telemetryDetails.isErrorsEnabled }
80 );
81 const loggers = this._telemetryLoggers.get(extension.identifier.value) ?? [];
82 this._telemetryLoggers.set(extension.identifier.value, [...loggers, logger]);
83 return logger.apiTelemetryLogger;
84 }
86 > $initializeTelemetryLevel(level: TelemetryLevel, supportsTelemetry: boolean, productConfig?: { usage: boolean; error: boolean }): void {
87 this._level = level;
88 this._productConfig = productConfig ?? { usage: true, error: true };
89 }
91 > getBuiltInCommonProperties(extension: IExtensionDescription): ICommonProperties {
92 const commonProperties: ICommonProperties = Object.create(null);
93 // TODO @lramos15, does os info like node arch, platform version, etc exist here.
94 // Or will first party extensions just mix this in
95 commonProperties['common.extname'] = `${extension.publisher}.${extension.name}`;
96 commonProperties['common.extversion'] = extension.version;
97 commonProperties['common.vscodemachineid'] = this.initData.telemetryInfo.machineId;
98 commonProperties['common.vscodesessionid'] = this.initData.telemetryInfo.sessionId;
99 commonProperties['common.vscodecommithash'] = this.initData.commit;
100 commonProperties['common.sqmid'] = this.initData.telemetryInfo.sqmId;
101 commonProperties['common.devDeviceId'] = this.initData.telemetryInfo.devDeviceId ?? this.initData.telemetryInfo.machineId;
102 commonProperties['common.vscodeversion'] = this.initData.version;
103 commonProperties['common.vscodereleasedate'] = this.initData.date;
104 commonProperties['common.isnewappinstall'] = isNewAppInstall(this.initData.telemetryInfo.firstSessionDate);
105 commonProperties['common.product'] = this.initData.environment.appHost;
106
107 switch (this.initData.uiKind) {
108 case UIKind.Web:
109 commonProperties['common.uikind'] = 'web';
110 break;
111 case UIKind.Desktop:
112 commonProperties['common.uikind'] = 'desktop';
113 break;
114 default:
115 commonProperties['common.uikind'] = 'unknown';
116 }
117
118 commonProperties['common.remotename'] = cleanRemoteAuthority(this.initData.remote.authority, this.initData);
119
120 if (this.initData.environment.isSessionsWindow) {
121 // __GDPR__COMMON__ "common.isAgentsWindow" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
122 commonProperties['common.isAgentsWindow'] = true;
123 }
124
125 return commonProperties;
126 }
128 > $onDidChangeTelemetryLevel(level: TelemetryLevel): void {
129 this._oldTelemetryEnablement = this.getTelemetryConfiguration();
130 this._level = level;
131 const telemetryDetails = this.getTelemetryDetails();
132 // Remove all disposed loggers
133 this._telemetryLoggers.forEach((loggers, key) => {
134 const newLoggers = loggers.filter(l => !l.isDisposed);
135 if (newLoggers.length === 0) {
136 this._telemetryLoggers.delete(key);
137 } else {
138 this._telemetryLoggers.set(key, newLoggers);
139 }
140 });
141 // Loop through all loggers and update their level
142 this._telemetryLoggers.forEach(loggers => {
143 for (const logger of loggers) {
144 logger.updateTelemetryEnablements(telemetryDetails.isUsageEnabled, telemetryDetails.isErrorsEnabled);
145 }
146 });
147
148 if (this._oldTelemetryEnablement !== this.getTelemetryConfiguration()) {
149 this._onDidChangeTelemetryEnabled.fire(this.getTelemetryConfiguration());
150 }
151 this._onDidChangeTelemetryConfiguration.fire(this.getTelemetryDetails());
152 }
154 > onExtensionError(extension: ExtensionIdentifier, error: Error): boolean {
155 const loggers = this._telemetryLoggers.get(extension.value);
156 const nonDisposedLoggers = loggers?.filter(l => !l.isDisposed);
157 if (!nonDisposedLoggers) {
158 this._telemetryLoggers.delete(extension.value);
159 return false;
160 }
161 let errorEmitted = false;
162 for (const logger of nonDisposedLoggers) {
163 if (logger.ignoreUnhandledExtHostErrors) {
164 continue;
165 }
166 logger.logError(error);
167 errorEmitted = true;
168 }
169 return errorEmitted;
170 }
172 >
173 > export class ExtHostTelemetryLogger {
174 >
175 > static validateSender(sender: vscode.TelemetrySender): void {
176 > if (typeof sender !== 'object') {
177 > throw new TypeError('TelemetrySender argument is invalid');
178 > }
179 > if (typeof sender.sendEventData !== 'function') {
180 > throw new TypeError('TelemetrySender.sendEventData must be a function');
181 > }
182 > if (typeof sender.sendErrorData !== 'function') {
183 > throw new TypeError('TelemetrySender.sendErrorData must be a function');
184 > }
185 > if (typeof sender.flush !== 'undefined' && typeof sender.flush !== 'function') {
186 > throw new TypeError('TelemetrySender.flush must be a function or undefined');
187 > }
188 > }
189 >
190 > private readonly _onDidChangeEnableStates = new Emitter<vscode.TelemetryLogger>();
191 > private readonly _ignoreBuiltinCommonProperties: boolean;
192 > private readonly _additionalCommonProperties: Record<string, any> | undefined;
193 > public readonly ignoreUnhandledExtHostErrors: boolean;
194 >
195 > private _telemetryEnablements: { isUsageEnabled: boolean; isErrorsEnabled: boolean };
196 > private _apiObject: vscode.TelemetryLogger | undefined;
197 > private _sender: vscode.TelemetrySender | undefined;
198 >
199 > constructor(
200 sender: vscode.TelemetrySender,
201 options: vscode.TelemetryLoggerOptions | undefined,
202 private readonly _extension: IExtensionDescription,
203 private readonly _logger: ILogger,
204 private readonly _inLoggingOnlyMode: boolean,
205 private readonly _commonProperties: Record<string, any>,
206 telemetryEnablements: { isUsageEnabled: boolean; isErrorsEnabled: boolean }
207 ) {
208 this.ignoreUnhandledExtHostErrors = options?.ignoreUnhandledErrors ?? false;
209 this._ignoreBuiltinCommonProperties = options?.ignoreBuiltInCommonProperties ?? false;
210 this._additionalCommonProperties = options?.additionalCommonProperties;
211 this._sender = sender;
212 this._telemetryEnablements = { isUsageEnabled: telemetryEnablements.isUsageEnabled, isErrorsEnabled: telemetryEnablements.isErrorsEnabled };
213 }
215 > updateTelemetryEnablements(isUsageEnabled: boolean, isErrorsEnabled: boolean): void {
216 if (this._apiObject) {
217 this._telemetryEnablements = { isUsageEnabled, isErrorsEnabled };
218 this._onDidChangeEnableStates.fire(this._apiObject);
219 }
220 }
222 > mixInCommonPropsAndCleanData(data: ExtHostTelemetryEventData): Record<string, any> {
223 // Some telemetry modules prefer to break properties and measurmements up
224 // We mix common properties into the properties tab.
225 let updatedData = data.properties ? (data.properties ?? {}) : data;
226
227 // We don't clean measurements since they are just numbers
228 updatedData = cleanData(updatedData, []);
229
230 if (this._additionalCommonProperties) {
231 updatedData = mixin(updatedData, this._additionalCommonProperties);
232 }
233
234 if (!this._ignoreBuiltinCommonProperties) {
235 updatedData = mixin(updatedData, this._commonProperties);
236 }
237
238 if (data.properties) {
239 data.properties = updatedData;
240 } else {
241 data = updatedData;
242 }
243
244 return data;
245 }
247 > private logEvent(eventName: string, data?: Record<string, any>): void {
248 // No sender means likely disposed of, we should no-op
249 if (!this._sender) {
250 return;
251 }
252 // If it's a built-in extension (vscode publisher) we don't prefix the publisher and only the ext name
253 if (this._extension.publisher === 'vscode') {
254 eventName = this._extension.name + '/' + eventName;
255 } else {
256 eventName = this._extension.identifier.value + '/' + eventName;
257 }
258 data = this.mixInCommonPropsAndCleanData(data || {});
259 if (!this._inLoggingOnlyMode) {
260 this._sender?.sendEventData(eventName, data);
261 }
262 this._logger.trace(eventName, data);
263 }
265 > logUsage(eventName: string, data?: Record<string, any>): void {
266 if (!this._telemetryEnablements.isUsageEnabled) {
267 return;
268 }
269 this.logEvent(eventName, data);
270 }
272 > logError(eventNameOrException: Error | string, data?: Record<string, any>): void {
273 if (!this._telemetryEnablements.isErrorsEnabled || !this._sender) {
274 return;
275 }
276 if (typeof eventNameOrException === 'string') {
277 this.logEvent(eventNameOrException, data);
278 } else {
279 const errorData = {
280 name: eventNameOrException.name,
281 message: eventNameOrException.message,
282 stack: eventNameOrException.stack,
283 cause: eventNameOrException.cause
284 };
285 const cleanedErrorData = cleanData(errorData, []);
286 // Reconstruct the error object with the cleaned data
287 const cleanedError = new Error(typeof cleanedErrorData.message === 'string' ? cleanedErrorData.message : undefined, {
288 cause: cleanedErrorData.cause
289 });
290 cleanedError.stack = typeof cleanedErrorData.stack === 'string' ? cleanedErrorData.stack : undefined;
291 cleanedError.name = typeof cleanedErrorData.name === 'string' ? cleanedErrorData.name : 'unknown';
292 data = this.mixInCommonPropsAndCleanData(data || {});
293 if (!this._inLoggingOnlyMode) {
294 this._sender.sendErrorData(cleanedError, data);
295 }
296 this._logger.trace('exception', data);
297 }
298 }
300 > get apiTelemetryLogger(): vscode.TelemetryLogger {
301 if (!this._apiObject) {
302 const that = this;
303 const obj: vscode.TelemetryLogger = {
304 logUsage: that.logUsage.bind(that),
305 get isUsageEnabled() {
306 return that._telemetryEnablements.isUsageEnabled;
307 },
308 get isErrorsEnabled() {
309 return that._telemetryEnablements.isErrorsEnabled;
310 },
311 logError: that.logError.bind(that),
312 dispose: that.dispose.bind(that),
313 onDidChangeEnableStates: that._onDidChangeEnableStates.event.bind(that)
314 };
315 this._apiObject = Object.freeze(obj);
316 }
317 return this._apiObject;
318 }
320 > get isDisposed(): boolean {
321 return !this._sender;
322 }
324 > dispose(): void {
325 if (this._sender?.flush) {
326 let tempSender: vscode.TelemetrySender | undefined = this._sender;
327 this._sender = undefined;
328 Promise.resolve(tempSender.flush!()).then(tempSender = undefined);
329 this._apiObject = undefined;
330 } else {
331 this._sender = undefined;
332 }
333 this._onDidChangeEnableStates.dispose();
334 }
336 >
337 > export function isNewAppInstall(firstSessionDate: string): boolean {
338 const installAge = Date.now() - new Date(firstSessionDate).getTime();
339 return isNaN(installAge) ? false : installAge < 1000 * 60 * 60 * 24; // install age is less than a day
340 }
342 > export const IExtHostTelemetry = createDecorator<IExtHostTelemetry>('IExtHostTelemetry');
343 > export interface IExtHostTelemetry extends ExtHostTelemetry, ExtHostTelemetryShape { }