Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

51 wiersze
1.4 KiB

  1. Hacking on zsh-syntax-highlighting itself
  2. =========================================
  3. This document includes information for people working on z-sy-h itself: on the
  4. core driver (`zsh-syntax-highlighting.zsh`), on the highlighters in the
  5. distribution, and on the test suite. It does not target third-party
  6. highlighter authors (although they may find it an interesting read).
  7. The `main` highlighter
  8. ----------------------
  9. The following function `pz` is useful when working on the `main` highlighting:
  10. pq() {
  11. (( $#argv )) || return 0
  12. print -r -l -- ${(qqqq)argv}
  13. }
  14. pz() {
  15. local arg
  16. for arg; do
  17. pq ${(z)arg}
  18. done
  19. }
  20. It prints, for each argument, its token breakdown, similar to how the main
  21. loop of the `main` highlighter sees it.
  22. Testing the `brackets` highlighter
  23. ----------------------------------
  24. Since the test harness empties `ZSH_HIGHLIGHT_STYLES` and the `brackets`
  25. highlighter interrogates `ZSH_HIGHLIGHT_STYLES` to determine how to highlight,
  26. tests must set the `bracket-level-#` keys themselves. For example:
  27. ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
  28. ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
  29. BUFFER='echo ({x})'
  30. expected_region_highlight=(
  31. "6 6 bracket-level-1" # (
  32. "7 7 bracket-level-2" # {
  33. "9 9 bracket-level-2" # }
  34. "10 10 bracket-level-1" # )
  35. )
  36. IRC channel
  37. -----------
  38. We're on #zsh-syntax-highlighting on freenode.