FG
💻 Software🛠️ Developer ToolsMicrosoft

[php] Provide HTML tag matching/language service support

Fresh3 days ago
Mar 14, 20260 views
Confidence Score95%
95%

Problem

I don't know if it's just me but there's no support for HTML tag matching. If I click on `div`, every instance of `div` are highlighted instead of the closing `</div>`, which is a PITA.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Implement HTML Tag Matching in VSCode for PHP Development

Low Risk

The current behavior of Visual Studio Code does not differentiate between opening and closing HTML tags when highlighting. This is likely due to the language service not being configured to recognize the context of HTML tags properly, particularly when working within PHP files. The lack of proper language support for HTML within PHP files leads to confusion when navigating through nested tags.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Install HTML Language Support Extension

    To enhance HTML tag matching capabilities, install the 'HTML Language Support' extension from the Visual Studio Code Marketplace. This extension provides better context-aware highlighting for HTML tags.

    bash
    code --install-extension ecmel.vscode-html-css
  2. 2

    Configure VSCode Settings

    Update your VSCode settings to ensure that HTML tag matching works correctly within PHP files. Open the settings JSON file and add the following configuration to enable HTML language features in PHP.

    json
    { "files.associations": { "*.php": "html" } }
  3. 3

    Reload VSCode

    After installing the extension and updating the settings, reload Visual Studio Code to apply the changes. This can be done by closing and reopening the application or by using the command palette (Ctrl+Shift+P) and selecting 'Reload Window'.

  4. 4

    Test HTML Tag Highlighting

    Open a PHP file containing HTML code and click on an opening or closing tag. Verify that the corresponding matching tag is highlighted correctly. If the highlighting works as expected, the fix is successful.

Validation

To confirm the fix worked, open a PHP file with nested HTML tags and click on both opening and closing tags. Ensure that only the matching tag is highlighted, indicating that the HTML Language Support extension is functioning correctly.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

vscodeideeditorhtmlphp*extension-candidate