Commit graph

46 commits

Author SHA1 Message Date
tk-shirasaka
64b3d5e569
feat: add the php_only parser included in tree-sitter-php (#5876)
Add parser  `php_only` for PHP files without HTML embedded.
Make queries for combined parser `php` inherit from `php_only` (no extensions needed).

---------

Co-authored-by: shirasaka <tk.shirasaka@gmail>
2024-01-20 12:34:49 +00:00
Pham Huy Hoang
57a8acf0c4 chore: query formatting 2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455 feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
Pham Huy Hoang
107e61afb7 refactor: Remove all (ERROR) @error captures
As discussed in PR#5421, capturing `@error` is inconsistent, requiring
deep nesting (or priority) in order to correctly have red backgrounds to
it.

Some queries has this capture, some don't. For consistency purposes,
removing all of them is more preferable.

For re-enabling error, either add `(ERROR) @error` or `(ERROR _ @error)`
to your custom queries.
2023-10-25 18:18:50 +02:00
nsfisis
ad02fbcdfc
fix(php): highlight never as @type.builtin (#5522) 2023-10-14 21:04:06 +09:00
ObserverOfTime
d8e625df2d fix(php): heredocs injections & highlights 2023-08-12 17:34:15 +02:00
ShellCode33
d9e75a1736 queries/*/highlights.scm : remove @spell for strings 2023-08-07 16:39:40 +01:00
Ananda Umamil
4e26fec074 highlights(php): use lua-match?
Co-authored-by: Stephan Seitz <stephan.seitz@fau.de>
2023-02-12 01:23:19 -08:00
Ananda Umamil
0c6835ce5e highlights(php): remove typedef capture from as 2023-02-12 01:23:19 -08:00
Ananda Umamil
620b947218 highlights(php): fix @constant queries 2023-02-12 01:23:19 -08:00
Ananda Umamil
f83f05798a highlights(php): fix queries related to namespaces 2023-02-12 01:23:19 -08:00
Ananda Umamil
cf21f81274 highlights(php): instanceof operand 2023-01-28 11:32:57 +01:00
Ananda Umamil
a422d8508d Use @parameter capture 2023-01-28 01:45:54 +01:00
Ananda Umamil
2ed316ccf4 Apply the suggestion from @Lucario387
Co-authored-by: Lucario387 <hoangtun0810@gmail.com>
2023-01-28 01:45:54 +01:00
Ananda Umamil
fc596733ff highlights(php): declare directives and : 2023-01-28 01:45:54 +01:00
ObserverOfTime
0f866c15b4 highlights(php): use more specific groups 2022-11-26 13:17:51 +02:00
Nikita Sklyarov
795508b773 improve php variables and $this highlights 2022-11-25 18:22:25 +01:00
Laytan Laats
4303c1af69 highlights(php): add spell 2022-09-26 23:23:21 +01:00
lfenzo
c784720917 Split func/method definition from calls in several programming language queries 2022-08-03 12:05:30 -07:00
Matty Patatty
36ee4890c4
highlights(php): highlight more string types and escapes (#3226) 2022-07-27 07:48:01 +00:00
shirasaka
e4df4228b7 highlights(php): highlight readonly keyword 2022-06-04 17:53:59 +02:00
nsfisis
4d53ee5c05 highlights(php): improve highlight for attributes 2022-05-13 18:46:32 +02:00
Wilman Barrios
fd92e70c69 highlights(php): argument name as parameter 2022-03-17 21:09:15 +01:00
Wilman Barrios
689a078f91 highlights(php): add namespace aliasing name as type 2022-02-26 16:05:22 +01:00
Wilman Barrios
6d44cc06f4 highlights(php): highlight use declaration name as type 2022-02-19 20:00:31 +01:00
Wilman Barrios
c0783485e8 highlights(php): highlight traits names as type 2022-02-19 18:26:05 +01:00
Michael Härtl
983c46d55c fix(php) match magic and single letter constants 2022-01-19 19:17:01 +01:00
Michael Härtl
723d91e821 highlights(php): detect constructor calls on instantiation 2022-01-17 21:38:40 +01:00
Infectos
1da55c27cc fix(php): change query for @constructor group 2022-01-16 12:02:24 +01:00
Michael Härtl
749f72d351 highlights(php): fix and add missing highlights 2022-01-15 12:32:03 +01:00
Santos Gallegos
9025d96159 PHP: highlight unset
Similar to 57f855461a/grammar.js (L130-L132)

Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/2156
2021-12-23 21:02:51 +01:00
Lewis Russell
011ac894ec Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
2021-11-23 10:02:06 +01:00
Wilman Barrios
6cd6a29213
Fix method access using php nullsafe operator (#1773) 2021-08-30 22:06:09 -05:00
Wilman Barrios
1e4c846d01
highlights(php): add missings operators ?-> and => (#1729)
This will:

- add nullsafe `?->` as `@operator`
- add separator for associative arrays `=>` as `@operator`
2021-08-26 12:15:09 -05:00
Wilman Barrios
af96150a2d
highlights(php): add instanceof as @keyword (#1728) 2021-08-21 05:05:01 +00:00
antonk52
90f15d9bf7 feat(keywords) merge return and yield into keyword.return group 2021-07-04 21:49:17 +02:00
antonk52
bd9095e969 feat(keywords) add keyword.return & keyword.yield 2021-07-04 21:49:17 +02:00
Wilman Barrios
486c86f1cd
Add support for match expression in PHP (#1482) 2021-07-04 12:52:29 -05:00
tk-shirasaka
fe47dbe02b
Adds support for PHP's arrow funcion (#1427)
Co-authored-by: shirasaka <shirasaka@n-create.co.jp>
2021-06-28 10:10:58 -05:00
elianiva
88bd7f5cb3 fix(php): highlights function call expression 2021-05-19 19:41:21 +02:00
Stephan Seitz
4dcc3fb4b3 Update queries/php/highlights.scm
Co-authored-by: Santos Gallegos <stsewd@protonmail.com>
2021-05-17 13:27:58 +02:00
Stephan Seitz
fe8264e3f6 highlights/locals(php): rename type_name -> named_type 2021-05-17 13:27:58 +02:00
Stephan Seitz
bcf421b4e7 Fix #307: Use and document TSVariable/TSVariableBuiltin in all languages 2020-09-14 18:27:20 +02:00
Steven Sojka
ce43dbf54c fix(queries): use vim-match for non lua regexes 2020-08-16 18:31:56 +02:00
Shirasaka
dccc250add PHP: Update locals query 2020-08-05 21:28:50 +02:00
Shirasaka
f372e2ab87 Add PHP, TOML, and update HTML, javascript queries
- PHP         : Add highlights and locals query
- TOML        : Add highlights and locals query
- HTML        : Add scope
- javascript  : Add some scopes
2020-08-04 08:05:51 +02:00