Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix HTML hinting issues caused by new token types -- "error" and "tag error". #5489

Merged
merged 2 commits into from
Oct 14, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/language/HTMLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ define(function (require, exports, module) {
// So just return an empty tag info.
if (isPriorAttr &&
(!ctx.token.type ||
(ctx.token.type !== "attribute" && ctx.token.string.indexOf("<") !== -1))) {
(ctx.token.type && ctx.token.type !== "attribute" &&
ctx.token.type.indexOf("error") === -1 &&
ctx.token.string.indexOf("<") !== -1))) {
return createTagInfo();
}
return createTagInfo(ATTR_NAME, offset, tagName, attrName);
Expand Down Expand Up @@ -328,7 +330,8 @@ define(function (require, exports, module) {
// pos has whitespace before it and non-whitespace after it, so use token after
ctx.token = testToken;

if (ctx.token.type === "tag" || ctx.token.type === "error") {
if (ctx.token.type === "tag" ||
(ctx.token.type && ctx.token.type.indexOf("error") !== -1)) {
// Check to see if the cursor is just before a "<" but not in any tag.
if (ctx.token.string.charAt(0) === "<") {
return createTagInfo();
Expand Down Expand Up @@ -394,7 +397,8 @@ define(function (require, exports, module) {
}
}

if (ctx.token.type === "tag" || ctx.token.type === "error") {
if (ctx.token.type === "tag" ||
(ctx.token.type && ctx.token.type.indexOf("error") !== -1)) {
// Check if the user just typed a white space after "<" that made an existing tag invalid.
if (ctx.token.string.match(/^<\s+/) && offset !== 1) {
return createTagInfo();
Expand Down