GithubHelp home page GithubHelp logo

vincaslt / vscode-highlight-matching-tag Goto Github PK

View Code? Open in Web Editor NEW
150.0 5.0 16.0 545 KB

Highlights matching opening or closing tag in VSCode

Home Page: https://marketplace.visualstudio.com/items?itemName=vincaslt.highlight-matching-tag

License: MIT License

TypeScript 100.00%
vscode extension markup closing-tags

vscode-highlight-matching-tag's Introduction



If you're serious about your software development career,
There's no better platform to learn programming online than Educative.io.
Their courses are excellent and your subscription supports this plugin.

VSCode Highlight Matching Tag

GitHub repository: https://github.com/vincaslt/vscode-highlight-matching-tag

This extension highlights matching opening and/or closing tags. Optionally it also shows path to tag in the status bar. Even though VSCode has some basic tag matching, it's just that - basic. This extension will try to match tags anywhere: from tag attributes, inside of strings, any files, while also providing extensive styling options to customize how tags are highlighted.

Officially supported markup: HTML and JSX. Other flavors (XML, Vue, Angular, PHP) should work, but there are no guarantees. Feel free to report the issues on them anyway.

Features

demo

breadcrumbs

Extension Settings

You can override any default settings with your own values. The plugin supports workspace settings as well as global user settings.

Variable Default Description
highlight-matching-tag.enabled true Enables/disables the highlighting and status bar
highlight-matching-tag.showPath true Enables/disables showing path to tag in status bar (e.g. div > p > a)
highlight-matching-tag.showRuler true Enables/disables showing highlighted tag pair in ruler section
highlight-matching-tag.highlightSelfClosing false Should self-closing tags be highlighted too (can be useful for multiline self-closing tags)
highlight-matching-tag.highlightFromContent false Whether to highlight matching tag from inside the tag content
highlight-matching-tag.highlightFromName true Whether to highlight matching tag from the tag name
highlight-matching-tag.highlightFromAttributes true Whether to highlight matching tag from the tag attributes
highlight-matching-tag.noDefaultEmptyElements false Don't use default HTML empty elements
highlight-matching-tag.customEmptyElements null Custom empty elements in addition to the default HTML empty elements
highlight-matching-tag.styles { opening: { name: { underline: 'yellow' } } } Custom styling configuration, see Styling Options

Styling Options

By default, the tag pair's names are underlined with a yellow line. The setting looks like this:

"highlight-matching-tag.styles": {
  "opening": {
    "name": {
      "underline": "yellow"
    }
  }
}

Custom styling

Version 0.8.0 of this extension introduces new styling options, but old custom settings can be automatically migrated after update.

Now you can change highlighting styles by providing your own style in User Settings (JSON) as highlight-matching-tag.styles. The setting accepts an object with two fields:

  • opening: Style - opening tag styles when highlighting (or both, if closing style is not provided)
  • closing: Style - closing tag styles, optional
  • inner: Decoration - styles of text between opening and closing tags, optional

Style objects can have any combination of fields defining styles for parts of the tag:

  • name: Decoration - decoration for name part of tag
  • left: Decoration - decoration for left side of tag (character <)
  • right: Decoration - decoration for right side of tag (character >)
  • full: Decoration - decoration for the whole tag (including < and >)

Decoration objects define tag's style with optional fields:

  • highlight: string - background color (e.g. "#666666")
  • underline: string - underline color
  • surround: string - surrounding border's color
  • custom: vscode.DecorationRenderOptions - custom css rules for styling (vscode.DecorationRenderOptions). This is basically an object with camelCase CSS rules. It can also accept different styles for light or dark color themes.

Colors used in gutter are the same as the ones used for highlighting/underlining, or yellow by default for custom rules. You can change them by setting: overviewRulerColor decoration option to the color that you want.

Styling Examples

This is the old version's style, with the new styling options:

"highlight-matching-tag.styles": {
  "opening": {
    "left": {
      "custom": {
        "borderWidth": "0 0 0 1px",
        "borderStyle": "dotted",
        "borderColor": "white",
        "borderRadius": "5px",
        "overviewRulerColor": "white"
      }
    },
    "right": {
      "custom": {
        "borderWidth": "0 1px 0 0",
        "borderStyle": "dotted",
        "borderColor": "white",
        "borderRadius": "5px",
        "overviewRulerColor": "white"
      }
    }
  }
}

Result:

old


This is an example showing off different styling options:

"highlight-matching-tag.styles": {
  "opening": {
    "left": {
      "underline": "yellow"
    },
    "right": {
      "surround": "#155FFA"
    },
    "name": {
      "highlight": "rgba(180, 20, 80, 0.3)"
    }
  },
  "closing": {
    "full": {
      "custom": {
        "dark": {
          "borderWidth": "0 0 1px 0",
          "borderColor": "white",
          "borderStyle": "solid",
          "borderRadius": "4px",
          "right": "10px"
        },
        "light": {
          "borderWidth": "0 0 1px 0",
          "borderColor": "brown",
          "borderStyle": "solid",
          "borderRadius": "4px",
          "right": "10px"
        }
      }
    }
  }
}

Result dark theme:

dark

Result light theme:

light

Commands

Used in Command Palette (Win/Linux: Ctrl+Shift+P; Mac: Cmd+Shift+P) by searching for command name. Can also be bound to Keyboard Shortcuts.

  • Jump to matching tag
  • Select contents of matching tag pair

Empty elements

The plugin is able interpret some unclosed tags as self-closing. By default they correspond with HTML empty elements (img, meta, link, etc.).

You can disable or extend them by changing highlight-matching-tag.noDefaultEmptyElements and/or highlight-matching-tag.customEmptyElements configuration options.

For example, this will additionally assume that custom and no-content elements are always self-closing and can't have any content:

"highlight-matching-tag.highlightSelfClosing": true,
"highlight-matching-tag.customEmptyElements": [
  "custom",
  "no-content"
]

Contributing

If you want to contribute to the development of the plugin, please consult the contribution guidelines.

vscode-highlight-matching-tag's People

Contributors

dependabot[bot] avatar egamma avatar kamasamak avatar keanu73 avatar mjbvz avatar stellarbeam avatar vincaslt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vscode-highlight-matching-tag's Issues

useless

  • Extension Name: highlight-matching-tag
  • Extension Version: 0.5.0
  • OS Version: Darwin x64 17.5.0
  • VSCode version: 1.27.2

We have written the needed data into your clipboard. Please paste:

not completely working with Vuejs

Hi
Thank you, buddy, this extension makes my life much easier.
I just wanted to report a little bug.
it does not work with tags that have Vuejs directives as attributes (or their parent tags).

screen-shot-2018-06-05-at-6 17 39-pm

Extension stopped working

Not able to find a conflicting plugin, but this extension just doesn't work anymore for me, on latest version of VSC and extension - Win.10

[Request] Select contents AND tag of matching tag pair

Hi, and thanks a lot for including my previous two requests so speedily.

Probably this will be my last one. I just saw recently the need of selecting not only the contents of matching tag pair but also the content+tag (basically the whole thing between matching pairs including the tag). Could it be possible to have a command for this as well? So to have two commands, the current for content only, and one for content+tag.

Thanks in advance!

Extension issue

  • Issue Type: Bug
  • Extension Name: highlight-matching-tag
  • Extension Version: 0.8.6
  • OS Version: Darwin x64 18.2.0
  • VSCode version: 1.30.2
{
	"activationTimes": {
		"startup": false,
		"codeLoadingTime": 213,
		"activateCallTime": 1,
		"activateResolvedTime": 8,
		"activationEvent": "onLanguage:javascriptreact"
	},
	"runtimeErrors": [
		{
			"name": "SyntaxError",
			"message": "Unexpected token, expected \",\" (17:1)"
		},
		{
			"name": "SyntaxError",
			"message": "Unterminated JSX contents (66:9)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (72:108)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (72:106)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (76:105)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (87:90)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (84:87)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (87:90)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (75:7)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (75:7)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (75:7)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (23:1)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (23:1)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (24:1)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (25:1)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (71:30)"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'startsWith' of undefined"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token, expected \",\" (112:15)"
		},
		{
			"name": "SyntaxError",
			"message": "JSX attributes must only be assigned a non-empty expression (78:69)"
		},
		{
			"name": "Error",
			"message": "DebounceError"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (119:3)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (125:3)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token, expected \",\" (121:10)"
		},
		{
			"name": "SyntaxError",
			"message": "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (72:3)"
		},
		{
			"name": "SyntaxError",
			"message": "Expected corresponding JSX closing tag for <ulc> (113:2)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (24:1)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token, expected \"}\" (36:101)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (23:16)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token, expected \"=\" (5:19)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (23:16)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (23:16)"
		},
		{
			"name": "SyntaxError",
			"message": "Unexpected token (91:32)"
		}
	]
}

File extension restrict

It's running just .html file exentesions.
I'm trying in .twig file extensions It's does not work.

High cpu usage - vscode unstable

Latest update makes CPU go crazy, and for whatever reason kills vs-code integrated emmet functionality, I tested and disabled all extensions and debugged one by one so I'm petty sure the issue is on this addon.

Invalid argument: Error: Invalid argument

Invalid argument: Error: Invalid argument at t._validatePosition (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:230616) at t._offsetAt (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:229960) at Object.offsetAt (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:228329) at getTextAfter (C:\Users\admin\.vscode-insiders\extensions\vincaslt.highlight-matching-tag-0.3.0\out\src\extension.js:5:60) at getClosingTag (C:\Users\admin\.vscode-insiders\extensions\vincaslt.highlight-matching-tag-0.3.0\out\src\extension.js:48:27) at findClosingTag (C:\Users\admin\.vscode-insiders\extensions\vincaslt.highlight-matching-tag-0.3.0\out\src\extension.js:67:46) at findCurrentTag (C:\Users\admin\.vscode-insiders\extensions\vincaslt.highlight-matching-tag-0.3.0\out\src\extension.js:87:16) at vscode.window.onDidChangeTextEditorSelection (C:\Users\admin\.vscode-insiders\extensions\vincaslt.highlight-matching-tag-0.3.0\out\src\extension.js:132:49) at e.invoke (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:30930) at e.fire (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:34737) at t.$acceptSelectionsChanged (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:347776) at t.e.handle (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:266430) at s (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:154933) at h (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:155610) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

Gutter indicators

It would be nice to have the matching tags also indicated in the gutter.

Support Multi-Root Workspace

Details can be found here.

Basically:

  1. Scope your configurations. They should preferably be resource -scoped where possible.
  2. Ensure calls to vscode.workspace.getConfiguration include the resource parameter.

Silently crashes on latest version of VS Code (1.15.1)

After update to 1.15.1 I noticed that after I change something in some React files, I have no longer Eslint or Prettier or some other extensions work correctly. I tried everything: uninstall and install again VS Code, on and off some extensions - nothing helped. I reduced my extensions list to a very small amount and by disabling one by one and checking the result I found who was the killer.

IDK if you could reproduce this issue, but here what I've got:

Linux Mint 18.1 Serena
VS Code 1.15.1

Tested in .js document in React component (~160 lines of code in the file including empty lines)

Console was silent.

Hope you'll fix this issue. For now I have to uninstall it because it totally ruins workflow.

Tags with dots in them break the parser

Hey @vincaslt ! I'm super stoked that you worked on a fix for #5 , but sadly I have to report that it seems to have introduced a different issue with JSX: now tags that have dots in them are breaking the parser. This happens when code imports a module and uses a qualified name to specify the tag:

import * as CV from './CommonView';

function foo() {
    return <CV.Whatever><span>Hi!</span></CV.Whatever>;
}

This is also breaking when any child has a tag that is prefixed by the parent tag, then followed by a dotted name after. I realize that's a confusing formulation, here's an example:

function foo() {
    return <X><X.Whatever /></X>;
}

In this example the <X> doesn't match with the </X>. I'm noticing this when using certain libraries like react.semantic-ui.com, which nests component classes, so you use stuff like:

function foo() {
    return <Form><Form.Button>Submit</Form.Button></Form>;
}

It think that neither of these behaviors happened before the latest release (i.e. the tags would match properly as long as there was no => confusing it), but I'm not 100% certain.

If you're not interested in supporting JSX I understand, I just thought I'd let you know!

vue tag pro

It will not works on this kind of tag like <div :xx="aa"></div>

Running Save Participants

Hi!,

I have run into a little bug with your package. On save, a new status pops up on the bottom tool bar saying 'Running Save Participants'. I think there is more but I can't make it out.

It only seems to happen on random files and so far only on large blade.php files.

Its causing my sftp sync package to not upload. I have uninstalled every single package except sftp and it went away. Once I re installed your package the issue came right back.

Have you ever run into this or is there a setting to disable whatever is happening?

Thank you!!
screen shot 2018-03-15 at 3 36 26 pm

The whole tag with attribute value(s) is highlighted!

This plugin makes the whole tag with attribute value(s) highlighted! This prevents in seeing the block of text I'm trying to copy/cut as the background color remains same. I'm using the following values -

"highlight-matching-tag.leftStyle": false,
"highlight-matching-tag.rightStyle": false,
"highlight-matching-tag.style": {
"borderRadius": "2px",
"backgroundColor": "#34495e",
},

PHP - some embedded html tags not matching

Thank you for your work on this extension!

I've found that some HTML tags embedded in PHP will not show as a match, while others do. For example, in the following PHP snippet from Generate Press theme, I get no match on the first occurring section and main tags. I inserted a pair of section tags towards the end as a test, and I do get a match on this final pair. It seems that when there is an HTML tag with PHP brackets within it, the tag matching fails.

<section id="primary" <?php generate_content_class(); ?>>
    <main id="main" <?php generate_main_class(); ?>>
        <?php do_action('generate_before_main_content'); ?>
        <?php do_action('generate_archive_title'); ?>
        <?php /* Start the Loop */ ?>
        <?php while (have_posts()) :
            the_post(); ?>
        <?php
                get_template_part('content', get_post_format());
            ?>
            <?php endwhile; ?>
            <?php generate_content_nav('nav-below'); ?>
            <?php else : ?>
            <?php get_template_part('no-results', 'archive'); ?>
            <?php endif; ?>
            <?php do_action('generate_after_main_content'); ?>
    </main>
    <section></section>
</section>
<?php
do_action('generate_sidebars');
get_footer();

When there is no match generated as it should, I sometimes get this console error:
[vincaslt.highlight-matching-tag] Cannot read property 'closing' of null: TypeError: Cannot read property 'closing' of null at findClosingTag (C:\Users\Name\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:44:12) at findOpeningTagByPosition (C:\Users\Name\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:74:35) at findOpeningTagByPosition (C:\Users\Name\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:78:20) at findOpeningTag (C:\Users\Name\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:82:12) at findCurrentTag (C:\Users\Name\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:90:11) at vscode.window.onDidChangeTextEditorSelection (C:\Users\Name\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:134:28) at e.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:57853) at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:59575) at e.$acceptSelectionsChanged (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:416364) at t.e.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:444633) at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:290588) at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:290278) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:289305 at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:291224 at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:58570 at e.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:28:57853

Thanks for your help!

Works very slowly in large files

It works quickly for me in small files. But in a JSX file with 1000+ lines of code, it takes about 2 seconds for it to highlight appropriate tag. Is this considered normal?

[Request] Highlight when not adjacent to or inside tag

Basically I would like to have matching tag highlighting when the cursor is somewhere in the content in the middle of the two matching tags (if nested tags, then the nearest two matching tags). Example:

<div><p>Some where in {cursor here} between</p></div>

So the <p> and </p> tags would be highlighted in this case.

Wonder if this is possible, as I could select the whole content inside the tag without traveling all the way adjacent to either of the two matching tags.

Thanks in advance!

Enable for other file extensions (erb)

Is it possible to configure this extension to work with other file extensions? I really like it for html and would like to get it working for html.erb file extensions.

I'm pretty new to VSCode so maybe there's a setting that I'm missing?

stops working whenever I open a file containing html being written by javascript

The extension stops working whenever I open a file containing html being written by javascript with un error:

[2018-10-24 11:12:48.433] [renderer1] [error] invalid syntax at line 195 col 132:

                                      '<input class="form-check-input" type="checkbox" disabled ' + (v.ativo == 1 ? 'checked' : '')  +
                                                                                                                                 ^: Error: invalid syntax at line 195 col 132:

                                      '<input class="form-check-input" type="checkbox" disabled ' + (v.ativo == 1 ? 'checked' : '')  +
                                                                                                                                 ^
at Lexer.next (C:\Users\Rutenio\.vscode\extensions\vincaslt.highlight-matching-tag-0.7.0\node_modules\moo\moo.js:397:13)
at Object.parseTags (C:\Users\Rutenio\.vscode\extensions\vincaslt.highlight-matching-tag-0.7.0\out\src\tagParser.js:79:36)
at vscode.window.onDidChangeTextEditorSelection (C:\Users\Rutenio\.vscode\extensions\vincaslt.highlight-matching-tag-0.7.0\out\src\extension.js:86:38)
at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:496)
at e.$acceptEditorPropertiesChanged (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:589:930)
at t._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:640:888)
at t._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:640:554)
at t._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:639:126)
at t._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:638:59)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:926
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:98:138
at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:496)
at a (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:213)
at Socket._socketDataListener (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:432)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at Pipe.onread (net.js:594:20)

Extension issue

  • Issue Type: Bug
  • Extension Name: highlight-matching-tag
  • Extension Version: 0.8.5
  • OS Version: Darwin x64 18.2.0
  • VSCode version: 1.30.1

⚠️ We have written the needed data into your clipboard. Please paste! ⚠️

High CPU usage

Up till now, the plugin will use almost 100% CPU and will stay in the process even after you've disabled it or close VSCode. You'll have to manually kill the process.

For now, I have to uninstall the plugin and looking at some other alternative.

Crash

I think this also causes #26

  • Extension Name: highlight-matching-tag
  • Extension Version: 0.4.4
  • OS Version: Darwin x64 17.3.0
  • VSCode version: 1.19.2

We have written the needed data into your clipboard. Please paste:

{
	"activationTimes": {
		"startup": true,
		"codeLoadingTime": 3,
		"activateCallTime": 0,
		"activateResolvedTime": 0,
		"activationEvent": "*"
	},
	"runtimeErrors": [
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'opening' of null"
		}
	]
}

Insanely huge files crash the extension

Insanely huge files with tens of thousand nested tags break the extension due to heap out of memory exception.

This is because matching of the tag starts at the beginning of the file, and only ends with the found match, keeping all other matches in memory. Intermediate matches should somehow not be all held in memory, but rather accessed on demand.

[Request] Jump between tags

Hi and thanks for an awesome extension!

One thing I am missing from Sublime's BracketHighlighter is that I can jump from one tag to another with one keyboard shortcut, and also select the content in between tags. VS Code's Bracket Pair Colorizer extension does this but for brackets only,

Could it be possible to implement this feature in your extension as well?

Thanks in advance!

cannot add "backgroundColor"

Hi, I can't add BackgroundColor, is it impossible to add background-color css?

here's my code

"highlight-matching-tag.leftStyle": { "borderWidth": "0 0 0 1px", "borderStyle": "dotted", "borderColor": "green", "borderRadius": "5px", "background-color": "yellow" }, "highlight-matching-tag.rightStyle": { "borderWidth": "0 1px 0 0", "borderStyle": "dotted", "borderColor": "green", "borderRadius": "5px", "background-color": "yellow" },

VSCode get frozen when editing a particular React code snippets

I'm using this extension with VSCode VIM, VSCode get frozen when the cursor moved inside of the JSX part of this code snippets:

class Game extends React.PureComponent<IProps> {
    render(): JSX.Element {
        const { isMobile }: IProps = this.props;
        return (
            <Carousel
                dots={!isMobile}
                slidesToShow={isMobile ? 1.5 : 3}
                slidesToScroll={isMobile ? 1.5 : 3}
                dotsClass="game-dots"
                arrows={!isMobile}
                prevArrow={<div>{'<'}</div>}
                nextArrow={<div>{'>'}</div>}
            >
            </Carousel>
        );
    }
}

Tested in VSCode Insiders, with only VSCode VIM & Highlight Matching Tag installed, no extra settings applied.

After disabling or uninstalling HMT VSCode won't get frozen, thus I think HMT causes this issue.

Interestingly, if I did one of the following adjustment, VSCode won't get frozen:

  • remove the curly braces {...} inside of prevArrow prop.
  • remove any prop before prevArrow prop.
  • or Disabling VSCode VIM

I know it's a very weird issue, but I hope it make sense.

Html Tag underline matching

Hello,
How can i have underlined Html Tag like in Sublime Text (BracketHighlighter plugin) ?
Best regards

It works

Hi @vincaslt .. you're right if it works .. not seen with the naked eye .. just highlights the opening tags. Thanks and good work.

Invalid syntax error

I am very regularly getting an invalid syntax error in CFML files. This most often occurs within <cfset tags, perhaps because the content does not follow the standard attribute/value structure of most tags. Here is a simple example of one of the lines that triggers it: <cfset someFileHash = hash(someFile, "SHA-512")>.

Here is the full error:

ERR invalid syntax at line XX col XXX:

<code line here>

at Lexer.next (C:\Users\<User>\.vscode\extensions\vincaslt.highlight-matching-tag-0.6.1\node_modules\moo\moo.js:397:13)
at Object.parseTags (C:\Users\<User>\.vscode\extensions\vincaslt.highlight-matching-tag-0.6.1\out\src\tagParser.js:79:36)
at Object.findMatchingTag (C:\Users\<User>\.vscode\extensions\vincaslt.highlight-matching-tag-0.6.1\out\src\tagMatcher.js:12:34)
at vscode.window.onDidChangeTextEditorSelection (C:\Users\<User>\.vscode\extensions\vincaslt.highlight-matching-tag-0.6.1\out\src\extension.js:80:36)
at e.fire (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:496)
at e.$acceptEditorPropertiesChanged (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:589:930)
at t._doInvokeHandler (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:640:888)
at t._invokeHandler (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:640:554)
at t._receiveRequest (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:639:126)
at t._receiveOneMessage (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:638:59)
at c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:926
at c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:98:138
at e.fire (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:496)
at a (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:213)
at Socket.n._socketDataListener (c:\Users\<User>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:432)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at Pipe.onread (net.js:594:20)

Considering the scope of this extension, it doesn't seem necessary that it would need to parse the content of the tag aside from identifying strings to ignore.

Cannot read property 'opening' of null

The extension is causing a lot of errors with the message "Cannot read property 'opening' of null". The stack trace indicates that it originates at getClosingTag (${User}\.vscode\extensions\vincaslt.highlight-matching-tag-0.4.4\out\src\extension.js:61:35), which I've found corresponds to this line.

Highlight breaks when *ngFor *ngIf is in the element tag

The extension is unable to find the matching pair, if any of the child element has *ngIf/ngFor on the element tag. '' may be the culprit.

VSCode version: 1.18.0

              <div> <!-- cant find -->
                    <div> <!-- cant find -->
                        <div class="some-class" *ngFor="let bar of bars"> <!-- cant find -->
                            <div class="foo"> <!--works!-->
                                <p>Hello</p> <!--works-->
                            </div>
                            <div class="bar"><!--works!-->
                                <p>Hello</p> <!--works-->
                            </div>
                        </div>
                    </div>
                </div>

all extensions freeze/hang each time open vue file (*.vue)

VS Code
Version: 1.27.2 (user setup)
Commit: f46c4c469d6e6d8c46f268d1553c5dc4b475840f
Date: 2018-09-12T16:17:45.060Z
Electron: 2.0.7
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
windows 8.1

highlight-matching-tag v 0.4.4

all extensions freeze/hang each time open vue file (*.vue)
after disable highlight-matching-tag extension.
everything work fine.

image

High CPU Usage

After a lot of debugging I found my "Code Helper" process was running at 100% CPU usage due to this plugin.

The issue seems to be an input tag with a ref attribute while working in a .vue file

<input ref="input" /> will cause this to hang while <input /> is just fine

Intellisense eventually stops working, keyboard stops working - not sure if this extension or not

  • Extension Name: highlight-matching-tag
  • Extension Version: 0.4.4
  • OS Version: Windows_NT x64 10.0.16299
  • VSCode version: 1.19.2

We have written the needed data into your clipboard. Please paste:

{
	"activationTimes": {
		"startup": true,
		"codeLoadingTime": 1,
		"activateCallTime": 0,
		"activateResolvedTime": 0,
		"activationEvent": "*"
	},
	"runtimeErrors": [
		{
			"name": "TypeError",
			"message": "Cannot read property 'closing' of null"
		}
	]
}

"arrow functions" in jsx confuse the tag matcher

For example:

<div onClick={() => foo()}>
</div>

The tag matcher thinks the tag ends at the > in () =>. usually this doesn't matter much, but it can when you have a self-closing tag:

<div>
<div onClick={() => foo()} />
</div>

Because of that inner div's arrow function, the extension thinks that the inner div is a regular tag instead of a self-closing tag, and thus shows the bottom </div> as the matched tag.

I suppose the easiest solution would be to count {}s, ()s, and probably ""s inside of tag attributes and only honor a > as tag syntax if all other brackets are balanced.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.