How to use titanium-editor-commons - 10 common examples

To help you get started, we’ve selected a few titanium-editor-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appcelerator / vscode-appcelerator-titanium / src / explorer / updatesExplorer.ts View on Github external
public async refresh (): Promise {
		this.checkingForUpdates = true;
		this._onDidChangeTreeData.fire();
		try {
			this.updates = await updates.checkAllUpdates();
		} catch (error) {
			let message = 'Failed to check for updates';
			// Need to check in string as titaniumlib currently returns a string as the error
			if (error.code === 'ENOTFOUND' || /ENOTFOUND/.test(error)) {
				message = `${message} as you are offline`;
			}
			await vscode.window.showErrorMessage(message);
		}
		this.checkingForUpdates = false;
		this._onDidChangeTreeData.fire();
		if (this.updates.length) {
			ExtensionContainer.context.globalState.update(GlobalState.HasUpdates, true);
			vscode.commands.executeCommand('setContext', GlobalState.HasUpdates, true);
		}
	}
github appcelerator / vscode-appcelerator-titanium / src / extension.ts View on Github external
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({
				title: 'Install',
github appcelerator / atom-appcelerator-titanium / lib / providers / autoCompleteHelper.js View on Github external
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}`);
		}
github appcelerator / vscode-appcelerator-titanium / src / extension.ts View on Github external
} 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({
github appcelerator / atom-appcelerator-titanium / lib / providers / autoCompleteHelper.js View on Github external
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}`);
		}
		this.loadCompletions(sdkVersion);
github appcelerator / vscode-appcelerator-titanium / src / extension.ts View on Github external
progress.report({
					increment: 100 / totalUpdates
				});
			}
		} catch (error) {
			progress.report({
				message: `Failed to install ${label} (${counter}/${totalUpdates})`
			});
			if (incrementProgress) {
				progress.report({
					increment: 100 / totalUpdates
				});
			}
			if (error.metadata) {
				const { metadata } = error;
				if (update.productName === updates.ProductNames.AppcInstaller && metadata.errorCode === 'EACCES') {
					const runWithSudo = await vscode.window.showErrorMessage(`Failed to update to ${label} as it must be ran with sudo`, {
						title: 'Install with Sudo',
						run: () => {
							ExtensionContainer.terminal.executeCommand(`sudo ${metadata.command}`);
						}
					});
					if (runWithSudo) {
						runWithSudo.run();
					}
				}
			} else {
				// TODO should we show the error that we got passed?
				await vscode.window.showErrorMessage(`Failed to update to ${label}`);
			}
		}
		counter++;
github appcelerator / atom-appcelerator-titanium / spec / controllerAutoCompleteProvider-spec.js View on Github external
it('Should provide suggestions', async function () {
		Project.isTitaniumApp = true;
		sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);

		initTextEditor('Alloy.');
		const suggestions = await getSuggestions('Alloy.');

		expect(suggestions.length).to.equal(16);

		expect(suggestions[0].type).to.equal('method');
		expect(suggestions[0].displayText).to.equal('Alloy');
		expect(suggestions[0].text).to.equal('Alloy');
		expect(suggestions[0].api).to.equal('Alloy');
		expect(suggestions[0].replacementPrefix).to.equal('Alloy.');

		expect(suggestions[1].type).to.equal('properties');
		expect(suggestions[1].displayText).to.equal('Alloy.CFG');
		expect(suggestions[1].rightLabel).to.equal('Alloy');
		expect(suggestions[1].snippet).to.equal('CFG');
github appcelerator / atom-appcelerator-titanium / spec / controllerAutoCompleteProvider-spec.js View on Github external
it('Should provide suggestions', async function () {
		Project.isTitaniumApp = true;
		sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);

		initTextEditor('Ti.');
		const suggestions = await getSuggestions('Ti.');

		expect(suggestions.length).to.equal(202);

		expect(suggestions[0].type).to.equal('method');
		expect(suggestions[0].text).to.equal('Ti.UI');
		expect(suggestions[0].api).to.equal('Ti');
		expect(suggestions[0].replacementPrefix).to.equal('Ti.');

		expect(suggestions[1].type).to.equal('method');
		expect(suggestions[1].text).to.equal('Ti.XML');
		expect(suggestions[1].api).to.equal('Ti');
		expect(suggestions[1].replacementPrefix).to.equal('Ti.');
github appcelerator / atom-appcelerator-titanium / spec / viewAutoCompleteProvider-spec.js View on Github external
it('should provide tag suggestions', async function () {
		Project.isTitaniumApp = true;
		sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);

		initTextEditor('$2');
		expect(suggestions[0].rightLabel).to.equal('Alloy.Widget');
		expect(suggestions[0].description).to.equal('Alloy.Widget');
		expect(suggestions[0].descriptionMoreURL).to.equal('http://docs.appcelerator.com/platform/latest/#!/api/Alloy.Widget');

		expect(suggestions[1].type).to.equal('tag');
		expect(suggestions[1].displayText).to.equal('Window');
		expect(suggestions[1].snippet).to.equal('Window$1>$2');
github appcelerator / atom-appcelerator-titanium / spec / styleAutoCompleteProvider-spec.js View on Github external
it('should provide tag suggestions', async function () {
		Project.isTitaniumApp = true;
		sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);

		initTextEditor('"W');
		const suggestions = await getSuggestions('W');

		expect(suggestions.length).to.equal(4);

		expect(suggestions[0].type).to.equal('tag');
		expect(suggestions[0].text).to.equal('Widget');
		expect(suggestions[0].rightLabel).to.equal('Alloy.Widget');
		expect(suggestions[0].description).to.equal('Alloy.Widget');
		expect(suggestions[0].descriptionMoreURL).to.equal('http://docs.appcelerator.com/platform/latest/#!/api/Alloy.Widget');

		expect(suggestions[1].type).to.equal('tag');
		expect(suggestions[1].text).to.equal('Window');
		expect(suggestions[1].rightLabel).to.equal('Ti.UI.Window');
		expect(suggestions[1].description).to.equal('Ti.UI.Window: The Window is an empty drawing surface or container.');

titanium-editor-commons

`titanium-editor-commons` is a commons library for the [Atom](https://github.com/appcelerator/atom-appcelerator-titanium) and [VS Code](https://github.com/appcelerator/vscode-appcelerator-titanium) editor plugins for [Titanium SDK](https://github.com/appc

Apache-2.0
Latest version published 2 years ago

Package Health Score

46 / 100
Full package analysis

Similar packages