[vscode] Support for >2 type constraints

The previous implementation failed for this case because we attempted to
use repeated capture groups. When a capture group is repeated, like it
was in the now-removed `comma_separated` helper, only the last match is
retained. Thus, the regex template `(?:${capt_1})(?:,\\s*${capt_2})*`
will fail for a case like `:A, B, C`. This is because `A` will always
match `capt_1`, but both `B` and `C` will be caught by the repeated
`capt_2`, with only the last match being retained. The upshot is that
for cases with >2 matches, only the first and last will have the proper
names applied via tmLanguage's "captures" feature, leaving the middle
instance unhighlighted.

This change uses a different strategy: `type-constraints` are now their
own repository definition, always checked as the last possible
constituent pattern on a `type-constructor`. This allows for repeated
highlighting, allowing constraints lists to be of arbitrary length.

Change-Id: I41b16b8cd1414fcce4e02c66f1e2bf08f6451dd5
Reviewed-on: https://fuchsia-review.googlesource.com/c/fidl-misc/+/662244
Reviewed-by: Mitchell Kember <mkember@google.com>
3 files changed
tree: 950f1abb24be99ebad46ea1154f76d93f4c8a70b
  1. fidl-lsp/
  2. fidldev/
  3. fidlviz/
  4. mu-fidl/
  5. vscode-language-fidl/
  6. .gitignore
  7. .vscodeignore
  8. AUTHORS
  9. CONTRIBUTING.md
  10. LICENSE
  11. PATENTS
  12. README.md
README.md

Fuchsia Open Source Template Repository

This repository is a template that we will use when creating new open source repositories for Fuchsia.