Example #1
0
 }).then(() => {
     const pythonConfig = vscode.workspace.getConfiguration('python');
     return pythonConfig.update('unitTest.nosetestArgs', args);
 });
Example #2
0
	private registerProviders(client: TypeScriptServiceClient): void {
		let config = workspace.getConfiguration(this.id);

		this.completionItemProvider = new CompletionItemProvider(client);
		this.completionItemProvider.updateConfiguration(config);

		let hoverProvider = new HoverProvider(client);
		let definitionProvider = new DefinitionProvider(client);
		let documentHighlightProvider = new DocumentHighlightProvider(client);
		let referenceProvider = new ReferenceProvider(client);
		let documentSymbolProvider = new DocumentSymbolProvider(client);
		let signatureHelpProvider = new SignatureHelpProvider(client);
		let renameProvider = new RenameProvider(client);
		this.formattingProvider = new FormattingProvider(client);
		this.formattingProvider.updateConfiguration(config);

		this.description.modeIds.forEach(modeId => {
			let selector: DocumentFilter = { scheme: 'file', language: modeId };
			languages.registerCompletionItemProvider(selector, this.completionItemProvider, '.');
			languages.registerHoverProvider(selector, hoverProvider);
			languages.registerDefinitionProvider(selector, definitionProvider);
			languages.registerDocumentHighlightProvider(selector, documentHighlightProvider);
			languages.registerReferenceProvider(selector, referenceProvider);
			languages.registerDocumentSymbolProvider(selector, documentSymbolProvider);
			languages.registerSignatureHelpProvider(selector, signatureHelpProvider, '(', ',');
			languages.registerRenameProvider(selector, renameProvider);
			languages.registerDocumentRangeFormattingEditProvider(selector, this.formattingProvider);
			languages.registerOnTypeFormattingEditProvider(selector, this.formattingProvider, ';', '}', '\n');
			languages.registerWorkspaceSymbolProvider(new WorkspaceSymbolProvider(client, modeId));
			languages.setLanguageConfiguration(modeId, {
				indentationRules: {
					// ^(.*\*/)?\s*\}.*$
					decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/,
					// ^.*\{[^}"']*$
					increaseIndentPattern: /^.*\{[^}"']*$/
				},
				wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
				comments: {
					lineComment: '//',
					blockComment: ['/*', '*/']
				},
				brackets: [
					['{', '}'],
					['[', ']'],
					['(', ')'],
				],
				onEnterRules: [
					{
						// e.g. /** | */
						beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
						afterText: /^\s*\*\/$/,
						action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
					},
					{
						// e.g. /** ...|
						beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
						action: { indentAction: IndentAction.None, appendText: ' * ' }
					},
					{
						// e.g.  * ...|
						beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
						action: { indentAction: IndentAction.None, appendText: '* ' }
					},
					{
						// e.g.  */|
						beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
						action: { indentAction: IndentAction.None, removeText: 1 }
					}
				],

				__electricCharacterSupport: {
					docComment: { scope: 'comment.documentation', open: '/**', lineStart: ' * ', close: ' */' }
				},

				__characterPairSupport: {
					autoClosingPairs: [
						{ open: '{', close: '}' },
						{ open: '[', close: ']' },
						{ open: '(', close: ')' },
						{ open: '"', close: '"', notIn: ['string'] },
						{ open: '\'', close: '\'', notIn: ['string', 'comment'] },
						{ open: '`', close: '`', notIn: ['string', 'comment'] }
					]
				}
			});
		});
	}
	teardown(() => {
		// Reset config and close all editors
		return workspace.getConfiguration('emmet').update('excludeLanguages', []).then(closeAllEditors);
	});
Example #4
0
function getConfiguredWordSeparators(): string {
	let editorConfig = vscode.workspace.getConfiguration('editor');
	return editorConfig['wordSeparators'];
}
Example #5
0
export async function activate(context: vscode.ExtensionContext) {
	// lets make sure we support this platform first
	let supported = await Utils.verifyPlatform();

	if (!supported) {
		vscode.window.showErrorMessage('Unsupported platform');
		return;
	}

	let config: IConfig = JSON.parse(JSON.stringify(baseConfig));
	config.installDirectory = path.join(__dirname, config.installDirectory);
	config.proxy = vscode.workspace.getConfiguration('http').get('proxy');
	config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;

	const credentialsStore = new CredentialStore(config);
	const resourceProvider = new AzureResourceProvider(config);
	let languageClient: SqlOpsDataClient;

	const serverdownloader = new ServerProvider(config);

	serverdownloader.eventEmitter.onAny(generateHandleServerProviderEvent());

	let clientOptions: ClientOptions = {
		documentSelector: ['sql'],
		synchronize: {
			configurationSection: Constants.extensionConfigSectionName
		},
		providerId: Constants.providerId,
		errorHandler: new LanguageClientErrorHandler(),
		features: [
			// we only want to add new features
			...SqlOpsDataClient.defaultFeatures,
			TelemetryFeature,
			AgentServicesFeature
		],
		outputChannel: new CustomOutputChannel()
	};

	const installationStart = Date.now();
	serverdownloader.getOrDownloadServer().then(e => {
		const installationComplete = Date.now();
		let serverOptions = generateServerOptions(e);
		languageClient = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
		const processStart = Date.now();
		languageClient.onReady().then(() => {
			const processEnd = Date.now();
			statusView.text = 'Service Started';
			setTimeout(() => {
				statusView.hide();
			}, 1500);
			Telemetry.sendTelemetryEvent('startup/LanguageClientStarted', {
				installationTime: String(installationComplete - installationStart),
				processStartupTime: String(processEnd - processStart),
				totalTime: String(processEnd - installationStart),
				beginningTimestamp: String(installationStart)
			});
		});
		statusView.show();
		statusView.text = 'Starting service';
		languageClient.start();
		credentialsStore.start();
		resourceProvider.start();
	}, e => {
		Telemetry.sendTelemetryEvent('ServiceInitializingFailed');
		vscode.window.showErrorMessage('Failed to start Sql tools service');
	});

	let contextProvider = new ContextProvider();
	context.subscriptions.push(contextProvider);
	context.subscriptions.push(credentialsStore);
	context.subscriptions.push(resourceProvider);
	context.subscriptions.push({ dispose: () => languageClient.stop() });
}
Example #6
0
		descriptions.forEach(description => {
			let config = workspace.getConfiguration(description.id);
			let manager = new LanguageManager(this.client, description, config.get(validateSetting, true));
			this.languages.push(manager);
			this.languagePerId[description.id] = manager;
		});
Example #7
0
/**
 * Method to get workspace configuration option
 * @param option name of the option (e.g. for clangd.path should be path)
 * @param defaultValue default value to return if option is not set
 */
function getConfig<T>(option: string, defaultValue?: any): T {
    const config = vscode.workspace.getConfiguration('clangd');
    return config.get<T>(option, defaultValue);
}
Example #8
0
import {
    Disposable, workspace, window, TextDocument,
    TextEditor, StatusBarAlignment, StatusBarItem,
    FileSystemWatcher, version as vsCodeVersion
} from 'vscode';
import { LanguageClient, RequestType, NotificationType } from 'vscode-languageclient';
import { ThrottledDelayer } from './utils/async';
import { Cranefs } from './utils/Cranefs';
import { Debug } from './utils/Debug';
import { Config } from './utils/Config';

const opn = require('opn');
const util = require('util');

let craneSettings = workspace.getConfiguration("crane");
const cranefs: Cranefs = new Cranefs();

export default class Crane
{
    public static langClient: LanguageClient;

    private disposable: Disposable;
    private delayers: { [key: string]: ThrottledDelayer<void> };

    public static statusBarItem: StatusBarItem;

    constructor(languageClient: LanguageClient) {
        Crane.langClient = languageClient;

        this.delayers = Object.create(null);
function shouldPromptToImport()
{
	let as3mxmlConfig = vscode.workspace.getConfiguration("as3mxml");
	return as3mxmlConfig.get("projectImport.prompt");
}
function getConfiguredFormat(format: string = 'format'): string {
  const insertDateStringConfiguration = workspace.getConfiguration('insertDateString');
  return insertDateStringConfiguration.get(format, DEFAULT_FORMAT);
}
Example #11
0
function getSettings(): Settings {
	let httpSettings = workspace.getConfiguration('http');

	let settings: Settings = {
		http: {
			proxy: httpSettings.get('proxy'),
			proxyStrictSSL: httpSettings.get('proxyStrictSSL')
		},
		json: {
			format: workspace.getConfiguration('json').get('format'),
			schemas: [],
		}
	};
	let schemaSettingsById: { [schemaId: string]: JSONSchemaSettings } = Object.create(null);
	let collectSchemaSettings = (schemaSettings: JSONSchemaSettings[], rootPath?: string, fileMatchPrefix?: string) => {
		for (let setting of schemaSettings) {
			let url = getSchemaId(setting, rootPath);
			if (!url) {
				continue;
			}
			let schemaSetting = schemaSettingsById[url];
			if (!schemaSetting) {
				schemaSetting = schemaSettingsById[url] = { url, fileMatch: [] };
				settings.json!.schemas!.push(schemaSetting);
			}
			let fileMatches = setting.fileMatch;
			let resultingFileMatches = schemaSetting.fileMatch!;
			if (Array.isArray(fileMatches)) {
				if (fileMatchPrefix) {
					for (let fileMatch of fileMatches) {
						if (fileMatch[0] === '/') {
							resultingFileMatches.push(fileMatchPrefix + fileMatch);
							resultingFileMatches.push(fileMatchPrefix + '/*' + fileMatch);
						} else {
							resultingFileMatches.push(fileMatchPrefix + '/' + fileMatch);
							resultingFileMatches.push(fileMatchPrefix + '/*/' + fileMatch);
						}
					}
				} else {
					resultingFileMatches.push(...fileMatches);
				}

			}
			if (setting.schema) {
				schemaSetting.schema = setting.schema;
			}
		}
	};

	// merge global and folder settings. Qualify all file matches with the folder path.
	let globalSettings = workspace.getConfiguration('json', null).get<JSONSchemaSettings[]>('schemas');
	if (Array.isArray(globalSettings)) {
		collectSchemaSettings(globalSettings, workspace.rootPath);
	}
	let folders = workspace.workspaceFolders;
	if (folders) {
		for (let folder of folders) {
			let folderUri = folder.uri;

			let schemaConfigInfo = workspace.getConfiguration('json', folderUri).inspect<JSONSchemaSettings[]>('schemas');

			let folderSchemas = schemaConfigInfo!.workspaceFolderValue;
			if (Array.isArray(folderSchemas)) {
				let folderPath = folderUri.toString();
				if (folderPath[folderPath.length - 1] === '/') {
					folderPath = folderPath.substr(0, folderPath.length - 1);
				}
				collectSchemaSettings(folderSchemas, folderUri.fsPath, folderPath);
			}
		}
	}
	return settings;
}
Example #12
0
	private registerProviders(client: TypeScriptServiceClient): void {
		let config = workspace.getConfiguration(this.id);

		this.completionItemProvider = new CompletionItemProvider(client);
		this.completionItemProvider.updateConfiguration(config);

		let hoverProvider = new HoverProvider(client);
		let definitionProvider = new DefinitionProvider(client);
		let documentHighlightProvider = new DocumentHighlightProvider(client);
		let referenceProvider = new ReferenceProvider(client);
		let documentSymbolProvider = new DocumentSymbolProvider(client);
		let signatureHelpProvider = new SignatureHelpProvider(client);
		let renameProvider = new RenameProvider(client);
		this.formattingProvider = new FormattingProvider(client);
		this.formattingProvider.updateConfiguration(config);

		this.description.modeIds.forEach(modeId => {
			let selector: DocumentFilter = { scheme: 'file', language: modeId };
			languages.registerCompletionItemProvider(selector, this.completionItemProvider, '.');
			languages.registerHoverProvider(selector, hoverProvider);
			languages.registerDefinitionProvider(selector, definitionProvider);
			languages.registerDocumentHighlightProvider(selector, documentHighlightProvider);
			languages.registerReferenceProvider(selector, referenceProvider);
			languages.registerDocumentSymbolProvider(selector, documentSymbolProvider);
			languages.registerSignatureHelpProvider(selector, signatureHelpProvider, '(', ',');
			languages.registerRenameProvider(selector, renameProvider);
			languages.registerDocumentRangeFormattingEditProvider(selector, this.formattingProvider);
			languages.registerOnTypeFormattingEditProvider(selector, this.formattingProvider, ';', '}', '\n');
			languages.registerWorkspaceSymbolProvider(new WorkspaceSymbolProvider(client, modeId));
			languages.setLanguageConfiguration(modeId, {
				indentationRules: {
					// ^(.*\*/)?\s*\}.*$
					decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/,
					// ^.*\{[^}"']*$
					increaseIndentPattern: /^.*\{[^}"']*$/
				},
				wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
				onEnterRules: [
					{
						// e.g. /** | */
						beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
						afterText: /^\s*\*\/$/,
						action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' }
					},
					{
						// e.g. /** ...|
						beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
						action: { indentAction: IndentAction.None, appendText: ' * ' }
					},
					{
						// e.g.  * ...|
						beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
						action: { indentAction: IndentAction.None, appendText: '* ' }
					},
					{
						// e.g.  */|
						beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
						action: { indentAction: IndentAction.None, removeText: 1 }
					},
					{
						// e.g.  *-----*/|
						beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
						action: { indentAction: IndentAction.None, removeText: 1 }
					}
				]
			});
		});
	}
Example #13
0
function cmd(): string { return workspace.getConfiguration().get("gradle.useCommand", "gradlew"); }
Example #14
0
 public enable(): Thenable<any> {
     const pythonConfig = vscode.workspace.getConfiguration('python');
     return pythonConfig.update('unitTest.nosetestsEnabled', true);
 }
suite('Tests for Wrap with Abbreviations', () => {
	teardown(closeAllEditors);

	const multiCursors = [new Selection(2, 6, 2, 6), new Selection(3, 6, 3, 6)];
	const multiCursorsWithSelection = [new Selection(2, 2, 2, 28), new Selection(3, 2, 3, 33)];
	const multiCursorsWithFullLineSelection = [new Selection(2, 0, 2, 28), new Selection(3, 0, 4, 0)];

	const oldValueForSyntaxProfiles = workspace.getConfiguration('emmet').inspect('syntaxProfile');

	test('Wrap with block element using multi cursor', () => {
		return testWrapWithAbbreviation(multiCursors, 'div', wrapBlockElementExpected);
	});

	test('Wrap with inline element using multi cursor', () => {
		return testWrapWithAbbreviation(multiCursors, 'span', wrapInlineElementExpected);
	});

	test('Wrap with snippet using multi cursor', () => {
		return testWrapWithAbbreviation(multiCursors, 'a', wrapSnippetExpected);
	});

	test('Wrap with multi line abbreviation using multi cursor', () => {
		return testWrapWithAbbreviation(multiCursors, 'ul>li', wrapMultiLineAbbrExpected);
	});

	test('Wrap with block element using multi cursor selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithSelection, 'div', wrapBlockElementExpected);
	});

	test('Wrap with inline element using multi cursor selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithSelection, 'span', wrapInlineElementExpected);
	});

	test('Wrap with snippet using multi cursor selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithSelection, 'a', wrapSnippetExpected);
	});

	test('Wrap with multi line abbreviation using multi cursor selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithSelection, 'ul>li', wrapMultiLineAbbrExpected);
	});

	test('Wrap with block element using multi cursor full line selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithFullLineSelection, 'div', wrapBlockElementExpected);
	});

	test('Wrap with inline element using multi cursor full line selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithFullLineSelection, 'span', wrapInlineElementExpected);
	});

	test('Wrap with snippet using multi cursor full line selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithFullLineSelection, 'a', wrapSnippetExpected);
	});

	test('Wrap with multi line abbreviation using multi cursor full line selection', () => {
		return testWrapWithAbbreviation(multiCursorsWithFullLineSelection, 'ul>li', wrapMultiLineAbbrExpected);
	});

	test('Wrap with abbreviation and comment filter', () => {
		const contents = `
	<ul class="nav main">
		line
	</ul>
	`;
		const expectedContents = `
	<ul class="nav main">
		<li class="hello">
			line
		</li>
		<!-- /.hello -->
	</ul>
	`;

		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(2, 0, 2, 0)];
			const promise = wrapWithAbbreviation({ abbreviation: 'li.hello|c' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), expectedContents);
				return Promise.resolve();
			});
		});
	});

	test('Wrap with abbreviation entire node when cursor is on opening tag', () => {
		const contents = `
	<div class="nav main">
		hello
	</div>
	`;
		const expectedContents = `
	<div>
		<div class="nav main">
			hello
		</div>
	</div>
	`;

		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(1, 1, 1, 1)];
			const promise = wrapWithAbbreviation({ abbreviation: 'div' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), expectedContents);
				return Promise.resolve();
			});
		});
	});

	test('Wrap with abbreviation entire node when cursor is on closing tag', () => {
		const contents = `
	<div class="nav main">
		hello
	</div>
	`;
		const expectedContents = `
	<div>
		<div class="nav main">
			hello
		</div>
	</div>
	`;

		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(3, 1, 3, 1)];
			const promise = wrapWithAbbreviation({ abbreviation: 'div' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), expectedContents);
				return Promise.resolve();
			});
		});
	});

	test('Wrap with multiline abbreviation doesnt add extra spaces', () => {
		// Issue #29898
		const contents = `
	hello
	`;
		const expectedContents = `
	<ul>
		<li><a href="">hello</a></li>
	</ul>
	`;

		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(1, 2, 1, 2)];
			const promise = wrapWithAbbreviation({ abbreviation: 'ul>li>a' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap returned undefined instead of promise.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), expectedContents);
				return Promise.resolve();
			});
		});
	});

	test('Wrap individual lines with abbreviation', () => {
		const contents = `
	<ul class="nav main">
		<li class="item1">This $10 is not a tabstop</li>
		<li class="item2">hi.there</li>
	</ul>
`;
		const wrapIndividualLinesExpected = `
	<ul class="nav main">
		<ul>
			<li class="hello1"><li class="item1">This $10 is not a tabstop</li></li>
			<li class="hello2"><li class="item2">hi.there</li></li>
		</ul>
	</ul>
`;
		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(2, 2, 3, 33)];
			const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
				return Promise.resolve();
			});
		});
	});

	test('Wrap individual lines with abbreviation with extra space selected', () => {
		const contents = `
	<ul class="nav main">
		<li class="item1">img</li>
		<li class="item2">hi.there</li>
	</ul>
`;
		const wrapIndividualLinesExpected = `
	<ul class="nav main">
		<ul>
			<li class="hello1"><li class="item1">img</li></li>
			<li class="hello2"><li class="item2">hi.there</li></li>
		</ul>
	</ul>
`;
		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(2, 1, 4, 0)];
			const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
				return Promise.resolve();
			});
		});
	});

	test('Wrap individual lines with abbreviation with comment filter', () => {
		const contents = `
	<ul class="nav main">
		<li class="item1">img</li>
		<li class="item2">hi.there</li>
	</ul>
`;
		const wrapIndividualLinesExpected = `
	<ul class="nav main">
		<ul>
			<li class="hello"><li class="item1">img</li></li>
			<!-- /.hello -->
			<li class="hello"><li class="item2">hi.there</li></li>
			<!-- /.hello -->
		</ul>
	</ul>
`;
		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(2, 2, 3, 33)];
			const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello*|c' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
				return Promise.resolve();
			}
			return promise.then(() => {
				assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
				return Promise.resolve();
			});
		});
	});

	test('Wrap individual lines with abbreviation and trim', () => {
		const contents = `
		<ul class="nav main">
			• lorem ipsum
			• lorem ipsum
		</ul>
	`;
		const wrapIndividualLinesExpected = `
		<ul class="nav main">
			<ul>
				<li class="hello1">lorem ipsum</li>
				<li class="hello2">lorem ipsum</li>
			</ul>
		</ul>
	`;
		return withRandomFileEditor(contents, 'html', (editor, _) => {
			editor.selections = [new Selection(2, 3, 3, 16)];
			const promise = wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*|t' });
			if (!promise) {
				assert.equal(1, 2, 'Wrap Individual Lines with Abbreviation returned undefined.');
				return Promise.resolve();
			}

			return promise.then(() => {
				assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
				return Promise.resolve();
			});
		});
	});

	test('Wrap individual lines with abbreviation and format set to false', () => {
		return workspace.getConfiguration('emmet').update('syntaxProfiles',{ 'html' : { 'format': false } } , ConfigurationTarget.Global).then(() => {
			return testWrapWithAbbreviation(multiCursors,'h1',wrapInlineElementExpectedFormatFalse).then(() => {
				return workspace.getConfiguration('emmet').update('syntaxProfiles',oldValueForSyntaxProfiles ? oldValueForSyntaxProfiles.globalValue : undefined, ConfigurationTarget.Global);
			});
		});
	});
});
function migrateCompilerElement(compilerElement: any, appPath: string, isFlexLibrary: boolean, sdks: FlashBuilderSDK[], linkedResources: EclipseLinkedResource[], result: any)
{
	let attributes = compilerElement.attributes;
	let frameworkSDKConfig = vscode.workspace.getConfiguration("as3mxml");
	let frameworkSDK = frameworkSDKConfig.inspect("sdk.framework").workspaceValue;
	if(!frameworkSDK)
	{
		let sdk: FlashBuilderSDK;
		let useFlashSDK = false;
		if("useFlashSDK" in attributes)
		{
			useFlashSDK = attributes.useFlashSDK === "true";
		}
		if(useFlashSDK)
		{
			sdk = sdks.find((sdk) =>
			{
				return sdk.flashSDK;
			});
		}
		else if("flexSDK" in attributes)
		{
			let sdkName = attributes.flexSDK;
			sdk = sdks.find((sdk) =>
			{
				return sdk.name === sdkName;
			});
		}
		else
		{
			sdk = sdks.find((sdk) =>
			{
				return sdk.defaultSDK;
			});
		}
		if(sdk)
		{
			let validatedSDKPath = validateFrameworkSDK(sdk.location);
			if(validatedSDKPath !== null)
			{
				frameworkSDKConfig.update("sdk.framework", validatedSDKPath);
			}
		}
	}
	if(!isFlexLibrary && "useApolloConfig" in attributes && attributes.useApolloConfig === "true")
	{
		result.application = path.posix.join(attributes.sourceFolderPath, getApplicationNameFromPath(appPath) + "-app.xml");
	}
	if(!isFlexLibrary && "copyDependentFiles" in attributes && attributes.copyDependentFiles === "true")
	{
		result.copySourcePathAssets = true;
	}
	if(!isFlexLibrary && "htmlGenerate" in attributes && attributes.htmlGenerate === "true")
	{
		result.htmlTemplate = "html-template";
	}
	if("outputFolderPath" in attributes)
	{
		let fileExtension = isFlexLibrary ? FILE_EXTENSION_SWC : FILE_EXTENSION_SWF;
		result.compilerOptions.output = path.posix.join(attributes.outputFolderPath, getApplicationNameFromPath(appPath) + fileExtension);
	}
	if("additionalCompilerArguments" in attributes)
	{
		result.additionalOptions = attributes.additionalCompilerArguments;
	}
	if("generateAccessible" in attributes && attributes.generateAccessible === "true")
	{
		result.compilerOptions.accessible = true;
	}
	if("strict" in attributes && attributes.strict !== "true")
	{
		result.compilerOptions.strict = false;
	}
	if("warn" in attributes && attributes.warn !== "true")
	{
		result.compilerOptions.warnings = false;
	}
	if("verifyDigests" in attributes && attributes.verifyDigests !== "true")
	{
		result.compilerOptions["verify-digests"] = false;
	}
	if("targetPlayerVersion" in attributes && attributes.targetPlayerVersion !== "0.0.0")
	{
		result.compilerOptions["target-player"] = attributes.targetPlayerVersion;
	}
	let sourceFolderPath: string = null;
	if("sourceFolderPath" in attributes)
	{
		sourceFolderPath = attributes.sourceFolderPath;
		if(!isFlexLibrary)
		{
			let mainFilePath = path.posix.join(attributes.sourceFolderPath, appPath);
			result.files.push(mainFilePath);
		}
	}
	let children = compilerElement.children as any[];
	let compilerSourcePathElement = findChildElementByName(children, "compilerSourcePath");
	if(compilerSourcePathElement)
	{
		migrateCompilerSourcePathElement(compilerSourcePathElement, sourceFolderPath, linkedResources, result);
	}
	let libraryPathElement = findChildElementByName(children, "libraryPath");
	if(libraryPathElement)
	{
		migrateCompilerLibraryPathElement(libraryPathElement, linkedResources, result);
	}
}
Example #17
0
		const onEnabled = filterEvent(onConfigChange, () => workspace.getConfiguration('git', null).get<boolean>('enabled') === true);
Example #18
0
	private readTrace(): Trace {
		return Trace.fromString(workspace.getConfiguration().get<string>('markdown.trace', 'off'));
	}
Example #19
0
		this.languages.forEach(language => {
			let config = workspace.getConfiguration(language.id);
			language.validate = config.get(validateSetting, true);
		});
	public updateConfiguration(): void {
		const config = workspace.getConfiguration(this.language);
		this.setEnabled(config.get('referencesCodeLens.enabled', false));
	}
Example #21
0
function configureHttpRequest() {
	let httpSettings = workspace.getConfiguration('http');
	httpRequest.configure(httpSettings.get<string>('proxy'), httpSettings.get<boolean>('proxyStrictSSL'));
}
Example #22
0
// Seeing .olean files in the source tree is annoying, we should
// just globally hide them.
function configExcludeOLean() {
    const files = workspace.getConfiguration('files');
    const exclude = files.get('exclude');
    exclude['**/*.olean'] = true;
    files.update('exclude', exclude, true);
}
Example #23
0
function configureHttpRequest() {
	const httpSettings = vscode.workspace.getConfiguration('http');
	httpRequest.configure(httpSettings.get<string>('proxy', ''), httpSettings.get<boolean>('proxyStrictSSL', true));
}
Example #24
0
export function getCurrentThemeIconsID(): string {
  return vscode.workspace.getConfiguration().get<string>('workbench.iconTheme');
}
Example #25
0
import { ExtensionContext } from 'vscode'
import * as vscode from 'vscode'
import { LanguageClient, LanguageClientOptions, RevealOutputChannelOn,
         ServerOptions } from 'vscode-languageclient'
import { enableOldServerWorkaround } from './compat'
import * as features from './features'

export let client: LanguageClient

import * as rpc from 'vscode-jsonrpc'
import * as sbtserver from './sbt-server'
import { Tracer } from './tracer'

export const extensionName = 'dotty'
const extensionConfig = vscode.workspace.getConfiguration(extensionName)

let extensionContext: ExtensionContext
let outputChannel: vscode.OutputChannel
let tracer: Tracer

/** The sbt process that may have been started by this extension */
let sbtProcess: ChildProcess | undefined

const sbtVersion = "1.2.3"
const sbtArtifact = `org.scala-sbt:sbt-launch:${sbtVersion}`
export const workspaceRoot = `${vscode.workspace.rootPath}`
const disableDottyIDEFile = path.join(workspaceRoot, ".dotty-ide-disabled")
const sbtProjectDir = path.join(workspaceRoot, "project")
const sbtPluginFile = path.join(sbtProjectDir, "dotty-plugin.sbt")
const sbtBuildPropertiesFile = path.join(sbtProjectDir, "build.properties")
Example #26
0
export function setIconsID(id: string): Thenable<void> {
  return vscode.workspace.getConfiguration().update('workbench.iconTheme', id, true);
}
Example #27
0
import * as vscode from 'vscode'; 
var request = require('request');
var fs = require('fs');

var channelList = [];
var configuration = vscode.workspace.getConfiguration('slack');
var teamToken = configuration.get('teamToken'); 
var username = configuration.get('username');
var avatarUrl = configuration.get('avatarUrl');

var BASE_URL = 'https://slack.com/api/';
var API_CHANNELS = 'channels.list';
var API_USERS = 'users.list';
var API_GROUPS = 'groups.list';
var API_POST_MESSAGE = 'chat.postMessage';
var API_UPLOAD_FILES = 'files.upload';
var API_SET_SNOOZE = 'dnd.setSnooze';
var API_END_SNOOZE = 'dnd.endSnooze';
        
class Slack
{
     private _statusBarItem: vscode.StatusBarItem;   
     private savedChannel: string;
     
     private GetChannelList(callback, type:string, data)
     {  
        var params = '?token='+teamToken+'&exclude_archived=1';
        channelList.length = 0;
        var __request = function (urls, callback) {
            var results = {}, t = urls.length, c = 0,
                handler = function (error, response, body) {
			return testWrapWithAbbreviation(multiCursors,'h1',wrapInlineElementExpectedFormatFalse).then(() => {
				return workspace.getConfiguration('emmet').update('syntaxProfiles',oldValueForSyntaxProfiles ? oldValueForSyntaxProfiles.globalValue : undefined, ConfigurationTarget.Global);
			});
Example #29
0
			return testHtmlExpandAbbreviation(new Selection(9, 6, 9, 6), '', '', true).then(() => {
				return workspace.getConfiguration('emmet').update('excludeLanguages', []);
			});
Example #30
0
		let isDecoratorEnabled = (languageId: string) => {
			return workspace.getConfiguration().get<boolean>(languageId + '.colorDecorators.enable');
		};