Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async generateAutoCompleteSuggestions({ force = false } = {}) {
const sdkVersion = Project.sdk()[0];
const sdkPath = Appc.sdkInfo(sdkVersion).path;
try {
// Generate the completions
const [ alloy, sdk ] = await Promise.all([
completion.generateAlloyCompletions(force, completion.CompletionsFormat.v2),
completion.generateSDKCompletions(force, sdkVersion, sdkPath, completion.CompletionsFormat.v2)
]);
if (sdk || alloy) {
let message = 'Autocomplete suggestions generated for';
if (sdk) {
message = `${message} Titanium ${sdk}`;
}
if (alloy) {
message = `${message} Alloy ${alloy}`;
}
atom.notifications.addSuccess(message);
}
} catch (error) {
atom.notifications.addError(`Error generating autocomplete suggestions. ${error.message}`);
}
} catch (error) {
if (error instanceof InteractionError) {
await handleInteractionError(error);
}
return;
}
try {
const sdkInfo = appc.sdkInfo(sdkVersion);
if (!sdkInfo) {
// TODO
return;
}
const sdkPath = sdkInfo.path;
// Generate the completions
const [ alloy, sdk ] = await Promise.all([
completion.generateAlloyCompletions(force, completion.CompletionsFormat.v2),
completion.generateSDKCompletions(force, sdkVersion, sdkPath, completion.CompletionsFormat.v2)
]);
if (sdk || alloy) {
let message = 'Autocomplete suggestions generated for';
if (sdk) {
message = `${message} Titanium ${sdk}`;
}
if (alloy) {
message = `${message} Alloy ${alloy}`;
}
vscode.window.showInformationMessage(message);
}
} catch (error) {
const actions: InteractionChoice[] = [];
if (error.code === 'ESDKNOTINSTALLED') {
actions.push({