Skip to content

Commit

Permalink
Upgrade to v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisPower1 committed Nov 5, 2024
1 parent 0afdea1 commit aace0e4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The extension will be activated as soon as an HTML file is opened. You can Downl
from [Vscode market place](https://marketplace.visualstudio.com/items?itemName=interjs.inter-intellisense) or from [releases](https://github.com/interjs/inter-intellisense/releases) of this repository. Keep in mind that if you
download the extension from the releases, you have to install it directly in vscode.

Check out the video demos by clicking on: <a href="https://drive.google.com/file/d/1A7jAsGBVqXHis-RUyUvBnUiyvKarx4lp/view" target="_blank">video demo 1</a>
Check out the videos demos by clicking on: <a href="https://drive.google.com/file/d/1A7jAsGBVqXHis-RUyUvBnUiyvKarx4lp/view" target="_blank">video demo 1</a>
and <a href="https://drive.google.com/file/d/1MbJhBcWRnUbLmM5mSzi9fVcUXZBMZ7NL/view" target="_blank">video demo 2</a>.

<img src="./images/sample.gif">
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "https://github.com/interjs/inter-intellisense.git"
},
"module": "esnext",
"version": "1.3.0",
"version": "1.3.1",
"engines": {
"vscode": "^1.57.1"
},
Expand Down
6 changes: 6 additions & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ export function runUnregisteredRefName(refName: string): string {
<!--ref = ${refName}-->
`

}

export function runInvalidTagForConditionalRendering(tag: string): string {

return `${tag} is a non-visual element, do not use the conditional attributes on them.`

}
20 changes: 17 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as vscode from "vscode";
import { commentsParser, parserInfoInterface } from "./htmlcommentsparser";
import { parseHTML } from "./hop/index"
import { runHasNoreThanOneConditionalAttrsError, runIllegalValueError, runInvalidConditionalAttrNameError, runInvalidElseValueWarning, runUnregisteredConditionalPropError, runUnregisteredRefName } from "./errors"
import { runHasNoreThanOneConditionalAttrsError, runIllegalValueError, runInvalidConditionalAttrNameError, runInvalidElseValueWarning, runInvalidTagForConditionalRendering, runUnregisteredConditionalPropError, runUnregisteredRefName } from "./errors"

const extensionVersion: string = "1.3.0";
const extensionVersion: string = "1.3.1";
const openTagRegExp = /<(:?[A-Z]+)>/gi;
interface configI {

Expand Down Expand Up @@ -102,11 +102,25 @@ function findErrorInConditionalRendering(documentContent: string): configI[] {
const { name, nameStart, nameEnd, value, valueSart, valueEnd } = attr
const { tag, tagStart, tagEnd } = element;
const refReg = /\{(:?\s+)*(:?[A-Z]+)(:?\s+)*\}/gi;
//The content of these tags is non-visual
//So, why on earth someone would use the conditional rendering attributes on them?
//If that is the case we must warn the developer.
const nonVisualTags: Set<string> = new Set(["script", "style"]);


if (conditionalAttrsNames.has(name)) {
conditionalAttrsCounter++;

if (conditionalAttrsCounter > 1) {
if (nonVisualTags.has(tag)) {

errorsCollection.push(
generateConditionalConfig(tagStart, tagEnd, runInvalidTagForConditionalRendering(tag))
)
break;

}

else if (conditionalAttrsCounter > 1) {
errorsCollection.push(
generateConditionalConfig(tagStart, tagEnd, runHasNoreThanOneConditionalAttrsError(tag))
)
Expand Down

0 comments on commit aace0e4

Please sign in to comment.