Don't show CMake server status for fileApi/legacy modes (#1070)

This commit is contained in:
Bob Brown 2020-02-12 10:44:49 -08:00 коммит произвёл GitHub
Родитель 7448d01752
Коммит ae75ef79d2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 16 добавлений и 11 удалений

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

@ -272,30 +272,33 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
const preferredGenerators = this.getPreferredGenerators(); const preferredGenerators = this.getPreferredGenerators();
const preConditionHandler = async (e: CMakePreconditionProblems) => this.cmakePreConditionProblemHandler(e); const preConditionHandler = async (e: CMakePreconditionProblems) => this.cmakePreConditionProblemHandler(e);
let communicationMode = this.workspaceContext.config.cmakeCommunicationMode.toLowerCase(); let communicationMode = this.workspaceContext.config.cmakeCommunicationMode.toLowerCase();
const fileApi = 'fileapi';
const serverApi = 'serverapi';
const legacy = 'legacy';
if (communicationMode == 'automatic') { if (communicationMode !== fileApi && communicationMode !== serverApi && communicationMode !== legacy) {
if (cmake.isFileApiModeSupported) { if (cmake.isFileApiModeSupported) {
communicationMode = 'fileapi'; communicationMode = fileApi;
} else if (cmake.isServerModeSupported) { } else if (cmake.isServerModeSupported) {
communicationMode = 'serverapi'; communicationMode = serverApi;
} else { } else {
communicationMode = 'legacy'; communicationMode = legacy;
} }
} else if (communicationMode == 'fileapi') { } else if (communicationMode === fileApi) {
if (!cmake.isFileApiModeSupported) { if (!cmake.isFileApiModeSupported) {
if (cmake.isServerModeSupported) { if (cmake.isServerModeSupported) {
communicationMode = 'serverapi'; communicationMode = serverApi;
log.warning( log.warning(
localize('switch.to.serverapi', localize('switch.to.serverapi',
'CMake file-api communication mode is not supported in versions earlier than {0}. Switching to CMake server communication mode.', 'CMake file-api communication mode is not supported in versions earlier than {0}. Switching to CMake server communication mode.',
versionToString(cmake.minimalFileApiModeVersion))); versionToString(cmake.minimalFileApiModeVersion)));
} else { } else {
communicationMode = 'legacy'; communicationMode = legacy;
} }
} }
} }
if (communicationMode != 'fileapi' && communicationMode != 'serverapi') { if (communicationMode !== fileApi && communicationMode !== serverApi) {
log.warning( log.warning(
localize('please.upgrade.cmake', localize('please.upgrade.cmake',
'For the best experience, CMake server or file-api support is required. Please upgrade CMake to {0} or newer.', 'For the best experience, CMake server or file-api support is required. Please upgrade CMake to {0} or newer.',
@ -303,13 +306,15 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
} }
try { try {
if (communicationMode === serverApi) {
this._statusMessage.set(localize('starting.cmake.driver.status', 'Starting CMake Server...')); this._statusMessage.set(localize('starting.cmake.driver.status', 'Starting CMake Server...'));
}
switch (communicationMode) { switch (communicationMode) {
case 'fileapi': case fileApi:
drv = await CMakeFileApiDriver drv = await CMakeFileApiDriver
.create(cmake, this.workspaceContext.config, kit, workspace, preConditionHandler, preferredGenerators); .create(cmake, this.workspaceContext.config, kit, workspace, preConditionHandler, preferredGenerators);
break; break;
case 'serverapi': case serverApi:
drv = await CMakeServerClientDriver drv = await CMakeServerClientDriver
.create(cmake, this.workspaceContext.config, kit, workspace, preConditionHandler, preferredGenerators); .create(cmake, this.workspaceContext.config, kit, workspace, preConditionHandler, preferredGenerators);
break; break;