diff --git a/CHANGELOG.md b/CHANGELOG.md index 277e196a9a..bea2d7a806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Remove leading empty line in diagnostic errors. #2067. - `"vetur.completion.tagCasing": "initial"` causes double tag completion. #2053 - 🙌 Fix initializationOptions: Cannot read property 'config' of undefined. Thanks to contribution from [Dawid Pakuła](https://github.com/zulus). #1897 and #1341. +- 🙌 Component props auto-completion doesn't work when using PascalCase. Thanks to contribution from [@yoyo930021](@yoyo930021). #1841 and #2056. - 🙌 When passing incorrect first arg to vti, show help message. Thanks to contribution from [Rafal Tynski](@rafalt). #1841. - 🙌 Use CodeAction over command. Thanks to contribution from [Matt Bierner](@mjbvz). #1704. @@ -18,7 +19,7 @@ - 🙌 Cusom tags IntelliSense for local `tags.json`/`attributes.json`. [Usage Docs](https://vuejs.github.io/vetur/framework.html#workspace-custom-tags). Thanks to contribution from [Carlos Rodrigues](https://github.com/pikax). #1364 and #2018. - 🙌 Detect tags from @nuxt/components. Thanks to contribution from [pooya parsa](https://github.com/pi0). #1921. - 🙌 Fix VTI crash by passing correct PID to language server. Thanks to contribution from [Daniil Yastremskiy](@TheBeastOfCaerbannog). #1699 and #1805. -- 🙌 Fix template interpolation hover info of v-for readonly array item. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #1788. +- 🙌 Fix template interpolation hover info of v-for readonly array item. Thanks to contribution from [@yoyo930021](@yoyo930021). #1788. - 🙌 Improve performance while using template interpolation service. Thanks to contribution from [@IWANABETHATGUY](https://github.com/IWANABETHATGUY). #1839. ### 0.24.0 | 2020-03-04 | [VSIX](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/octref/vsextensions/vetur/0.24.0/vspackage) diff --git a/server/src/modes/template/services/htmlCompletion.ts b/server/src/modes/template/services/htmlCompletion.ts index 50ab028d27..de564f6c76 100644 --- a/server/src/modes/template/services/htmlCompletion.ts +++ b/server/src/modes/template/services/htmlCompletion.ts @@ -6,7 +6,7 @@ import { Range, TextEdit, InsertTextFormat, - CompletionItem, + CompletionItem } from 'vscode-languageserver-types'; import { HTMLDocument } from '../parser/htmlParser'; import { TokenType, createScanner, ScannerState } from '../parser/htmlScanner'; @@ -26,7 +26,7 @@ export function doComplete( const result: CompletionList = { isIncomplete: false, - items: [], + items: [] }; const offset = document.offsetAt(position); @@ -49,7 +49,7 @@ export function doComplete( function collectOpenTagSuggestions(afterOpenBracket: number, tagNameEnd?: number): CompletionList { const range = getReplaceRange(afterOpenBracket, tagNameEnd); - tagProviders.forEach((provider) => { + tagProviders.forEach(provider => { const priority = provider.priority; provider.collectTags((tag, label) => { result.items.push({ @@ -58,7 +58,7 @@ export function doComplete( documentation: label, textEdit: TextEdit.replace(range, tag), sortText: priority + tag, - insertTextFormat: InsertTextFormat.PlainText, + insertTextFormat: InsertTextFormat.PlainText }); }); }); @@ -96,7 +96,7 @@ export function doComplete( kind: CompletionItemKind.Property, filterText: '/' + tag + closeTag, textEdit: TextEdit.replace(range, '/' + tag + closeTag), - insertTextFormat: InsertTextFormat.PlainText, + insertTextFormat: InsertTextFormat.PlainText }; const startIndent = getLineIndent(curr.start); const endIndent = getLineIndent(afterOpenBracket - 1); @@ -114,7 +114,7 @@ export function doComplete( return result; } - tagProviders.forEach((provider) => { + tagProviders.forEach(provider => { provider.collectTags((tag, label) => { result.items.push({ label: '/' + tag, @@ -122,7 +122,7 @@ export function doComplete( documentation: label, filterText: '/' + tag + closeTag, textEdit: TextEdit.replace(range, '/' + tag + closeTag), - insertTextFormat: InsertTextFormat.PlainText, + insertTextFormat: InsertTextFormat.PlainText }); }); }); @@ -143,7 +143,7 @@ export function doComplete( const value = isFollowedBy(text, nameEnd, ScannerState.AfterAttributeName, TokenType.DelimiterAssign) ? '' : '="$1"'; - tagProviders.forEach((provider) => { + tagProviders.forEach(provider => { const priority = provider.priority; provider.collectAttributes(currentTag, (attribute, type, documentation) => { if ((type === 'event' && filterPrefix !== '@') || (type !== 'event' && filterPrefix === '@')) { @@ -159,21 +159,21 @@ export function doComplete( textEdit: TextEdit.replace(range, codeSnippet), insertTextFormat: InsertTextFormat.Snippet, sortText: priority + attribute, - documentation, + documentation }); }); }); const attributeName = scanner.getTokenText(); if (/\.$/.test(attributeName)) { function addModifier(modifiers: { items: Modifier[]; priority: number }) { - modifiers.items.forEach((modifier) => { + modifiers.items.forEach(modifier => { result.items.push({ label: modifier.label, kind: CompletionItemKind.Method, textEdit: TextEdit.insert(document.positionAt(nameEnd), modifier.label), insertTextFormat: InsertTextFormat.Snippet, sortText: modifiers.priority + modifier.label, - documentation: modifier.documentation, + documentation: modifier.documentation }); }); } @@ -229,15 +229,15 @@ export function doComplete( addQuotes = true; } const attribute = currentAttributeName.toLowerCase(); - tagProviders.forEach((provider) => { - provider.collectValues(currentTag, attribute, (value) => { + tagProviders.forEach(provider => { + provider.collectValues(currentTag, attribute, value => { const insertText = addQuotes ? '"' + value + '"' : value; result.items.push({ label: value, filterText: insertText, kind: CompletionItemKind.Unit, textEdit: TextEdit.replace(range, insertText), - insertTextFormat: InsertTextFormat.PlainText, + insertTextFormat: InsertTextFormat.PlainText }); }); }); diff --git a/server/src/modes/template/services/htmlHover.ts b/server/src/modes/template/services/htmlHover.ts index 9965397662..6e8a3a153d 100644 --- a/server/src/modes/template/services/htmlHover.ts +++ b/server/src/modes/template/services/htmlHover.ts @@ -88,7 +88,7 @@ export function doHover( } const tagRange = { start: document.positionAt(scanner.getTokenOffset()), - end: document.positionAt(scanner.getTokenEnd()), + end: document.positionAt(scanner.getTokenEnd()) }; switch (token) { case TokenType.StartTag: diff --git a/server/src/modes/template/tagProviders/externalTagProviders.ts b/server/src/modes/template/tagProviders/externalTagProviders.ts index a04442ff5d..06b274ff48 100644 --- a/server/src/modes/template/tagProviders/externalTagProviders.ts +++ b/server/src/modes/template/tagProviders/externalTagProviders.ts @@ -116,6 +116,6 @@ export function getExternalTagProvider(id: string, tags: any, attributes: any): for (const option of detail.options) { collector(option); } - }, + } }; } diff --git a/test/interpolation/features/completion/basic.test.ts b/test/interpolation/features/completion/basic.test.ts index 9cd2d947ad..8d82798a28 100644 --- a/test/interpolation/features/completion/basic.test.ts +++ b/test/interpolation/features/completion/basic.test.ts @@ -22,12 +22,12 @@ describe('Should autocomplete interpolation for