From f1c7c4f4827338ebe42dd086849383999ac9ea48 Mon Sep 17 00:00:00 2001 From: Erik Lieben Date: Mon, 24 Oct 2016 09:20:11 +0200 Subject: [PATCH] feat(autocomplete): config setting aurelia.autocomplete.quotes to specify single or double quotes on auto-complete, resolves #13 --- dist/src/client/main.js | 2 +- dist/src/client/main.js.map | 2 +- .../aureliaLanguageService.js.map | 2 +- .../services/htmlCompletion.js | 14 ++++++++----- .../services/htmlCompletion.js.map | 2 +- dist/src/server/main.js | 10 +++------ dist/src/server/main.js.map | 2 +- package.json | 19 ++++++++++++++++- src/client/main.ts | 2 +- .../aureliaLanguageService.ts | 6 +----- .../services/htmlCompletion.ts | 15 ++++++++----- src/server/main.ts | 21 ++++--------------- 12 files changed, 51 insertions(+), 46 deletions(-) diff --git a/dist/src/client/main.js b/dist/src/client/main.js index 8ce88776..6e3810d8 100644 --- a/dist/src/client/main.js +++ b/dist/src/client/main.js @@ -20,7 +20,7 @@ function activate(context) { let clientOptions = { documentSelector: ['html'], synchronize: { - configurationSection: ['html'], + configurationSection: ['aurelia'], }, initializationOptions: {} }; diff --git a/dist/src/client/main.js.map b/dist/src/client/main.js.map index eed5596a..366659c9 100644 --- a/dist/src/client/main.js.map +++ b/dist/src/client/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/client/main.ts"],"names":[],"mappings":";AAAA,MAAY,IAAI,WAAM,MAAM,CAAC,CAAA;AAC7B,yBAAmE,QAAQ,CAAC,CAAA;AAC5E,wCAAoF,uBAAuB,CAAC,CAAA;AAC5G,qCAA+B,sBAAsB,CAAC,CAAA;AAEtD,IAAI,aAA4B,CAAC;AAEjC,kBAAyB,OAAyB;IAEhD,gCAAgC;IAChC,aAAa,GAAG,eAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACtD,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE1C,wBAAwB;IACxB,OAAO,CAAC,aAAa,CAAC,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,gCAAgC;IAChC,aAAa,GAAG,eAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACtD,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE1C,wBAAwB;IACxB,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,4BAAkB,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;IAE/E,mCAAmC;IACnC,IAAI,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IACzF,IAAI,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;IAC9D,IAAI,aAAa,GAAkB;QACnC,GAAG,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,qCAAa,CAAC,GAAG,EAAE;QAC3D,KAAK,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,qCAAa,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE;KACpF,CAAC;IACD,IAAI,aAAa,GAA0B;QACzC,gBAAgB,EAAE,CAAC,MAAM,CAAC;QAC1B,WAAW,EAAE;YACX,oBAAoB,EAAE,CAAC,SAAS,CAAC;SAClC;QACD,qBAAqB,EAAE,EAAE;KAC1B,CAAC;IACF,IAAI,MAAM,GAAG,IAAI,sCAAc,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAClF,IAAI,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AA1Be,gBAAQ,WA0BvB,CAAA"} \ No newline at end of file diff --git a/dist/src/server/aurelia-languageservice/aureliaLanguageService.js.map b/dist/src/server/aurelia-languageservice/aureliaLanguageService.js.map index 8440940d..c75b3504 100644 --- a/dist/src/server/aurelia-languageservice/aureliaLanguageService.js.map +++ b/dist/src/server/aurelia-languageservice/aureliaLanguageService.js.map @@ -1 +1 @@ -{"version":3,"file":"aureliaLanguageService.js","sourceRoot":"","sources":["../../../../src/server/aurelia-languageservice/aureliaLanguageService.ts"],"names":[],"mappings":";AAAA,6BAAsB,qBAAqB,CAAC,CAAA;AAC5C,iCAA2B,2BAA2B,CAAC,CAAA;AAcvD;IACC,MAAM,CAAC;QACN,uCAAU;QACR,iBAAiB,EAAE,QAAQ,IAAI,kBAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;KAC1D,CAAC;AACH,CAAC;AALe,0BAAkB,qBAKjC,CAAA"} \ No newline at end of file +{"version":3,"file":"aureliaLanguageService.js","sourceRoot":"","sources":["../../../../src/server/aurelia-languageservice/aureliaLanguageService.ts"],"names":[],"mappings":";AAAA,6BAAsB,qBAAqB,CAAC,CAAA;AAC5C,iCAA2B,2BAA2B,CAAC,CAAA;AAUvD;IACC,MAAM,CAAC;QACN,uCAAU;QACR,iBAAiB,EAAE,QAAQ,IAAI,kBAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;KAC1D,CAAC;AACH,CAAC;AALe,0BAAkB,qBAKjC,CAAA"} \ No newline at end of file diff --git a/dist/src/server/aurelia-languageservice/services/htmlCompletion.js b/dist/src/server/aurelia-languageservice/services/htmlCompletion.js index 3cb14eb5..f3be0b89 100644 --- a/dist/src/server/aurelia-languageservice/services/htmlCompletion.js +++ b/dist/src/server/aurelia-languageservice/services/htmlCompletion.js @@ -1,7 +1,11 @@ "use strict"; const htmlScanner_1 = require('../parser/htmlScanner'); const aureliaTagProvider_1 = require('../parser/aureliaTagProvider'); -function doComplete(document, position, htmlDocument) { +function doComplete(document, position, htmlDocument, quotes) { + let quote = '"'; + if (quotes === 'single') { + quote = '\''; + } let tagProvider = aureliaTagProvider_1.getAureliaTagProvider(); let result = { isIncomplete: false, @@ -38,7 +42,7 @@ function doComplete(document, position, htmlDocument) { } function collectAttributeNameSuggestions(nameStart, nameEnd = offset) { let range = getReplaceRange(nameStart, nameEnd); - let value = isFollowedBy(text, nameEnd, htmlScanner_1.ScannerState.AfterAttributeName, htmlScanner_1.TokenType.DelimiterAssign) ? '' : '="{{}}"'; + let value = isFollowedBy(text, nameEnd, htmlScanner_1.ScannerState.AfterAttributeName, htmlScanner_1.TokenType.DelimiterAssign) ? '' : '=' + quote + '{{}}' + quote; tagProvider.collectAttributes(currentTag, (attribute, type) => { let codeSnippet = attribute; if (type !== 'v' && value.length) { @@ -55,9 +59,9 @@ function doComplete(document, position, htmlDocument) { function collectAttributeValueSuggestions(valueStart, valueEnd) { let range; let addQuotes; - if (offset > valueStart && offset <= valueEnd && text[valueStart] === '"') { + if (offset > valueStart && offset <= valueEnd && text[valueStart] === quote) { // inside attribute - if (valueEnd > offset && text[valueEnd - 1] === '"') { + if (valueEnd > offset && text[valueEnd - 1] === quote) { valueEnd--; } let wsBefore = getWordStart(text, offset, valueStart + 1); @@ -70,7 +74,7 @@ function doComplete(document, position, htmlDocument) { addQuotes = true; } tagProvider.collectValues(currentTag, currentAttributeName, (value) => { - let codeSnippet = addQuotes ? '"' + value + '"' : value; + let codeSnippet = addQuotes ? quote + value + quote : value; result.items.push({ label: value, filterText: codeSnippet, diff --git a/dist/src/server/aurelia-languageservice/services/htmlCompletion.js.map b/dist/src/server/aurelia-languageservice/services/htmlCompletion.js.map index 8bb6d34b..4a454d50 100644 --- a/dist/src/server/aurelia-languageservice/services/htmlCompletion.js.map +++ b/dist/src/server/aurelia-languageservice/services/htmlCompletion.js.map @@ -1 +1 @@ -{"version":3,"file":"htmlCompletion.js","sourceRoot":"","sources":["../../../../../src/server/aurelia-languageservice/services/htmlCompletion.ts"],"names":[],"mappings":";AAEA,8BAAuD,uBACvD,CAAC,CAD6E;AAC9E,qCAAsC,8BAEtC,CAAC,CAFmE;AAUpE,oBAA2B,QAAsB,EAAE,QAAkB,EAAE,YAA0B;IAE/F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CAAA;AAED,sBAAsB,CAAS;IAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,6BAA6B,CAAS;IACrC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,sBAAsB,CAAS,EAAE,MAAa,EAAE,WAAyB,EAAE,aAAwB;IAClG,IAAI,OAAO,GAAG,2BAAa,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACpD,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,KAAK,KAAK,uBAAS,CAAC,UAAU,EAAE,CAAC;QACvC,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,KAAK,IAAI,aAAa,CAAC;AAC/B,CAAC;AAED,sBAAsB,CAAS,EAAE,MAAc,EAAE,KAAa;IAC7D,OAAO,MAAM,GAAG,KAAK,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM,EAAE,CAAC;IACV,CAAC;IACD,MAAM,CAAC,MAAM,CAAC;AACf,CAAC;AAED,oBAAoB,CAAS,EAAE,MAAc,EAAE,KAAa;IAC3D,OAAO,MAAM,GAAG,KAAK,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QACnD,MAAM,EAAE,CAAC;IACV,CAAC;IACD,MAAM,CAAC,MAAM,CAAC;AACf,CAAC"} \ No newline at end of file +{"version":3,"file":"htmlCompletion.js","sourceRoot":"","sources":["../../../../../src/server/aurelia-languageservice/services/htmlCompletion.ts"],"names":[],"mappings":";AAEA,8BAAuD,uBACvD,CAAC,CAD6E;AAC9E,qCAAsC,8BAEtC,CAAC,CAFmE;AAUpE,oBAA2B,QAAsB,EAAE,QAAkB,EAAE,YAA0B,EAAE,MA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bf..954502bc 100644 --- a/dist/src/server/main.js +++ b/dist/src/server/main.js @@ -24,17 +24,13 @@ connection.onInitialize((params) => { } }; }); -let languageSettings; -connection.onDidChangeConfiguration((change) => { - let settings = change.settings; - languageSettings = settings.html; -}); +let aureliaSettings; +connection.onDidChangeConfiguration((change) => aureliaSettings = change.settings.aurelia); let languageService = aureliaLanguageService_1.getLanguageService(); connection.onCompletion(textDocumentPosition => { let document = documents.get(textDocumentPosition.textDocument.uri); let htmlDocument = htmlDocuments.get(document); - let options = languageSettings && languageSettings.suggest; - return languageService.doComplete(document, textDocumentPosition.position, htmlDocument); + return languageService.doComplete(document, textDocumentPosition.position, htmlDocument, aureliaSettings.autocomplete.quotes); }); connection.listen(); //# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/dist/src/server/main.js.map b/dist/src/server/main.js.map index 8053279a..cc5bacae 100644 --- a/dist/src/server/main.js.map +++ b/dist/src/server/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/server/main.ts"],"names":[],"mappings":";AAAA,wCAAiG,uBAAuB,CAAC,CAAA;AACzH,yCAA0E,kDAAkD,CAAC,CAAA;AAC7H,qCAAsC,sBAAsB,CAAC,CAAA;AAU7D,IAAI,UAAU,GAAgB,wCAAgB,EAAE,CAAC;AACjD,OAAO,CAAC,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC9D,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAElE,IAAI,SAAS,GAAkB,IAAI,qCAAa,EAAE,CAAC;AACnD,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAE7B,IAAI,aAAa,GAAG,0CAAqB,CAAe,EAAE,EAAE,EAAE,EAAE,QAAQ,IAAI,2CAAkB,EAAE,CAAC,iBAAiB,CAA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C;AAEH,IAAI,eAAe,CAAC;AACpB,UAAU,CAAC,wBAAwB,CAAC,CAAC,MAAM,KAAK,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAE3F,IAAI,eAAe,GAAG,2CAAkB,EAAE,CAAC;AAE3C,UAAU,CAAC,YAAY,CAAC,oBAAoB;IAC3C,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC/H,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,MAAM,EAAE,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 70138176..02f56f68 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,24 @@ "uiTheme": "vs", "path": "./themes/light_vs.json" } - ] + ], + "configuration": { + "id": "aurelia", + "order": 20, + "type": "object", + "title": "Aurelia", + "properties": { + "aurelia.autocomplete.quotes": { + "type": "string", + "enum": [ + "single", + "double" + ], + "default": "double", + "description": "Quotes to use when performing an autocomplete action" + } + } + } }, "scripts": { "vscode:prepublish": "node ./node_modules/typescript/bin/tsc -p ./", diff --git a/src/client/main.ts b/src/client/main.ts index 1893c8dd..372c0d93 100644 --- a/src/client/main.ts +++ b/src/client/main.ts @@ -24,7 +24,7 @@ export function activate(context: ExtensionContext) { let clientOptions: LanguageClientOptions = { documentSelector: ['html'], synchronize: { - configurationSection: ['html'], + configurationSection: ['aurelia'], }, initializationOptions: {} }; diff --git a/src/server/aurelia-languageservice/aureliaLanguageService.ts b/src/server/aurelia-languageservice/aureliaLanguageService.ts index 70301431..141951fd 100644 --- a/src/server/aurelia-languageservice/aureliaLanguageService.ts +++ b/src/server/aurelia-languageservice/aureliaLanguageService.ts @@ -2,14 +2,10 @@ import { parse } from './parser/htmlParser'; import { doComplete } from './services/htmlCompletion'; import { TextDocument, Position, CompletionList } from 'vscode-languageserver-types'; -export interface CompletionConfiguration { - [provider: string]: boolean; -} - export declare type HTMLDocument = {}; export interface LanguageService { - doComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument): CompletionList; + doComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument, quotes: string): CompletionList; parseHTMLDocument(document: TextDocument): HTMLDocument; } diff --git a/src/server/aurelia-languageservice/services/htmlCompletion.ts b/src/server/aurelia-languageservice/services/htmlCompletion.ts index 805ce02e..ffae55d6 100644 --- a/src/server/aurelia-languageservice/services/htmlCompletion.ts +++ b/src/server/aurelia-languageservice/services/htmlCompletion.ts @@ -11,7 +11,12 @@ export interface IHTMLTagProvider { collectValues(tag: string, attribute: string, collector: (value: string) => void): void; } -export function doComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument): CompletionList { +export function doComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument, quotes: string): CompletionList { + + let quote = '"'; + if (quotes === 'single') { + quote = '\''; + } let tagProvider = getAureliaTagProvider(); let result: CompletionList = { @@ -55,7 +60,7 @@ export function doComplete(document: TextDocument, position: Position, htmlDocum function collectAttributeNameSuggestions(nameStart: number, nameEnd: number = offset): CompletionList { let range = getReplaceRange(nameStart, nameEnd); - let value = isFollowedBy(text, nameEnd, ScannerState.AfterAttributeName, TokenType.DelimiterAssign) ? '' : '="{{}}"'; + let value = isFollowedBy(text, nameEnd, ScannerState.AfterAttributeName, TokenType.DelimiterAssign) ? '' : '=' + quote + '{{}}' + quote; tagProvider.collectAttributes(currentTag, (attribute, type) => { let codeSnippet = attribute; if (type !== 'v' && value.length) { @@ -73,9 +78,9 @@ export function doComplete(document: TextDocument, position: Position, htmlDocum function collectAttributeValueSuggestions(valueStart: number, valueEnd?: number): CompletionList { let range: Range; let addQuotes: boolean; - if (offset > valueStart && offset <= valueEnd && text[valueStart] === '"') { + if (offset > valueStart && offset <= valueEnd && text[valueStart] === quote) { // inside attribute - if (valueEnd > offset && text[valueEnd-1] === '"') { + if (valueEnd > offset && text[valueEnd-1] === quote) { valueEnd--; } let wsBefore = getWordStart(text, offset, valueStart + 1); @@ -88,7 +93,7 @@ export function doComplete(document: TextDocument, position: Position, htmlDocum } tagProvider.collectValues(currentTag, currentAttributeName, (value) => { - let codeSnippet = addQuotes ? '"' + value + '"' : value; + let codeSnippet = addQuotes ? quote + value + quote : value; result.items.push({ label: value, filterText: codeSnippet, diff --git a/src/server/main.ts b/src/server/main.ts index 5d28eeef..15bdf5be 100644 --- a/src/server/main.ts +++ b/src/server/main.ts @@ -1,15 +1,7 @@ import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult } from 'vscode-languageserver'; -import { HTMLDocument, getLanguageService, CompletionConfiguration } from './aurelia-languageservice/aureliaLanguageService'; +import { HTMLDocument, getLanguageService } from './aurelia-languageservice/aureliaLanguageService'; import { getLanguageModelCache } from './languageModelCache'; -interface Settings { - html: LanguageSettings; -} - -interface LanguageSettings { - suggest: CompletionConfiguration; -} - let connection: IConnection = createConnection(); console.log = connection.console.log.bind(connection.console); console.error = connection.console.error.bind(connection.console); @@ -38,20 +30,15 @@ connection.onInitialize((params: InitializeParams): InitializeResult => { }; }); -let languageSettings: LanguageSettings; -connection.onDidChangeConfiguration((change) => { - let settings = change.settings; - languageSettings = settings.html; -}); +let aureliaSettings; +connection.onDidChangeConfiguration((change) => aureliaSettings = change.settings.aurelia); let languageService = getLanguageService(); connection.onCompletion(textDocumentPosition => { - let document = documents.get(textDocumentPosition.textDocument.uri); let htmlDocument = htmlDocuments.get(document); - let options = languageSettings && languageSettings.suggest; - return languageService.doComplete(document, textDocumentPosition.position, htmlDocument); + return languageService.doComplete(document, textDocumentPosition.position, htmlDocument, aureliaSettings.autocomplete.quotes); }); connection.listen();