Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.125.0
- OS Version: Windows 11 x64
- Remote: SSH
- Remote OS: Ubuntu 24.04 x64
- Extension Host: remote (VS Code Server)
Description
An extension can be activated through an implicit onLanguage:<languageId> event while VS Code is restoring the previously opened editor after Developer: Reload Window.
At that moment:
vscode.workspace.workspaceFolders is already populated and contains the correct workspace folder;
vscode.workspace.getConfiguration(...).get(...) returns the default value instead of the value from .vscode/settings.json;
vscode.workspace.getConfiguration(...).inspect(...) reports the workspace value as undefined;
- the workspace configuration becomes available only later, after activation has already completed.
The same problem does not occur when the extension is activated later through onStartupFinished. In that case, the value from .vscode/settings.json is already available when activate() is called.
Steps to Reproduce:
Reproduced in an Extension Development Host launched with --disable-extensions. The only active extension required for reproduction is the minimal development extension itself.
- Create a
package.json file, specify the new language, and set activationEvents to onStartupFinished.
{
"name": "vscode-config-repro",
"displayName": "VS Code Configuration Repro",
"description": "Minimal repro for workspace configuration loading",
"version": "0.0.1",
"engines": {
"vscode": "^1.100.0"
},
"main": "./extension.js",
"activationEvents": [
"onStartupFinished"
],
"contributes": {
"languages": [
{
"id": "reprolang",
"aliases": ["Repro Language"],
"extensions": [".repro"],
"configuration": "./language-configuration.json"
}
],
"configuration": {
"title": "Configuration Repro",
"properties": {
"configRepro.testPath": {
"type": "string",
"default": "",
"scope": "window"
}
}
}
}
}
- Create an empty language-configuration.json.
- Create the extension.js file:
const vscode = require("vscode");
function dumpConfiguration(label) {
const configuration =
vscode.workspace.getConfiguration("configRepro");
console.log(`\n========== ${label} ==========`);
console.log("time:", new Date().toISOString());
console.log(
"workspaceFolders:",
vscode.workspace.workspaceFolders?.map(
folder => folder.uri.fsPath
)
);
console.log(
"activeTextEditor:",
vscode.window.activeTextEditor?.document.uri.fsPath
);
console.log(
"testPath:",
configuration.get("testPath")
);
console.log(
"inspect:",
configuration.inspect("testPath")
);
console.log("==============================\n");
}
function activate(context) {
dumpConfiguration("ACTIVATE");
setTimeout(() => {
dumpConfiguration("AFTER 0 MS");
}, 0);
setTimeout(() => {
dumpConfiguration("AFTER 100 MS");
}, 100);
setTimeout(() => {
dumpConfiguration("AFTER 500 MS");
}, 500);
setTimeout(() => {
dumpConfiguration("AFTER 1000 MS");
}, 1000);
context.subscriptions.push(
vscode.window.onDidChangeActiveTextEditor(() => {
dumpConfiguration("ACTIVE EDITOR CHANGED");
})
);
context.subscriptions.push(
vscode.workspace.onDidChangeConfiguration(() => {
dumpConfiguration("CONFIGURATION CHANGED");
})
);
}
function deactivate() {}
module.exports = {
activate,
deactivate
};
- The workspace configuration where we will test the extension:
.vscode/settings.json
{
"configRepro.testPath": "/THIS/IS/WORKSPACE/VALUE"
}
- Run Extension
- Open the .c file and run Developer: Reload Window.
- In OUTPUT - Extension Host the line was displayed:
[info] ExtensionService#_doActivateExtension undefined_publisher.vscode-config-repro, startup: false, activationEvent: 'onStartupFinished'
- The "Debug Console" logs show that testPath is initialized immediately:
========== ACTIVATE ==========
time: 2026-10-01T12:03:35.256Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: /home/anastasiia/projects/test/main.c
testPath: /THIS/IS/WORKSPACE/VALUE
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== AFTER 0 MS ==========
time: 2026-10-01T12:03:35.383Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: /home/anastasiia/projects/test/main.c
testPath: /THIS/IS/WORKSPACE/VALUE
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
- Open the .repro file and run Developer: Reload Window.
- In OUTPUT - Extension Host the line was displayed:
[info] ExtensionService#_doActivateExtension undefined_publisher.vscode-config-repro, startup: false, activationEvent: 'onLanguage:reprolang'
- The
Debug Console shows that testPath is unavailable during activation and remains unavailable even after the active editor has been restored. It becomes available only on a subsequent onDidChangeConfiguration event:
========== ACTIVATE ==========
time: 2026-10-01T12:09:17.690Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: undefined
testPath:
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== AFTER 0 MS ==========
time: 2026-10-01T12:09:17.754Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: undefined
testPath:
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== AFTER 100 MS ==========
time: 2026-10-01T12:09:17.793Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: undefined
testPath:
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== CONFIGURATION CHANGED ==========
time: 2026-10-01T12:09:17.874Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: undefined
testPath:
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== ACTIVE EDITOR CHANGED ==========
time: 2026-10-01T12:09:18.139Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: /home/anastasiia/projects/test/test.repro
testPath:
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== CONFIGURATION CHANGED ==========
time: 2026-10-01T12:09:18.144Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: /home/anastasiia/projects/test/test.repro
testPath: /THIS/IS/WORKSPACE/VALUE
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
==============================
========== AFTER 500 MS ==========
time: 2026-10-01T12:09:18.193Z
workspaceFolders: (1) ['/home/anastasiia/projects/test']
activeTextEditor: /home/anastasiia/projects/test/test.repro
testPath: /THIS/IS/WORKSPACE/VALUE
inspect: {key: 'configRepro.testPath', defaultValue: '', globalLocalValue: undefined, globalRemoteValue: undefined, globalValue: undefined, …}
Expected Behavior
Workspace configuration from .vscode/settings.json should be available when the extension's activate() function is invoked, regardless of whether activation is triggered by onLanguage:repro or onStartupFinished.
Alternatively, if workspace configuration is not guaranteed to be fully initialized at that point, the Extension API should provide a documented way to determine when the initial workspace configuration has finished loading.
Does this issue occur when all extensions are disabled?: Yes
Description
An extension can be activated through an implicit
onLanguage:<languageId>event while VS Code is restoring the previously opened editor after Developer: Reload Window.At that moment:
vscode.workspace.workspaceFoldersis already populated and contains the correct workspace folder;vscode.workspace.getConfiguration(...).get(...)returns the default value instead of the value from.vscode/settings.json;vscode.workspace.getConfiguration(...).inspect(...)reports the workspace value asundefined;The same problem does not occur when the extension is activated later through
onStartupFinished. In that case, the value from.vscode/settings.jsonis already available whenactivate()is called.Steps to Reproduce:
Reproduced in an Extension Development Host launched with --disable-extensions. The only active extension required for reproduction is the minimal development extension itself.
package.jsonfile, specify the new language, and setactivationEventstoonStartupFinished..vscode/settings.json[info] ExtensionService#_doActivateExtension undefined_publisher.vscode-config-repro, startup: false, activationEvent: 'onStartupFinished'[info] ExtensionService#_doActivateExtension undefined_publisher.vscode-config-repro, startup: false, activationEvent: 'onLanguage:reprolang'Debug Consoleshows thattestPathis unavailable during activation and remains unavailable even after the active editor has been restored. It becomes available only on a subsequentonDidChangeConfigurationevent:Expected Behavior
Workspace configuration from
.vscode/settings.jsonshould be available when the extension'sactivate()function is invoked, regardless of whether activation is triggered byonLanguage:reprooronStartupFinished.Alternatively, if workspace configuration is not guaranteed to be fully initialized at that point, the Extension API should provide a documented way to determine when the initial workspace configuration has finished loading.