src/vs/base/common/network.ts

440 LOC · 368 covered · 72 uncovered · 42 ranges · 14982 concepts · 12 introducers · 7766 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 filebracketPairsTree.ts ×6 · 93 introduced LOCbracketPairsTree.ts ×6textModel.ts ×1 · 6 introduced LOCtextModel.ts ×1textModel.ts ×2 · 10 introduced LOCtextModel.ts ×2colorThemeData.ts ×16 · 64 introduced LOCcolorThemeData.ts ×16extensionsScannerService.ts ×5 · 21 introduced LOCextensionsScannerService…io.ts ×12 · 175 introduced LOCio.ts ×12configurationRegistry.ts ×1 · 2 introduced LOCconfigurationRegistry.ts…fixtures.test|title=diffing fixtures equals-legacy|occurrence=1 · 0 introduced LOCfixtures.test|title=diff…legacyLinesDiffComputer.ts ×5 · 26 introduced LOClegacyLinesDiffComputer.…viewLineRenderer.ts ×1 · 3 introduced LOCviewLineRenderer.ts ×1pfs.test|title=PFS rename without retry|occurrence=1, pfs.test|title=PFS copy, rename and delete|occurrence=1 · 0 introduced LOCpfs.test|title=PFS renam…zip.ts ×9 · 51 introduced LOCzip.ts ×9mcpStdioStateHandler.ts ×3 · 7 introduced LOCmcpStdioStateHandler.ts …mcpStdioStateHandler.test|title=McpStdioStateHandler stdin ends process|occurrence=1, mcpStdioStateHandler.test|title=McpStdioStateHandler sigterm after grace|occurrence=1 · 0 introduced LOCmcpStdioStateHandler.tes…mcpStdioStateHandler.ts ×8 · 46 introduced LOCmcpStdioStateHandler.ts …encoding.test|title=Encoding toDecodeStream - some stream (UTF-8 issue #102202)|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - some stream (GBK issue #101856)|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - encoding, utf16be|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - empty file|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…agentHostTelemetryReporter.test|title=AgentHostTelemetryReporter toolCallDetails emits toolCallDetailsExternal + toolCallDetailsInternal aggregate whenever tools were available, and no-ops when none were|occurrence=1 · 0 introduced LOCagentHostTelemetryReport…encoding.ts ×1 · 4 introduced LOCencoding.ts ×1amdX.ts ×1 · 2 introduced LOCamdX.ts ×1testLineToken.ts ×26 · 79 introduced LOCtestLineToken.ts ×26amdX.ts ×18 · 90 introduced LOCamdX.ts ×18sessionState.ts ×2 · 4 introduced LOCsessionState.ts ×2encoding.test|title=Encoding detectBOM ANSI|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…encoding.ts ×1 · 2 introduced LOCencoding.ts ×1encoding.ts ×1 · 2 introduced LOCencoding.ts ×1encoding.test|title=Encoding detectBOM UTF-16 BE|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…encoding.ts ×1 · 2 introduced LOCencoding.ts ×1encoding.test|title=Encoding detectBOM ANSI (2)|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…encoding.test|title=Encoding detectBOM does not return error for non existing file|occurrence=1 · 0 introduced LOCencoding.test|title=Enco…strings.ts ×1 · 2 introduced LOCstrings.ts ×1network.ts ×1 · 10 introduced LOCnetwork.ts ×1configurationRegistry.ts ×1 · 2 introduced LOCconfigurationRegistry.ts…network.test|title=network FileAccess: moduleId (native)|occurrence=1 · 0 introduced LOCnetwork.test|title=netwo…network.ts ×6 · 19 introduced LOCnetwork.ts ×6network.test|title=network FileAccess: web|occurrence=1 · 0 introduced LOCnetwork.test|title=netwo…network.test|title=network FileAccess: query and fragment is kept if URI is already of same scheme (native)|occurrence=1 · 0 introduced LOCnetwork.test|title=netwo…network.test|title=network FileAccess: query and fragment is dropped (native)|occurrence=1 · 0 introduced LOCnetwork.test|title=netwo…network.ts ×1 · 2 introduced LOCnetwork.ts ×1network.ts ×1 · 3 introduced LOCnetwork.ts ×1amdX.ts ×8 · 59 introduced LOCamdX.ts ×8network.ts ×1 · 3 introduced LOCnetwork.ts ×1stream.ts ×1 · 8 introduced LOCstream.ts ×1stream.ts ×1 · 2 introduced LOCstream.ts ×1network.ts ×3 · 10 introduced LOCnetwork.ts ×3stream.ts ×2 · 6 introduced LOCstream.ts ×2stream.ts ×2 · 7 introduced LOCstream.ts ×2network.ts ×2 · 14 introduced LOCnetwork.ts ×2network.ts ×1 · 2 introduced LOCnetwork.ts ×1network.ts ×1 · 5 introduced LOCnetwork.ts ×1network.ts ×2 · 3 introduced LOCnetwork.ts ×2network.ts ×3 · 5 introduced LOCnetwork.ts ×3resources.ts ×23 · 253 introduced LOCresources.ts ×23ps.ts ×2 · 15 introduced LOCps.ts ×2network.ts ×20 · 292 introduced LOCnetwork.ts ×20network.test|title=network FileAccess: URI (native)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/network.test|title=network FileAccess: URI (native)|occurrence=1network.test|title=netwo…network.test|title=network FileAccess: moduleId (native)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/network.test|title=network FileAccess: moduleId (native)|occurrence=1network.test|title=netwo…network.test|title=network FileAccess: query and fragment is dropped (native)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/network.test|title=network FileAccess: query and fragment is dropped (native)|occurrence=1network.test|title=netwo…network.test|title=network FileAccess: query and fragment is kept if URI is already of same scheme (native)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/network.test|title=network FileAccess: query and fragment is kept if URI is already of same scheme (native)|occurrence=1network.test|title=netwo…network.test|title=network FileAccess: remote URIs|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/network.test|title=network FileAccess: remote URIs|occurrence=1network.test|title=netwo…network.test|title=network FileAccess: web|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/network.test|title=network FileAccess: web|occurrence=1network.test|title=netwo…pfs.test|title=PFS copy, rename and delete|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/pfs/pfs.test|title=PFS copy, rename and delete|occurrence=1pfs.test|title=PFS copy,…pfs.test|title=PFS rename without retry|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/pfs/pfs.test|title=PFS rename without retry|occurrence=1pfs.test|title=PFS renam…ps.test|title=Process Utils JS file regex should match .js at end of command|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should match .js at end of command|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should match .js but not .json in same command|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should match .js but not .json in same command|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should match .js files with hyphens|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should match .js files with hyphens|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should match multiple .js files|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should match multiple .js files|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should match simple .js files|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should match simple .js files|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should not match .js prefix in .json extension (regression test for \b fix)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should not match .js prefix in .json extension (regression test for \b fix)|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should not match .json files|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should not match .json files|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should not match .jsx files|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should not match .jsx files|occurrence=1ps.test|title=Process Ut…ps.test|title=Process Utils JS file regex should not match partial matches inside other extensions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/ps.test|title=Process Utils JS file regex should not match partial matches inside other extensions|occurrence=1ps.test|title=Process Ut…zip.test|title=Zip extract should handle directories|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/zip/zip.test|title=Zip extract should handle directories|occurrence=1zip.test|title=Zip extra…textModel.test|title=Editor Model - TextModel getLineFirstNonWhitespaceColumn|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/common/model/textModel.test|title=Editor Model - TextModel getLineFirstNonWhitespaceColumn|occurrence=1textModel.test|title=Edi…textModelWithTokens.test|title=TextModelWithTokens brackets1|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/common/model/textModelWithTokens.test|title=TextModelWithTokens brackets1|occurrence=1textModelWithTokens.test…textModelWithTokens.test|title=TextModelWithTokens regression tests issue #63822: Wrong embedded language detected for empty lines|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/common/model/textModelWithTokens.test|title=TextModelWithTokens regression tests issue #63822: Wrong embedded language detected for empty lines|occurrence=1textModelWithTokens.test…viewLineRenderer.test|title=renderViewLine2 ws-trail-only|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/common/viewLayout/viewLineRenderer.test|title=renderViewLine2 ws-trail-only|occurrence=1viewLineRenderer.test|ti…fixtures.test|title=diffing fixtures equals-legacy|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/editor/test/node/diffing/fixtures.test|title=diffing fixtures equals-legacy|occurrence=1fixtures.test|title=diff…agentHostTelemetryReporter.test|title=AgentHostTelemetryReporter toolCallDetails emits toolCallDetailsExternal + toolCallDetailsInternal aggregate whenever tools were available, and no-ops when none were|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostTelemetryReporter.test|title=AgentHostTelemetryReporter toolCallDetails emits toolCallDetailsExternal + toolCallDetailsInternal aggregate whenever tools were available, and no-ops when none were|occurrence=1agentHostTelemetryReport…checksumService.test|title=Checksum Service checksum|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/checksum/test/node/checksumService.test|title=Checksum Service checksum|occurrence=1checksumService.test|tit…configurationModels.test|title=ConfigurationModelParser - Excluded Properties should handle scope filtering with excluded properties|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/configuration/test/common/configurationModels.test|title=ConfigurationModelParser - Excluded Properties should handle scope filtering with excluded properties|occurrence=1configurationModels.test…extensionsScannerService.test|title=NativeExtensionsScanerService Test scan system extensions include additional builtin extensions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/node/extensionsScannerService.test|title=NativeExtensionsScanerService Test scan system extensions include additional builtin extensions|occurrence=1extensionsScannerService…mcpStdioStateHandler.test|title=McpStdioStateHandler sigkill after grace|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/mcp/test/node/mcpStdioStateHandler.test|title=McpStdioStateHandler sigkill after grace|occurrence=1mcpStdioStateHandler.tes…mcpStdioStateHandler.test|title=McpStdioStateHandler sigterm after grace|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/mcp/test/node/mcpStdioStateHandler.test|title=McpStdioStateHandler sigterm after grace|occurrence=1mcpStdioStateHandler.tes…mcpStdioStateHandler.test|title=McpStdioStateHandler stdin ends process|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/mcp/test/node/mcpStdioStateHandler.test|title=McpStdioStateHandler stdin ends process|occurrence=1mcpStdioStateHandler.tes…encoding.test|title=Encoding detectBOM ANSI (2)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding detectBOM ANSI (2)|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding detectBOM ANSI|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding detectBOM ANSI|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding detectBOM UTF-16 BE|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding detectBOM UTF-16 BE|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding detectBOM UTF-16 LE|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding detectBOM UTF-16 LE|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding detectBOM UTF-8|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding detectBOM UTF-8|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding detectBOM does not return error for non existing file|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding detectBOM does not return error for non existing file|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - empty file|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding toDecodeStream - empty file|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - encoding, utf16be|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding toDecodeStream - encoding, utf16be|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - some stream (GBK issue #101856)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding toDecodeStream - some stream (GBK issue #101856)|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding toDecodeStream - some stream (UTF-8 issue #102202)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding toDecodeStream - some stream (UTF-8 issue #102202)|occurrence=1encoding.test|title=Enco…encoding.test|title=Encoding toEncodeReadable - encoding, utf16be|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/textfile/test/node/encoding/encoding.test|title=Encoding toEncodeReadable - encoding, utf16be|occurrence=1encoding.test|title=Enco…tokenStyleResolving.test|title=Themes - TokenStyleResolving color defaults|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving color defaults|occurrence=1tokenStyleResolving.test…Focused file · src/vs/base/common/network.ts · 440 LOCcommon/network.ts

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 > /*--------------------------------------------------------------------------------------------- network.ts ×20
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 * as errors from './errors.js';
7 > import * as platform from './platform.js';
8 > import { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';
9 > import { URI } from './uri.js';
10 > import * as paths from './path.js';
11 >
12 > export namespace Schemas {
13 >
14 > /**
15 > * A schema that is used for models that exist in memory
16 > * only and that have no correspondence on a server or such.
17 > */
18 > export const inMemory = 'inmemory';
19 >
20 > /**
21 > * A schema that is used for setting files
22 > */
23 > export const vscode = 'vscode';
24 >
25 > /**
26 > * A schema that is used for internal private files
27 > */
28 > export const internal = 'private';
29 >
30 > /**
31 > * A walk-through document.
32 > */
33 > export const walkThrough = 'walkThrough';
34 >
35 > /**
36 > * An embedded code snippet.
37 > */
38 > export const walkThroughSnippet = 'walkThroughSnippet';
39 >
40 > export const http = 'http';
41 >
42 > export const https = 'https';
43 >
44 > export const file = 'file';
45 >
46 > export const mailto = 'mailto';
47 >
48 > export const untitled = 'untitled';
49 >
50 > export const data = 'data';
51 >
52 > export const command = 'command';
53 >
54 > export const vscodeRemote = 'vscode-remote';
55 >
56 > export const vscodeRemoteResource = 'vscode-remote-resource';
57 >
58 > export const vscodeManagedRemoteResource = 'vscode-managed-remote-resource';
59 >
60 > export const vscodeUserData = 'vscode-userdata';
61 >
62 > export const vscodeCustomEditor = 'vscode-custom-editor';
63 >
64 > export const vscodeNotebookCell = 'vscode-notebook-cell';
65 > export const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';
66 > export const vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff';
67 > export const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';
68 > export const vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff';
69 > export const vscodeNotebookMetadata = 'vscode-notebook-metadata';
70 > export const vscodeInteractiveInput = 'vscode-interactive-input';
71 >
72 > export const vscodeSettings = 'vscode-settings';
73 >
74 > export const vscodeWorkspaceTrust = 'vscode-workspace-trust';
75 >
76 > export const vscodeTerminal = 'vscode-terminal';
77 >
78 > /** Scheme used for the image carousel editor. */
79 > export const vscodeImageCarousel = 'vscode-image-carousel';
80 >
81 > /** Scheme used for code blocks in chat. */
82 > export const vscodeChatCodeBlock = 'vscode-chat-code-block';
83 >
84 > /** Scheme used for LHS of code compare (aka diff) blocks in chat. */
85 > export const vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block';
86 >
87 > /** Scheme used for the chat input editor. */
88 > export const vscodeChatEditor = 'vscode-chat-editor';
89 >
90 > /** Scheme used for the chat input part */
91 > export const vscodeChatInput = 'chatSessionInput';
92 >
93 > /** Scheme used for local chat session content */
94 > export const vscodeLocalChatSession = 'vscode-chat-session';
95 >
96 > /**
97 > * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)
98 > */
99 > export const webviewPanel = 'webview-panel';
100 >
101 > /**
102 > * Scheme used for loading the wrapper html and script in webviews.
103 > */
104 > export const vscodeWebview = 'vscode-webview';
105 >
106 > /**
107 > * Scheme used for integrated browser tabs using WebContentsView.
108 > */
109 > export const vscodeBrowser = 'vscode-browser';
110 >
111 > /**
112 > * Scheme used for extension pages
113 > */
114 > export const extension = 'extension';
115 >
116 > /**
117 > * Scheme used as a replacement of `file` scheme to load
118 > * files with our custom protocol handler (desktop only).
119 > */
120 > export const vscodeFileResource = 'vscode-file';
121 >
122 > /**
123 > * Scheme used for temporary resources
124 > */
125 > export const tmp = 'tmp';
126 >
127 > /**
128 > * Scheme used vs live share
129 > */
130 > export const vsls = 'vsls';
131 >
132 > /**
133 > * Scheme used for the Source Control commit input's text document
134 > */
135 > export const vscodeSourceControl = 'vscode-scm';
136 >
137 > /**
138 > * Scheme used for input box for creating comments.
139 > */
140 > export const commentsInput = 'comment';
141 >
142 > /**
143 > * Scheme used for special rendering of settings in the release notes
144 > */
145 > export const codeSetting = 'code-setting';
146 >
147 > /**
148 > * Scheme used for output panel resources
149 > */
150 > export const outputChannel = 'output';
151 >
152 > /**
153 > * Scheme used for the accessible view
154 > */
155 > export const accessibleView = 'accessible-view';
156 >
157 > /**
158 > * Used for snapshots of chat edits
159 > */
160 > export const chatEditingSnapshotScheme = 'chat-editing-snapshot-text-model';
161 > export const chatEditingModel = 'chat-editing-text-model';
162 >
163 > /**
164 > * Used for rendering multidiffs in copilot agent sessions
165 > */
166 > export const copilotPr = 'copilot-pr';
167 > }
168 >
169 > export function matchesScheme(target: URI | string, scheme: string): boolean {
170 if (URI.isUri(target)) {
171 return equalsIgnoreCase(target.scheme, scheme);
172 } else {
173 return startsWithIgnoreCase(target, scheme + ':');
174 }
175 }
177 > export function matchesSomeScheme(target: URI | string, ...schemes: string[]): boolean {
178 return schemes.some(scheme => matchesScheme(target, scheme));
179 }
181 > export const connectionTokenCookieName = 'vscode-tkn';
182 > export const connectionTokenQueryName = 'tkn';
183 >
184 > class RemoteAuthoritiesImpl {
185 > private readonly _hosts: { [authority: string]: string | undefined } = Object.create(null);
186 > private readonly _ports: { [authority: string]: number | undefined } = Object.create(null);
187 > private readonly _connectionTokens: { [authority: string]: string | undefined } = Object.create(null);
188 > private _preferredWebSchema: 'http' | 'https' = 'http';
189 > private _delegate: ((uri: URI) => URI) | null = null;
190 > private _serverRootPath: string = '/';
191 >
192 > setPreferredWebSchema(schema: 'http' | 'https') {
193 this._preferredWebSchema = schema;
194 }
196 > setDelegate(delegate: (uri: URI) => URI): void {
197 this._delegate = delegate;
198 }
200 > setServerRootPath(product: { quality?: string; commit?: string }, serverBasePath: string | undefined): void {
201 this._serverRootPath = paths.posix.join(serverBasePath ?? '/', getServerProductSegment(product));
202 }
204 > getServerRootPath(): string {
205 return this._serverRootPath;
206 }
208 > private get _remoteResourcesPath(): string {
209 > return paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource); network.ts ×6
210 > }
212 > set(authority: string, host: string, port: number): void {
213 this._hosts[authority] = host;
214 this._ports[authority] = port;
215 }
217 > setConnectionToken(authority: string, connectionToken: string): void {
218 this._connectionTokens[authority] = connectionToken;
219 }
221 > getPreferredWebSchema(): 'http' | 'https' {
222 return this._preferredWebSchema;
223 }
225 > rewrite(uri: URI): URI {
226 > if (this._delegate) { network.ts ×6
227 try {
228 return this._delegate(uri);
229 } catch (err) {
230 errors.onUnexpectedExternalError(err);
231 return uri;
232 }
233 }
234 > const authority = uri.authority; network.ts ×6
235 > let host = this._hosts[authority];
236 > if (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {
237 host = `[${host}]`;
238 }
239 > const port = this._ports[authority]; network.ts ×6
240 > const connectionToken = this._connectionTokens[authority];
241 > let query = `path=${encodeURIComponent(uri.path)}`;
242 > if (typeof connectionToken === 'string') {
243 query += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;
244 }
245 > return URI.from({ network.ts ×6
246 > scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
247 > authority: `${host}:${port}`,
248 > path: this._remoteResourcesPath,
249 > query
250 > });
251 > }
252 > } network.ts ×20
253 >
254 > export const RemoteAuthorities = new RemoteAuthoritiesImpl();
255 >
256 > export function getServerProductSegment(product: { quality?: string; commit?: string }) {
257 return `${product.quality ?? 'oss'}-${product.commit ?? 'dev'}`;
258 }
260 > /**
261 > * A string pointing to a path inside the app. It should not begin with ./ or ../
262 > */
263 > export type AppResourcePath = (
264 > `a${string}` | `b${string}` | `c${string}` | `d${string}` | `e${string}` | `f${string}`
265 > | `g${string}` | `h${string}` | `i${string}` | `j${string}` | `k${string}` | `l${string}`
266 > | `m${string}` | `n${string}` | `o${string}` | `p${string}` | `q${string}` | `r${string}`
267 > | `s${string}` | `t${string}` | `u${string}` | `v${string}` | `w${string}` | `x${string}`
268 > | `y${string}` | `z${string}`
269 > );
270 >
271 > export const builtinExtensionsPath: AppResourcePath = 'vs/../../extensions';
272 > export const nodeModulesPath: AppResourcePath = 'vs/../../node_modules';
273 > export const nodeModulesAsarPath: AppResourcePath = 'vs/../../node_modules.asar';
274 > export const nodeModulesAsarUnpackedPath: AppResourcePath = 'vs/../../node_modules.asar.unpacked';
275 >
276 > export const VSCODE_AUTHORITY = 'vscode-app';
277 >
278 > class FileAccessImpl {
279 >
280 > private static readonly FALLBACK_AUTHORITY = VSCODE_AUTHORITY;
281 >
282 > /**
283 > * Returns a URI to use in contexts where the browser is responsible
284 > * for loading (e.g. fetch()) or when used within the DOM.
285 > *
286 > * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.
287 > */
288 > asBrowserUri(resourcePath: AppResourcePath | ''): URI {
289 > const uri = this.toUri(resourcePath); network.ts ×1
290 > return this.uriToBrowserUri(uri);
291 > }
293 > /**
294 > * Returns a URI to use in contexts where the browser is responsible
295 > * for loading (e.g. fetch()) or when used within the DOM.
296 > *
297 > * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.
298 > */
299 > uriToBrowserUri(uri: URI): URI {
300 > // Handle remote URIs via `RemoteAuthorities` network.ts ×3
301 > if (uri.scheme === Schemas.vscodeRemote) {
302 > return RemoteAuthorities.rewrite(uri); network.ts ×6
303 > }
305 > // Convert to `vscode-file` resource..
306 > if (
307 > // ...only ever for `file` resources
308 > uri.scheme === Schemas.file &&
309 > ( network.ts ×2
310 > // ...and we run in native environments
311 > platform.isNative ||
312 // ...or web worker extensions on desktop
313 (platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`)
314 > ) network.ts ×3
315 > ) {
316 > return uri.with({ network.ts ×2
317 > scheme: Schemas.vscodeFileResource,
318 > // We need to provide an authority here so that it can serve
319 > // as origin for network and loading matters in chromium.
320 > // If the URI is not coming with an authority already, we
321 > // add our own
322 > authority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,
323 > query: null,
324 > fragment: null
325 > });
326 > }
328 > return uri;
329 > } network.ts ×3
331 > /**
332 > * Returns the `file` URI to use in contexts where node.js
333 > * is responsible for loading.
334 > */
335 > asFileUri(resourcePath: AppResourcePath | ''): URI {
336 > const uri = this.toUri(resourcePath); network.ts ×1
337 > return this.uriToFileUri(uri);
338 > }
340 > /**
341 > * Returns the `file` URI to use in contexts where node.js
342 > * is responsible for loading.
343 > */
344 > uriToFileUri(uri: URI): URI {
345 > // Only convert the URI if it is `vscode-file:` scheme network.ts ×2
346 > if (uri.scheme === Schemas.vscodeFileResource) {
347 > return uri.with({ network.ts ×1
348 > scheme: Schemas.file,
349 > // Only preserve the `authority` if it is different from
350 > // our fallback authority. This ensures we properly preserve
351 > // Windows UNC paths that come with their own authority.
352 > authority: uri.authority !== FileAccessImpl.FALLBACK_AUTHORITY ? uri.authority : null,
353 > query: null,
354 > fragment: null
355 > });
356 > }
358 > return uri;
359 > } network.ts ×2
361 > private toUri(uriOrModule: URI | string): URI {
362 > if (URI.isUri(uriOrModule)) { network.ts ×3
363 return uriOrModule;
364 }
366 > if (globalThis._VSCODE_FILE_ROOT) {
367 > const rootUriOrPath = globalThis._VSCODE_FILE_ROOT;
368 >
369 > // File URL (with scheme)
370 > if (/^\w[\w\d+.-]*:\/\//.test(rootUriOrPath)) {
371 > return URI.joinPath(URI.parse(rootUriOrPath, true), uriOrModule);
372 > }
373
374 // File Path (no scheme)
375 const modulePath = paths.join(rootUriOrPath, uriOrModule);
376 return URI.file(modulePath);
377 }
378
379 throw new Error('Cannot determine URI for module id!');
380 > } network.ts ×3
381 > } network.ts ×20
382 >
383 > export const FileAccess = new FileAccessImpl();
384 >
385 > export const CacheControlheaders: Record<string, string> = Object.freeze({
386 > 'Cache-Control': 'no-cache, no-store'
387 > });
388 >
389 > export const DocumentPolicyheaders: Record<string, string> = Object.freeze({
390 > 'Document-Policy': 'include-js-call-stacks-in-crash-reports'
391 > });
392 >
393 > export namespace COI {
394 >
395 > const coiHeaders = new Map<'3' | '2' | '1' | string, Record<string, string>>([
396 > ['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],
397 > ['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],
398 > ['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],
399 > ]);
400 >
401 > export const CoopAndCoep = Object.freeze(coiHeaders.get('3'));
402 >
403 > const coiSearchParamName = 'vscode-coi';
404 >
405 > /**
406 > * Extract desired headers from `vscode-coi` invocation
407 > */
408 > export function getHeadersFromQuery(url: string | URI | URL): Record<string, string> | undefined {
409 let params: URLSearchParams | undefined;
410 if (typeof url === 'string') {
411 params = new URL(url).searchParams;
412 } else if (url instanceof URL) {
413 params = url.searchParams;
414 } else if (URI.isUri(url)) {
415 params = new URL(url.toString(true)).searchParams;
416 }
417 const value = params?.get(coiSearchParamName);
418 if (!value) {
419 return undefined;
420 }
421 return coiHeaders.get(value);
422 }
424 > /**
425 > * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`
426 > * isn't enabled the current context
427 > */
428 > export function addSearchParam(urlOrSearch: URLSearchParams | Record<string, string>, coop: boolean, coep: boolean): void {
429 if (!(globalThis as typeof globalThis & { crossOriginIsolated?: boolean }).crossOriginIsolated) {
430 // depends on the current context being COI
431 return;
432 }
433 const value = coop && coep ? '3' : coep ? '2' : '1';
434 if (urlOrSearch instanceof URLSearchParams) {
435 urlOrSearch.set(coiSearchParamName, value);
436 } else {
437 urlOrSearch[coiSearchParamName] = value;
438 }
439 }
440 > } network.ts ×20