Skip to content

Commit

Permalink
v0.9.3 Fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vincaslt committed Jul 23, 2019
1 parent bb38046 commit 85eea96
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
@@ -1,13 +1,18 @@
# Change Log
All notable changes to the "higlight-matching-tag" extension will be documented in this file.

### 0.9.3

* Make attribute name rules stricter to better recognize opening tags
* Fix broken empty elements recognition

### 0.9.2

* New configuration options: `highlightFromName` and `hightlightFromAttributes`

### 0.9.1

* Allow customization of empty elements via configuration options.
* Allow customization of empty elements via configuration options
* Improve readme

### 0.9.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "highlight-matching-tag",
"displayName": "Highlight Matching Tag",
"description": "Highlights matching closing or opening tag",
"version": "0.9.2",
"version": "0.9.3",
"publisher": "vincaslt",
"icon": "icon.png",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/commands.ts
Expand Up @@ -10,7 +10,7 @@ export async function jumpToMatchingTag() {
return
}

const tagsList = parseTags(editor.document.getText())
const tagsList = parseTags(editor.document.getText(), config.emptyElements)
const position = editor.selection.active
const positionOffset = editor.document.offsetAt(position)

Expand Down Expand Up @@ -46,7 +46,7 @@ export function selectPairContents() {
return
}

const tagsList = parseTags(editor.document.getText())
const tagsList = parseTags(editor.document.getText(), config.emptyElements)
const position = editor.selection.active
const positionOffset = editor.document.offsetAt(position)

Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Expand Up @@ -87,7 +87,7 @@ export function activate(context: vscode.ExtensionContext) {

if (editorText !== editor.document.getText()) {
editorText = editor.document.getText()
tagsList = parseTags(editorText)
tagsList = parseTags(editorText, config.emptyElements)
}

// Tag breadcrumbs
Expand Down
2 changes: 1 addition & 1 deletion src/tagLexer.ts
Expand Up @@ -25,7 +25,7 @@ const blockState = (closingChar: string): moo.Rules => {
export default moo.states({
main: {
// Try to match anything that looks like a tag
tagOpening: { match: /<(?!\/)(?=>|\w)[^\/>\s\}\)\]\'\"]*(?=[^]*>)(?=\s|\/?>)/, push: 'inTag' },
tagOpening: { match: /<(?!\/)(?=>|\w)[\w-]*(?=[^]*>)(?=\s|\/?>)/, push: 'inTag' },

// Closing tag
tagClosing: /<\/\S*?>/,
Expand Down
6 changes: 6 additions & 0 deletions test/tagParser.test.ts
Expand Up @@ -617,5 +617,11 @@ suite('TagParser Tests', () => {
]
assert.deepEqual(parseTags(data, defaultEmptyElements), expected)
})

test('comparation not mistaken for tags', () => {
const data = 'if (i<2) return 3>2'
const expected: hmt.PartialMatch[] = []
assert.deepEqual(parseTags(data, defaultEmptyElements), expected)
})
})
})

0 comments on commit 85eea96

Please sign in to comment.