Skip to content

Commit 491002a

Browse files
authored
ServerAPI fallback logic when FileAPI not supported (#1051)
* ServerAPI fallback logic when FileAPI not supported. * Update CHANGELOG.md * Remove fileapi fix entry because the main feature ships with this same release
1 parent 73a0e22 commit 491002a

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/cmake-tools.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,27 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
281281
} else {
282282
communicationMode = 'legacy';
283283
}
284-
285-
if (communicationMode != 'fileapi' && communicationMode != 'serverapi') {
286-
log.warning(
287-
localize('please.upgrade.cmake',
288-
'For the best experience, CMake server or file-api support is required. Please upgrade CMake to {0} or newer.',
289-
versionToString(cmake.minimalServerModeVersion)));
284+
} else if (communicationMode == 'fileapi') {
285+
if (!cmake.isFileApiModeSupported) {
286+
if (cmake.isServerModeSupported) {
287+
communicationMode = 'serverapi';
288+
log.warning(
289+
localize('switch.to.serverapi',
290+
'CMake file-api communication mode is not supported in versions earlier than {0}. Switching to CMake server communication mode.',
291+
versionToString(cmake.minimalFileApiModeVersion)));
292+
} else {
293+
communicationMode = 'legacy';
294+
}
290295
}
291296
}
292297

298+
if (communicationMode != 'fileapi' && communicationMode != 'serverapi') {
299+
log.warning(
300+
localize('please.upgrade.cmake',
301+
'For the best experience, CMake server or file-api support is required. Please upgrade CMake to {0} or newer.',
302+
versionToString(cmake.minimalServerModeVersion)));
303+
}
304+
293305
try {
294306
this._statusMessage.set(localize('starting.cmake.driver.status', 'Starting CMake Server...'));
295307
switch (communicationMode) {

src/cmake/cmake-executable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function getCMakeExecutableInformation(path: string): Promise<CMake
1616
path,
1717
isPresent: false,
1818
minimalServerModeVersion: util.parseVersion('3.7.1'),
19-
minimalFileApiModeVersion: util.parseVersion('3.15.0'),
19+
minimalFileApiModeVersion: util.parseVersion('3.14.0'),
2020
};
2121

2222
if (path.length != 0) {

0 commit comments

Comments
 (0)