Skip to content

Commit d9781c7

Browse files
gerauKyrylR
andauthored
apply suggestion for find_server.ts
Co-authored-by: Kyrylo Riabov <kyryl.ryabov@gmail.com>
1 parent a3a210f commit d9781c7

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

vscode/src/find_server.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,23 @@ export async function ensureExecutable(
137137
return null;
138138
}
139139

140-
if (cargoPath) {
141-
const disableAutoupdate = config.get<boolean>("disableAutoupdate", false);
142-
143-
const shouldInstallOrUpdate = (!serverPath) || !disableAutoupdate;
140+
if (!cargoPath) {
141+
return serverPath;
142+
}
143+
144+
const disableAutoupdate = config.get<boolean>("disableAutoupdate", false);
145+
146+
if (!serverPath || !disableAutoupdate) {
147+
return serverPath;
148+
}
144149

145-
if (shouldInstallOrUpdate) {
146-
try {
147-
await installServer(command);
150+
try {
151+
await installServer(command);
148152

149-
serverPath = findExecutable(command);
150-
} catch (err) {
151-
window.showErrorMessage(err);
152-
return null;
153-
}
154-
}
153+
serverPath = findExecutable(command);
154+
} catch (err) {
155+
window.showErrorMessage(err);
156+
return null;
155157
}
156158

157159
return serverPath;

0 commit comments

Comments
 (0)