Fix enableFullFeatureSet logic (#2070)

This commit is contained in:
Bob Brown 2021-08-24 12:59:12 -07:00 коммит произвёл GitHub
Родитель 649908f33d
Коммит b3c82766af
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -1119,6 +1119,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
await setContextValue(IS_CONFIGURING_KEY, false);
}
if (retc === 0) {
await enableFullFeatureSet(true);
await this._refreshCompileDatabase(drv.expansionOptions);
}

Просмотреть файл

@ -206,6 +206,10 @@ class ExtensionManager implements vscode.Disposable {
}
const isFullyActivated: boolean = await this.workspaceHasCMakeProject();
if (isFullyActivated) {
await enableFullFeatureSet(true);
}
const telemetryProperties: telemetry.Properties = {
isMultiRoot: `${isMultiRoot}`,
isFullyActivated: `${isFullyActivated}`
@ -497,11 +501,6 @@ class ExtensionManager implements vscode.Disposable {
const isCMake = await fs.exists(expandedSourceDirectory);
this._foldersAreCMake.set(cmt.folderName, isCMake);
// If we found a valid CMake project, set feature set view to full, otherwise leave the UI as it was.
if (isCMake) {
await enableFullFeatureSet(true);
}
return isCMake;
}
@ -1526,9 +1525,6 @@ async function setup(context: vscode.ExtensionContext, progress?: ProgressHandle
// Load a new extension manager
const ext = _EXT_MANAGER = await ExtensionManager.create(context);
// Start with a partial feature set view. The first valid CMake project will cause a switch to full feature set.
await enableFullFeatureSet(false);
// A register function that helps us bind the commands to the extension
function register<K extends keyof ExtensionManager>(name: K) {
return vscode.commands.registerCommand(`cmake.${name}`, (...args: any[]) => {
@ -1695,13 +1691,16 @@ class SchemaProvider implements vscode.TextDocumentContentProvider {
* @returns A promise that will resolve when the extension is ready for use
*/
export async function activate(context: vscode.ExtensionContext) {
// CMakeTools versions newer or equal to #1.2 should not coexist with older versions
// because the publisher changed (from vector-of-bool into ms-vscode),
// causing many undesired behaviors (duplicate operations, registrations for UI elements, etc...)
const oldCMakeToolsExtension = vscode.extensions.getExtension('vector-of-bool.cmake-tools');
if (oldCMakeToolsExtension) {
await vscode.window.showWarningMessage(localize('uninstall.old.cmaketools', 'Please uninstall any older versions of the CMake Tools extension. It is now published by Microsoft starting with version 1.2.0.'));
}
// CMakeTools versions newer or equal to #1.2 should not coexist with older versions
// because the publisher changed (from vector-of-bool into ms-vscode),
// causing many undesired behaviors (duplicate operations, registrations for UI elements, etc...)
const oldCMakeToolsExtension = vscode.extensions.getExtension('vector-of-bool.cmake-tools');
if (oldCMakeToolsExtension) {
await vscode.window.showWarningMessage(localize('uninstall.old.cmaketools', 'Please uninstall any older versions of the CMake Tools extension. It is now published by Microsoft starting with version 1.2.0.'));
}
// Start with a partial feature set view. The first valid CMake project will cause a switch to full feature set.
await enableFullFeatureSet(false);
// Register a protocol handler to serve localized schemas
vscode.workspace.registerTextDocumentContentProvider('cmake-tools-schema', new SchemaProvider());