Skip to content

Commit

Permalink
Attr completion for both upper/lower case tags. Fix #1102
Browse files Browse the repository at this point in the history
  • Loading branch information
octref committed Feb 21, 2019
1 parent bded762 commit 390d65f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions server/src/modes/template/tagProviders/componentInfoTagProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,37 @@ import { ChildComponent } from '../../../services/vueInfoService';
import { MarkupContent } from 'vscode-languageserver-types';

export function getComponentInfoTagProvider(childComponents: ChildComponent[]): IHTMLTagProvider {
const tags: ITagSet = {};
const tagSet: ITagSet = {};

for (const cc of childComponents) {
const props: Attribute[] = [];
if (cc.info && cc.info.componentInfo.props) {
cc.info.componentInfo.props.forEach(p => {
props.push(genAttribute(p.name, undefined, { kind: 'markdown', value: p.documentation || '' }));
});
}
tags[cc.name] = new HTMLTagSpecification({
kind: 'markdown',
value: cc.documentation || ''
}, props);
tagSet[cc.name] = new HTMLTagSpecification(
{
kind: 'markdown',
value: cc.documentation || ''
},
props
);
tagSet[cc.name.toLowerCase()] = tagSet[cc.name];
}

return {
getId: () => 'component',
priority: Priority.UserCode,
collectTags: collector => collectTagsDefault(collector, tags),
collectTags: collector => collectTagsDefault(collector, tagSet),
collectAttributes: (
tag: string,
collector: (attribute: string, type?: string, documentation?: string | MarkupContent) => void
) => {
collectAttributesDefault(tag, collector, tags, []);
collectAttributesDefault(tag, collector, tagSet, []);
},
collectValues: (tag: string, attribute: string, collector: (value: string) => void) => {
collectValuesDefault(tag, attribute, collector, tags, [], {});
collectValuesDefault(tag, attribute, collector, tagSet, [], {});
}
};
}

0 comments on commit 390d65f

Please # to comment.