HiPhish / rainbow-delimiters.nvim

Rainbow delimiters for Neovim with Tree-sitter
https://gitlab.com/HiPhish/rainbow-delimiters.nvim
Apache License 2.0
490 stars 37 forks source link

feat(php): add support for php #21

Closed liljaylj closed 12 months ago

liljaylj commented 12 months ago

add php support

HiPhish commented 12 months ago

Can you please add a little PHP test file to test/highlight/php? It does not need to make sense (although it would be nice if it would compile), but it should contain an example for each of the patterns you have defined. Ideally with some levels of nesting so I can see the effect immediately.

HiPhish commented 12 months ago

Perfect, thank you.

liljaylj commented 12 months ago

sorry for bumping this pr after merge (is it worth creating new issue?). i found bad behavior in uncapsed_string

image

may it be the same issue as https://github.com/HiPhish/rainbow-delimiters.nvim/pull/22#issuecomment-1671395930

HiPhish commented 12 months ago

Probably. You can press a in the TS Playground to toggle the display of anonymous nodes. There you will see that all { and } are on the same level of ecapsed_string.

  assignment_expression [3, 8] - [3, 69]
    left: variable_name [3, 8] - [3, 19]
      "$" [3, 8] - [3, 9]
      name [3, 9] - [3, 19]
    "=" [3, 20] - [3, 21]
    right: encapsed_string [3, 22] - [3, 69]
      """ [3, 22] - [3, 23]
      string_value [3, 23] - [3, 29]
      "{" [3, 29] - [3, 30]
      variable_name [3, 30] - [3, 34]
        "$" [3, 30] - [3, 31]
        name [3, 31] - [3, 34]
      "}" [3, 34] - [3, 35]
      string_value [3, 35] - [3, 36]
      "{" [3, 36] - [3, 37]
      variable_name [3, 37] - [3, 41]
        "$" [3, 37] - [3, 38]
        name [3, 38] - [3, 41]
      "}" [3, 41] - [3, 42]
      string_value [3, 42] - [3, 49]
      "{" [3, 49] - [3, 50]
      variable_name [3, 50] - [3, 54]
        "$" [3, 50] - [3, 51]
        name [3, 51] - [3, 54]
      "}" [3, 54] - [3, 55]
      string_value [3, 55] - [3, 62]
      "{" [3, 62] - [3, 63]
      variable_name [3, 63] - [3, 67]
        "$" [3, 63] - [3, 64]
        name [3, 64] - [3, 67]
      "}" [3, 67] - [3, 68]
      """ [3, 68] - [3, 69]
  ";" [3, 69] - [3, 70]