Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions build/npm/postinstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ async function main() {
if (process.env['CXX']) { env['CXX'] = 'g++'; }
if (process.env['CXXFLAGS']) { env['CXXFLAGS'] = ''; }
if (process.env['LDFLAGS']) { env['LDFLAGS'] = ''; }
env['npm_config_jobs'] = 'max';
setNpmrcConfig('build', env);
return npmInstallAsync('build', { env });
});
Expand All @@ -285,6 +286,34 @@ async function main() {
if (process.env['VSCODE_REMOTE_CXXFLAGS']) { env['CXXFLAGS'] = process.env['VSCODE_REMOTE_CXXFLAGS']; }
if (process.env['VSCODE_REMOTE_LDFLAGS']) { env['LDFLAGS'] = process.env['VSCODE_REMOTE_LDFLAGS']; }
if (process.env['VSCODE_REMOTE_NODE_GYP']) { env['npm_config_node_gyp'] = process.env['VSCODE_REMOTE_NODE_GYP']; }
env['npm_config_jobs'] = 'max';
setNpmrcConfig('remote', env);
return npmInstallAsync(remoteDir, { env });
});
continue;
}

if (/^(.build\/distro\/npm\/)?remote$/.test(dir)) {
const remoteDir = dir;
nativeTasks.push(() => {
const env: NodeJS.ProcessEnv = { ...process.env };
if (process.env['VSCODE_REMOTE_CC']) {
env['CC'] = process.env['VSCODE_REMOTE_CC'];
} else {
delete env['CC'];
}
if (process.env['VSCODE_REMOTE_CXX']) {
env['CXX'] = process.env['VSCODE_REMOTE_CXX'];
} else {
delete env['CXX'];
}
if (process.env['CXXFLAGS']) { delete env['CXXFLAGS']; }
if (process.env['CFLAGS']) { delete env['CFLAGS']; }
if (process.env['LDFLAGS']) { delete env['LDFLAGS']; }
if (process.env['VSCODE_REMOTE_CXXFLAGS']) { env['CXXFLAGS'] = process.env['VSCODE_REMOTE_CXXFLAGS']; }
if (process.env['VSCODE_REMOTE_LDFLAGS']) { env['LDFLAGS'] = process.env['VSCODE_REMOTE_LDFLAGS']; }
if (process.env['VSCODE_REMOTE_NODE_GYP']) { env['npm_config_node_gyp'] = process.env['VSCODE_REMOTE_NODE_GYP']; }
env['npm_config_jobs'] = 'max';
setNpmrcConfig('remote', env);
return npmInstallAsync(remoteDir, { env });
});
Expand Down
22 changes: 21 additions & 1 deletion build/rspack/rspack.serve-out.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,34 @@ export default {
output: {
path: path.join(repoRoot, '.build', 'rspack-serve-out'),
filename: 'bundled/[name].js',
chunkFilename: 'bundled/[name].js',
chunkFilename: 'bundled/[name].[contenthash].js',
assetModuleFilename: 'bundled/assets/[name][ext][query]',
publicPath: '/',
clean: true,
},
experiments: {
css: true,
},
optimization: {
moduleIds: 'deterministic',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
priority: 10,
},
common: {
name: 'common',
minChunks: 2,
chunks: 'all',
priority: 5,
reuseExistingChunk: true,
},
},
},
},
module: {
rules: [
{
Expand Down
19 changes: 14 additions & 5 deletions build/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,31 @@ export default defineConfig({
}
}
},
root: '../..', // To support /out/... paths
root: '../..',
build: {
outDir: join(__dirname, 'dist'),
minify: 'esbuild',
sourcemap: true,
rollupOptions: {
input: {
//index: path.resolve(__dirname, 'index.html'),
workbench: path.resolve(__dirname, 'workbench-vite.html'),
}
}
},
output: {
manualChunks: {
vendor: ['vscode-textmate', 'vscode-oniguruma', 'katex'],
xterm: ['@xterm/xterm', '@xterm/addon-clipboard', '@xterm/addon-search'],
},
},
},
commonjsOptions: {
include: [/node_modules/],
},
},
server: {
cors: true,
port: 5199,
fs: {
allow: [
// To allow loading from sources, not needed when loading monaco-editor from npm package
join(import.meta.dirname, '../../../')
]
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"watch-copilotd": "deemon npm run watch-copilot",
"kill-watch-copilotd": "deemon --kill npm run watch-copilot",
"precommit": "node --experimental-strip-types build/hygiene.ts",
"gulp": "node --max-old-space-size=8192 ./node_modules/gulp/bin/gulp.js",
"gulp": "node --max-old-space-size=16384 ./node_modules/gulp/bin/gulp.js",
"electron": "node build/lib/electron.ts",
"7z": "7z",
"update-grammars": "node build/npm/update-all-grammars.ts",
Expand Down
1 change: 1 addition & 0 deletions src/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"incremental": true,
"module": "nodenext",
"moduleResolution": "nodenext",
"moduleDetection": "legacy",
Expand Down
2 changes: 2 additions & 0 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"incremental": true,
"tsBuildInfoFile": "../out/tsconfig.tsbuildinfo",
"esModuleInterop": true,
"removeComments": false,
"preserveConstEnums": true,
Expand Down
24 changes: 24 additions & 0 deletions src/vs/workbench/api/common/extHostChatContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export class ExtHostChatContext extends Disposable implements ExtHostChatContext
private _globalItems: Map<number, vscode.ChatContextItem> = new Map();
/** Track which items belong to which provider for cleanup */
private _providerItems: Map<number, Set<number>> = new Map(); // providerHandle -> Set<itemHandle>
/** Track insertion order for LRU eviction */
private _itemInsertionOrder: number[] = [];
/** Maximum number of global items to prevent unbounded growth */
private static readonly MAX_GLOBAL_ITEMS = 10000;

constructor(
@IExtHostRpcService extHostRpc: IExtHostRpcService,
Expand Down Expand Up @@ -252,21 +256,38 @@ export class ExtHostChatContext extends Disposable implements ExtHostChatContext
if (itemHandles) {
for (const itemHandle of itemHandles) {
this._globalItems.delete(itemHandle);
const idx = this._itemInsertionOrder.indexOf(itemHandle);
if (idx !== -1) {
this._itemInsertionOrder.splice(idx, 1);
}
}
itemHandles.clear();
}
}

private _addTrackedItem(providerHandle: number, item: vscode.ChatContextItem): number {
const itemHandle = this._itemPool++;
this._evictOldestIfNecessary();
this._globalItems.set(itemHandle, item);
this._itemInsertionOrder.push(itemHandle);
if (!this._providerItems.has(providerHandle)) {
this._providerItems.set(providerHandle, new Set());
}
this._providerItems.get(providerHandle)!.add(itemHandle);
return itemHandle;
}

private _evictOldestIfNecessary(): void {
if (this._globalItems.size < ExtHostChatContext.MAX_GLOBAL_ITEMS) {
return;
}
const itemsToEvict = Math.ceil(ExtHostChatContext.MAX_GLOBAL_ITEMS * 0.1);
for (let i = 0; i < itemsToEvict && this._itemInsertionOrder.length > 0; i++) {
const oldestHandle = this._itemInsertionOrder.shift()!;
this._globalItems.delete(oldestHandle);
}
}

private _convertItems(handle: number, items: vscode.ChatContextItem[]): IChatContextItem[] {
const result: IChatContextItem[] = [];
for (const item of items) {
Expand Down Expand Up @@ -330,5 +351,8 @@ export class ExtHostChatContext extends Disposable implements ExtHostChatContext
for (const { disposables } of this._providers.values()) {
disposables.dispose();
}
this._globalItems.clear();
this._itemInsertionOrder = [];
this._providerItems.clear();
}
}
9 changes: 9 additions & 0 deletions src/vs/workbench/api/common/extHostTerminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,15 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
processDiposable.dispose();
delete this._terminalProcessDisposables[id];
}

// Clean up terminal link cache and cancellation sources
this._terminalLinkCache.delete(id);
const cancellationSource = this._terminalLinkCancellationSource.get(id);
if (cancellationSource) {
cancellationSource.dispose(true);
this._terminalLinkCancellationSource.delete(id);
}

// Send exit event to main side
this._proxy.$sendProcessExit(id, exitCode);
}
Expand Down
24 changes: 8 additions & 16 deletions src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class CellInfoContentProvider {

static readonly ID = 'workbench.contrib.cellInfoContentProvider';

private readonly _disposables: IDisposable[] = [];
private readonly _disposables = this._register(new DisposableStore());

constructor(
@ITextModelService textModelService: ITextModelService,
Expand All @@ -442,23 +442,23 @@ class CellInfoContentProvider {
@ILabelService private readonly _labelService: ILabelService,
@INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService,
) {
this._disposables.push(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookCellMetadata, {
this._disposables.add(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookCellMetadata, {
provideTextContent: this.provideMetadataTextContent.bind(this)
}));

this._disposables.push(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookCellOutput, {
this._disposables.add(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookCellOutput, {
provideTextContent: this.provideOutputTextContent.bind(this)
}));

this._disposables.push(this._labelService.registerFormatter({
this._disposables.add(this._labelService.registerFormatter({
scheme: Schemas.vscodeNotebookCellMetadata,
formatting: {
label: '${path} (metadata)',
separator: '/'
}
}));

this._disposables.push(this._labelService.registerFormatter({
this._disposables.add(this._labelService.registerFormatter({
scheme: Schemas.vscodeNotebookCellOutput,
formatting: {
label: '${path} (output)',
Expand All @@ -467,10 +467,6 @@ class CellInfoContentProvider {
}));
}

dispose(): void {
dispose(this._disposables);
}

async provideMetadataTextContent(resource: URI): Promise<ITextModel | null> {
const existing = this._modelService.getModel(resource);
if (existing) {
Expand Down Expand Up @@ -654,7 +650,7 @@ class CellInfoContentProvider {
class NotebookMetadataContentProvider {
static readonly ID = 'workbench.contrib.notebookMetadataContentProvider';

private readonly _disposables: IDisposable[] = [];
private readonly _disposables = this._register(new DisposableStore());

constructor(
@ITextModelService textModelService: ITextModelService,
Expand All @@ -663,11 +659,11 @@ class NotebookMetadataContentProvider {
@ILabelService private readonly _labelService: ILabelService,
@INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService,
) {
this._disposables.push(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookMetadata, {
this._disposables.add(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookMetadata, {
provideTextContent: this.provideMetadataTextContent.bind(this)
}));

this._disposables.push(this._labelService.registerFormatter({
this._disposables.add(this._labelService.registerFormatter({
scheme: Schemas.vscodeNotebookMetadata,
formatting: {
label: '${path} (metadata)',
Expand All @@ -676,10 +672,6 @@ class NotebookMetadataContentProvider {
}));
}

dispose(): void {
dispose(this._disposables);
}

async provideMetadataTextContent(resource: URI): Promise<ITextModel | null> {
const existing = this._modelService.getModel(resource);
if (existing) {
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminalGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
override dispose(): void {
this._terminalInstances = [];
this._onInstancesChanged.fire();
for (const disposables of this._instanceDisposables.values()) {
dispose(disposables);
}
this._instanceDisposables.clear();
this._splitPaneContainer?.dispose();
super.dispose();
}
Expand Down
8 changes: 8 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ export class TerminalService extends Disposable implements ITerminalService {
timeout(0).then(() => this._register(this._instantiationService.createInstance(TerminalEditorStyle, mainWindow.document.head)));
}

override dispose(): void {
for (const disposables of this._backgroundedTerminalDisposables.values()) {
dispose(disposables);
}
this._backgroundedTerminalDisposables.clear();
super.dispose();
}

async showProfileQuickPick(type: 'setDefault' | 'createInstance', cwd?: string | URI): Promise<ITerminalInstance | undefined> {
const quickPick = this._instantiationService.createInstance(TerminalProfileQuickpick);
const result = await quickPick.showAndGetResult(type);
Expand Down