* All public methods on this class must be guarded by the "ready" promise. Requests and notifications received before the task is * complete are executed after this promise is resolved.
(workspaceFolder?: vscode.WorkspaceFolder)
| 1308 | */ |
| 1309 | |
| 1310 | constructor(workspaceFolder?: vscode.WorkspaceFolder) { |
| 1311 | if (workspaceFolder !== undefined) { |
| 1312 | this.lastCustomBrowseConfiguration = new PersistentFolderState<WorkspaceBrowseConfiguration | undefined>("CPP.lastCustomBrowseConfiguration", undefined, workspaceFolder); |
| 1313 | this.lastCustomBrowseConfigurationProviderId = new PersistentFolderState<string | undefined>("CPP.lastCustomBrowseConfigurationProviderId", undefined, workspaceFolder); |
| 1314 | this.lastCustomBrowseConfigurationProviderVersion = new PersistentFolderState<Version>("CPP.lastCustomBrowseConfigurationProviderVersion", Version.v5, workspaceFolder); |
| 1315 | this.registeredProviders = new PersistentFolderState<string[]>("CPP.registeredProviders", [], workspaceFolder); |
| 1316 | // If this provider did the register in the last session, clear out the cached browse config. |
| 1317 | if (!this.isProviderRegistered(this.lastCustomBrowseConfigurationProviderId.Value)) { |
| 1318 | this.lastCustomBrowseConfigurationProviderId.Value = undefined; |
| 1319 | if (this.lastCustomBrowseConfiguration !== undefined) { |
| 1320 | this.lastCustomBrowseConfiguration.Value = undefined; |
| 1321 | } |
| 1322 | } |
| 1323 | if (this.lastCustomBrowseConfigurationProviderId.Value) { |
| 1324 | this.configStateReceived.configProviders = []; // avoid waiting for the timeout if it's cached |
| 1325 | } |
| 1326 | this.registeredProviders.Value = []; |
| 1327 | } else { |
| 1328 | this.configStateReceived.configProviders = []; |
| 1329 | this.configStateReceived.compileCommands = true; |
| 1330 | } |
| 1331 | if (!semanticTokensLegend) { |
| 1332 | // Semantic token types are identified by indexes in this list of types, in the legend. |
| 1333 | const tokenTypesLegend: string[] = []; |
| 1334 | for (const e in SemanticTokenTypes) { |
| 1335 | // An enum is actually a set of mappings from key <=> value. Enumerate over only the names. |
| 1336 | // This allow us to represent the constants using an enum, which we can match in native code. |
| 1337 | if (isNaN(Number(e))) { |
| 1338 | tokenTypesLegend.push(e); |
| 1339 | } |
| 1340 | } |
| 1341 | // Semantic token modifiers are bit indexes corresponding to the indexes in this list of modifiers in the legend. |
| 1342 | const tokenModifiersLegend: string[] = []; |
| 1343 | for (const e in SemanticTokenModifiers) { |
| 1344 | if (isNaN(Number(e))) { |
| 1345 | tokenModifiersLegend.push(e); |
| 1346 | } |
| 1347 | } |
| 1348 | semanticTokensLegend = new vscode.SemanticTokensLegend(tokenTypesLegend, tokenModifiersLegend); |
| 1349 | } |
| 1350 | |
| 1351 | this.rootFolder = workspaceFolder; |
| 1352 | this.rootRealPath = this.RootPath ? util.checkDirectoryExistsSync(this.RootPath) ? fs.realpathSync(this.RootPath) : this.RootPath : ""; |
| 1353 | |
| 1354 | this.workspaceStoragePath = util.extensionContext?.storageUri?.fsPath ?? ""; |
| 1355 | if (this.workspaceStoragePath.length > 0) { |
| 1356 | workspaceHash = path.basename(path.dirname(this.workspaceStoragePath)); |
| 1357 | } else { |
| 1358 | this.workspaceStoragePath = this.RootPath ? path.join(this.RootPath, ".vscode") : ""; |
| 1359 | } |
| 1360 | |
| 1361 | if (workspaceFolder && vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 1) { |
| 1362 | this.workspaceStoragePath = path.join(this.workspaceStoragePath, util.getUniqueWorkspaceStorageName(workspaceFolder)); |
| 1363 | } |
| 1364 | |
| 1365 | const rootUri: vscode.Uri | undefined = this.RootUri; |
| 1366 | this.settingsTracker = new SettingsTracker(rootUri); |
| 1367 |
nothing calls this directly
no test coverage detected