Skip to content

Commit a11e611

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/adityavc/210870
2 parents 80ab7f5 + 648281e commit a11e611

File tree

58 files changed

+1544
-1118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1544
-1118
lines changed

.vscode/notebooks/api.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "$REPO=repo:microsoft/vscode\n$MILESTONE=milestone:\"June 2025\""
10+
"value": "$REPO=repo:microsoft/vscode\n$MILESTONE=milestone:\"July 2025\""
1111
},
1212
{
1313
"kind": 1,

.vscode/notebooks/endgame.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce\n\n$MILESTONE=milestone:\"June 2025\""
10+
"value": "$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce\n\n$MILESTONE=milestone:\"July 2025\""
1111
},
1212
{
1313
"kind": 1,

.vscode/notebooks/my-endgame.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce\n\n$MILESTONE=milestone:\"June 2025\"\n\n$MINE=assignee:@me"
10+
"value": "$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce\n\n$MILESTONE=milestone:\"July 2025\"\n\n$MINE=assignee:@me"
1111
},
1212
{
1313
"kind": 1,

extensions/terminal-suggest/src/terminalSuggestMain.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type ShellGlobalsCacheEntryWithMeta = ShellGlobalsCacheEntry & { timestamp: numb
4646
const cachedGlobals: Map<string, ShellGlobalsCacheEntryWithMeta> = new Map();
4747
let pathExecutableCache: PathExecutableCache;
4848
const CACHE_KEY = 'terminalSuggestGlobalsCacheV2';
49-
let globalStorage: vscode.Memento;
49+
let globalStorageUri: vscode.Uri;
5050
const CACHE_MAX_AGE_MS = 1000 * 60 * 60 * 24 * 7; // 7 days
5151

5252
function getCacheKey(machineId: string, remoteAuthority: string | undefined, shellType: TerminalShellType): string {
@@ -150,7 +150,7 @@ async function fetchAndCacheShellGlobals(
150150

151151

152152
async function writeGlobalsCache(): Promise<void> {
153-
if (!globalStorage) {
153+
if (!globalStorageUri) {
154154
return;
155155
}
156156
// Remove old entries
@@ -165,25 +165,40 @@ async function writeGlobalsCache(): Promise<void> {
165165
obj[key] = value;
166166
}
167167
try {
168-
await globalStorage.update(CACHE_KEY, obj);
168+
// Ensure the directory exists
169+
const terminalSuggestDir = vscode.Uri.joinPath(globalStorageUri, 'terminal-suggest');
170+
await vscode.workspace.fs.createDirectory(terminalSuggestDir);
171+
const cacheFile = vscode.Uri.joinPath(terminalSuggestDir, `${CACHE_KEY}.json`);
172+
const data = Buffer.from(JSON.stringify(obj), 'utf8');
173+
await vscode.workspace.fs.writeFile(cacheFile, data);
169174
} catch (err) {
170175
console.error('Failed to write terminal suggest globals cache:', err);
171176
}
172177
}
173178

174179

175180
async function readGlobalsCache(): Promise<void> {
176-
if (!globalStorage) {
181+
if (!globalStorageUri) {
177182
return;
178183
}
179184
try {
180-
const obj = globalStorage.get<Record<string, ShellGlobalsCacheEntryWithMeta>>(CACHE_KEY);
185+
const terminalSuggestDir = vscode.Uri.joinPath(globalStorageUri, 'terminal-suggest');
186+
const cacheFile = vscode.Uri.joinPath(terminalSuggestDir, `${CACHE_KEY}.json`);
187+
const data = await vscode.workspace.fs.readFile(cacheFile);
188+
const obj = JSON.parse(data.toString()) as Record<string, ShellGlobalsCacheEntryWithMeta>;
181189
if (obj) {
182190
for (const key of Object.keys(obj)) {
183191
cachedGlobals.set(key, obj[key]);
184192
}
185193
}
186-
} catch { }
194+
} catch (err) {
195+
// File might not exist yet, which is expected on first run
196+
if (err instanceof vscode.FileSystemError && err.code === 'FileNotFound') {
197+
// This is expected on first run
198+
return;
199+
}
200+
console.error('Failed to read terminal suggest globals cache:', err);
201+
}
187202
}
188203

189204

@@ -193,7 +208,7 @@ export async function activate(context: vscode.ExtensionContext) {
193208
context.subscriptions.push(pathExecutableCache);
194209
let currentTerminalEnv: ITerminalEnvironment = process.env;
195210

196-
globalStorage = context.globalState;
211+
globalStorageUri = context.globalStorageUri;
197212
await readGlobalsCache();
198213

199214
// Get a machineId for this install (persisted per machine, not synced)

src/vs/base/browser/dom.ts

Lines changed: 1 addition & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import { IMouseEvent, StandardMouseEvent } from './mouseEvent.js';
1010
import { AbstractIdleValue, IntervalTimer, TimeoutTimer, _runWhenIdle, IdleDeadline } from '../common/async.js';
1111
import { BugIndicatingError, onUnexpectedError } from '../common/errors.js';
1212
import * as event from '../common/event.js';
13-
import dompurify from './dompurify/dompurify.js';
1413
import { KeyCode } from '../common/keyCodes.js';
1514
import { Disposable, DisposableStore, IDisposable, toDisposable } from '../common/lifecycle.js';
16-
import { RemoteAuthorities, Schemas } from '../common/network.js';
15+
import { RemoteAuthorities } from '../common/network.js';
1716
import * as platform from '../common/platform.js';
1817
import { URI } from '../common/uri.js';
1918
import { hash } from '../common/hash.js';
@@ -1681,223 +1680,6 @@ export function detectFullscreen(targetWindow: Window): IDetectedFullscreen | nu
16811680
return null;
16821681
}
16831682

1684-
// -- sanitize and trusted html
1685-
1686-
/**
1687-
* Hooks dompurify using `afterSanitizeAttributes` to check that all `href` and `src`
1688-
* attributes are valid.
1689-
*/
1690-
export function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols: readonly string[], allowDataImages = false): IDisposable {
1691-
// https://github.com/cure53/DOMPurify/blob/main/demos/hooks-scheme-allowlist.html
1692-
1693-
// build an anchor to map URLs to
1694-
const anchor = document.createElement('a');
1695-
1696-
dompurify.addHook('afterSanitizeAttributes', (node) => {
1697-
// check all href/src attributes for validity
1698-
for (const attr of ['href', 'src']) {
1699-
if (node.hasAttribute(attr)) {
1700-
const attrValue = node.getAttribute(attr) as string;
1701-
if (attr === 'href' && attrValue.startsWith('#')) {
1702-
// Allow fragment links
1703-
continue;
1704-
}
1705-
1706-
anchor.href = attrValue;
1707-
if (!allowedProtocols.includes(anchor.protocol.replace(/:$/, ''))) {
1708-
if (allowDataImages && attr === 'src' && anchor.href.startsWith('data:')) {
1709-
continue;
1710-
}
1711-
1712-
node.removeAttribute(attr);
1713-
}
1714-
}
1715-
}
1716-
});
1717-
1718-
return toDisposable(() => {
1719-
dompurify.removeHook('afterSanitizeAttributes');
1720-
});
1721-
}
1722-
1723-
const defaultSafeProtocols = [
1724-
Schemas.http,
1725-
Schemas.https,
1726-
Schemas.command,
1727-
];
1728-
1729-
/**
1730-
* List of safe, non-input html tags.
1731-
*/
1732-
export const basicMarkupHtmlTags = Object.freeze([
1733-
'a',
1734-
'abbr',
1735-
'b',
1736-
'bdo',
1737-
'blockquote',
1738-
'br',
1739-
'caption',
1740-
'cite',
1741-
'code',
1742-
'col',
1743-
'colgroup',
1744-
'dd',
1745-
'del',
1746-
'details',
1747-
'dfn',
1748-
'div',
1749-
'dl',
1750-
'dt',
1751-
'em',
1752-
'figcaption',
1753-
'figure',
1754-
'h1',
1755-
'h2',
1756-
'h3',
1757-
'h4',
1758-
'h5',
1759-
'h6',
1760-
'hr',
1761-
'i',
1762-
'img',
1763-
'input',
1764-
'ins',
1765-
'kbd',
1766-
'label',
1767-
'li',
1768-
'mark',
1769-
'ol',
1770-
'p',
1771-
'pre',
1772-
'q',
1773-
'rp',
1774-
'rt',
1775-
'ruby',
1776-
'samp',
1777-
'small',
1778-
'small',
1779-
'source',
1780-
'span',
1781-
'strike',
1782-
'strong',
1783-
'sub',
1784-
'summary',
1785-
'sup',
1786-
'table',
1787-
'tbody',
1788-
'td',
1789-
'tfoot',
1790-
'th',
1791-
'thead',
1792-
'time',
1793-
'tr',
1794-
'tt',
1795-
'u',
1796-
'ul',
1797-
'var',
1798-
'video',
1799-
'wbr',
1800-
]);
1801-
1802-
export const trustedMathMlTags = Object.freeze([
1803-
'semantics',
1804-
'annotation',
1805-
'math',
1806-
'menclose',
1807-
'merror',
1808-
'mfenced',
1809-
'mfrac',
1810-
'mglyph',
1811-
'mi',
1812-
'mlabeledtr',
1813-
'mmultiscripts',
1814-
'mn',
1815-
'mo',
1816-
'mover',
1817-
'mpadded',
1818-
'mphantom',
1819-
'mroot',
1820-
'mrow',
1821-
'ms',
1822-
'mspace',
1823-
'msqrt',
1824-
'mstyle',
1825-
'msub',
1826-
'msup',
1827-
'msubsup',
1828-
'mtable',
1829-
'mtd',
1830-
'mtext',
1831-
'mtr',
1832-
'munder',
1833-
'munderover',
1834-
'mprescripts',
1835-
1836-
// svg tags
1837-
'svg',
1838-
'altglyph',
1839-
'altglyphdef',
1840-
'altglyphitem',
1841-
'circle',
1842-
'clippath',
1843-
'defs',
1844-
'desc',
1845-
'ellipse',
1846-
'filter',
1847-
'font',
1848-
'g',
1849-
'glyph',
1850-
'glyphref',
1851-
'hkern',
1852-
'line',
1853-
'lineargradient',
1854-
'marker',
1855-
'mask',
1856-
'metadata',
1857-
'mpath',
1858-
'path',
1859-
'pattern',
1860-
'polygon',
1861-
'polyline',
1862-
'radialgradient',
1863-
'rect',
1864-
'stop',
1865-
'style',
1866-
'switch',
1867-
'symbol',
1868-
'text',
1869-
'textpath',
1870-
'title',
1871-
'tref',
1872-
'tspan',
1873-
'view',
1874-
'vkern',
1875-
]);
1876-
1877-
1878-
export const defaultAllowedAttrs = Object.freeze(['href', 'data-href', 'data-command', 'target', 'title', 'name', 'src', 'alt', 'class', 'id', 'role', 'tabindex', 'style', 'data-code', 'width', 'height', 'align', 'x-dispatch', 'required', 'checked', 'placeholder', 'type', 'start']);
1879-
1880-
const defaultDomPurifyConfig = Object.freeze<dompurify.Config & { RETURN_TRUSTED_TYPE: true }>({
1881-
ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'],
1882-
ALLOWED_ATTR: [...defaultAllowedAttrs],
1883-
RETURN_DOM: false,
1884-
RETURN_DOM_FRAGMENT: false,
1885-
RETURN_TRUSTED_TYPE: true
1886-
});
1887-
1888-
/**
1889-
* Sanitizes the given `value` and reset the given `node` with it.
1890-
*/
1891-
export function safeInnerHtml(node: HTMLElement, value: string, extraDomPurifyConfig?: dompurify.Config): void {
1892-
const hook = hookDomPurifyHrefAndSrcSanitizer(defaultSafeProtocols);
1893-
try {
1894-
const html = dompurify.sanitize(value, { ...defaultDomPurifyConfig, ...extraDomPurifyConfig });
1895-
node.innerHTML = html as unknown as string;
1896-
} finally {
1897-
hook.dispose();
1898-
}
1899-
}
1900-
19011683
type ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';
19021684

19031685
export interface IModifierKeyStatus {

0 commit comments

Comments
 (0)