vscode-phoenix icon indicating copy to clipboard operation
vscode-phoenix copied to clipboard

Incorrect syntax highlighting in heex `case` expression

Open lukaszsamson opened this issue 1 year ago • 3 comments

VSCode version: 1.85.1 vscode-phoenix version: 0.1.2

The following snippet is incorrectly highlighted

  <li>
    <strong>Some:</strong>
    <%= case some do %>
      <% map when is_map(map) -> %>
        <dl>
          Map
        </dl>
      <% other -> %>
        Other
    <% end %>
  </li>
Screenshot 2024-01-17 at 13 58 33

The tokens look OK, most likely it's unmatched bracket

Screenshot 2024-01-17 at 13 59 37 Screenshot 2024-01-17 at 14 00 04

lukaszsamson avatar Jan 17 '24 13:01 lukaszsamson

it appears the -> isn't being marked as non-bracket

RedCMD avatar Jan 17 '24 17:01 RedCMD

This line is the culprit here https://github.com/phoenixframework/vscode-phoenix/blob/f98531327c04210d6d04affd35cac4cfa00fa805/language-configuration.json#L6 as it defines < > as bracket pair.

This may not be easy to fix without removing it. AFAIK VSCode does not support negative matches nor regex on brackets https://code.visualstudio.com/api/language-extensions/language-configuration-guide#brackets-definition

I had similar issues in https://github.com/elixir-lsp/vscode-elixir-ls/issues/353

lukaszsamson avatar Jan 17 '24 18:01 lukaszsamson

you can disable symbols being used as brackets with "unbalancedBracketScopes" for example:

"unbalancedBracketScopes": [
	"invalid.illegal.characters-not-allowed-here.html",
	"entity.other.attribute-name.html"
]

image

RedCMD avatar Jan 17 '24 18:01 RedCMD