Update SQL language configuration to handle auto-closing characters (#426)

* Update the SQL lanaguage configuration to better handle auto-closing characters.

* Remove contents of configuration file.
This commit is contained in:
Karl Burtram 2016-11-29 13:01:05 -08:00 коммит произвёл GitHub
Родитель 900a58e175
Коммит bbd2d5986f
2 изменённых файлов: 36 добавлений и 17 удалений

Просмотреть файл

@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */
'use strict';
import { ExtensionContext, workspace } from 'vscode';
import { ExtensionContext, workspace, languages } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions,
TransportKind, RequestType, NotificationType, NotificationHandler,
ErrorAction, CloseAction } from 'vscode-languageclient';
@ -146,9 +146,43 @@ export default class SqlToolsServiceClient {
});
}
/**
* Initializes the SQL language configuration
*
* @memberOf SqlToolsServiceClient
*/
private initializeLanguageConfiguration(): void {
languages.setLanguageConfiguration('sql', {
comments: {
lineComment: '--',
blockComment: ['/*', '*/']
},
brackets: [
['{', '}'],
['[', ']'],
['(', ')']
],
__characterPairSupport: {
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"', notIn: ['string'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }
]
}
});
}
private initializeService(runtime: Runtime, context: ExtensionContext): Promise<boolean> {
return new Promise<boolean>( (resolve, reject) => {
let self = this;
return new Promise<boolean>( (resolve, reject) => {
this._server.getServerPath(runtime).then(serverPath => {
self.initializeLanguageConfiguration();
let serverArgs = [];
let serverCommand = serverPath;
if (serverPath === undefined) {

Просмотреть файл

@ -1,18 +1,3 @@
{
"comments": {
"lineComment": "--",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
]
// enhancedBrackets:[
// { openTrigger: 'n', open: /begin$/i, closeComplete: 'end', matchCase: true },
// { openTrigger: 'e', open: /case$/i, closeComplete: 'end', matchCase: true },
// { openTrigger: 'n', open: /when$/i, closeComplete: 'then', matchCase: true }
// ],
// noindentBrackets: '()',
}