Skip to content

Commit

Permalink
fix(hover): don't try to show hover information on unknown items
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Lieben committed Apr 26, 2017
1 parent 1635b29 commit c547f5f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/HoverProviderFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export default class HoverProviderFactory {
}
break;
case ' ':
let elementName = /<(\w*)\b.*$/g.exec(text.substring(0, offset))[1];
let matches = /<(\w*)\b.*$/g.exec(text.substring(0, offset));
if (!matches || matches.length === 0) {
return;
}
let elementName = matches[1];
displayValue = `<${elementName} ${tag}="">`;

// fixes
Expand All @@ -67,7 +71,7 @@ export default class HoverProviderFactory {
if (tag.indexOf('.')) {
tag = tag.split('.')[0];
}

element = this.elementLibrary.elements[elementName] || this.elementLibrary.unknownElement;
let attribute = element.attributes.get(tag);
let event = element.events.get(tag);
Expand Down

0 comments on commit c547f5f

Please sign in to comment.