Commit graph

65 commits

Author SHA1 Message Date
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
Christian Clason
5b90ea2aba feat(locals)!: switch to upstream captures 2024-01-19 16:58:37 +01:00
Ananda Umamil
aab2274e2c
feat(javascript): highlight parameter destructuring patterns 2023-07-01 05:25:05 -04:00
William Mathewson
e7808349a5 Expand locals to include properties and methods
The previous locals were lacking a few locals related to JS classes.
This expands the locals to include properties defined on classes (e.g.
`this.foo = "bar"` or `static #targets`) as both vars & references, as
well as private methods on classes (e.g. `#bar(x) { x }` and `#bar(y)`).
2022-11-25 18:24:11 +01:00
GitHub
9dd1065ebe highlights(javascript): "?." -> optional_chain 2022-08-20 10:42:19 +02:00
Stephan Seitz
788d212ab3
locals(js,ts): Add parameters again (#1231) 2021-04-28 07:39:14 -05:00
Stephan Seitz
082d2ef6e1
Add JS/TS parameters again (#1227)
* highlights(js): add parameters

* highlights(ts): add Typescript parameters
2021-04-23 07:20:51 -05:00
kiyan
3b8c2ea492 chore: create ecma base for use in js and ts which fixes jsx issues 2021-03-10 17:34:11 +01:00
elianiva
0bf8f58cd2 feat: use @ignore for comments and multiline strings 2021-03-01 23:28:53 +01:00
NullVoxPopuli
35369de25a Support the glimmer parser when the hbs template literal tag is used 2021-03-01 01:02:09 +01:00
Steven Sojka
39a2ea730d feat(javascript): add template string language injection 2021-02-11 20:41:35 +01:00
Steven Sojka
db033f7239 feat(javascript): move shorthand prop to property 2021-01-26 15:00:35 +01:00
elianiva
107d8b93c1 fix: js indent for object inside arguments 2021-01-20 19:01:33 +01:00
elianiva
9184cf3953 feat: added more indent queries 2021-01-14 14:43:04 +01:00
Steven Sojka
2e8621ff1a
feat(js): add regex injections (#834) 2021-01-07 09:04:43 -06:00
Stephan Seitz
40588da97c Remove usages of @embedded in highlights 2021-01-06 09:12:32 -05:00
delphinus
0fc8ea0035 Add lacked Javascript operators 2020-12-21 08:55:04 +01:00
Dave Lage
ff1c77b206
Javascript unary expression (#712)
* javascript: Move unary_expression matching.

* javascript: Move unary_expression matching.

* javascript: Update unary to operator

* javascript: Update qnary to be more specific
2020-12-12 14:47:09 -06:00
Luis Carlos Cruz Carballo
7cea298144 graphql: add injection to javascript and add comment query 2020-11-29 20:20:04 +01:00
rockerBOO
a0b2fab978 javascript: Mark shorthand_property_identifier as variable 2020-11-27 22:20:32 +01:00
Dave Lage
9dd0e3b456
javascript: Add operator to / for division (#689) 2020-11-25 14:37:18 -06:00
Thomas Vigouroux
90d6ef96d2 fix(injections): update to new API 2020-11-23 21:08:09 +01:00
Dave Lage
3c07232d07
javascript: : in pairs as punctuation.delimiter (#684)
* javascript: : in pairs as punctuation.delimiter

* javascript: Change pair : to operator

* javascript: Set pair : as punctuation.delimiter

* javacscript: Move pair : to punctuation
2020-11-23 11:07:31 -06:00
rockerBOO
e59a789289 typescript: Add optional_parameter ? 2020-11-22 16:59:58 +01:00
Stephan Seitz
b4ea9dcd3c Javascript highlights: "..." -> punctuation.special 2020-11-09 20:21:20 +01:00
Stephan Seitz
aeb8c7d9fa JS highlights: highlight optional parameters 2020-11-09 20:21:20 +01:00
Steven Sojka
d9454afd93 feat(js): add jsdoc lang injection 2020-10-27 14:08:14 +01:00
Steven Sojka
e9afbef7ae
Merge pull request #585 from fffed/patch-1
js: add query for @parameter
2020-10-27 07:48:30 -05:00
fffed
37f57cc1ec
update comment case for simplefied notation 2020-10-27 08:37:09 +03:00
fffed
040d525946
add destructuring variations 2020-10-27 08:34:45 +03:00
Joosep Alviste
31fca67839 fix(javascript): fix constant variable highlight
The `@constant` query gets overwritten by the `@constructor` query. They
both query for variables starting with an uppercase letter, but the
`@constant` query took effect first.
2020-10-23 22:05:27 +03:00
Sam Bernheim
7f3276450b feat(folds): add catch_clause to js folds 2020-10-16 20:23:45 +02:00
sbernehim4
be2bb166c8 feat: add more javascript folds 2020-10-16 20:23:45 +02:00
fffed
9ea95e51fc
remove destructuring from @parameter 2020-10-16 07:48:29 +03:00
fffed
5e6716e4be
Add additional queries for @parameter for js 2020-10-15 21:34:52 +03:00
Thomas Vigouroux
c055899dc0 feat(queries): modeline mechanism for base langs
This implements https://github.com/neovim/neovim/pull/13059#issuecomment-704414189

This behaves like modelines and remove the use of the base_language map.
Also, this allows to fine-tune what we actually want to include per
query, which is better IMO.
2020-10-11 19:09:22 +02:00
Stephan Seitz
45397ebbd9 fix(highlights): Add TSNamespace highlight
Start adding highlights for
     - C++
     - Rust (including other scoped_identifier/scoped_type_identifier fixes)
     - JS (only namespace_import)

Addresses #516
2020-10-10 15:31:51 +02:00
Stephan Seitz
3362f45196 Remove textobjects module 2020-10-04 14:20:20 +02:00
Stephan Seitz
7e3c4f8089 Add @keyword.operator for operators that are English words and add @exception for Java/JS 2020-09-19 07:30:49 +02:00
Stephan Seitz
bcf421b4e7 Fix #307: Use and document TSVariable/TSVariableBuiltin in all languages 2020-09-14 18:27:20 +02:00
Santos Gallegos
50991e370b Folds: rename query files to folds.scm to be consistent
We use plural names for all query files except folds.
2020-09-14 18:26:30 +02:00
Steven Sojka
2fd3236a92 fix(highlights): add missing js operators 2020-09-10 09:57:09 -05:00
kyazdani42
8d6c40ce24 fix using highlight query extension for every query type 2020-09-07 21:57:56 +02:00
Steven Sojka
02735aae55 feat(folds): add ts and js folds 2020-09-06 17:20:43 +02:00
Steven Sojka
fd356a2670 fix(locals): js add arrow function parameter as definition 2020-09-02 17:26:17 +02:00
Steven Sojka
a8ec43da64 fix(locals): add js namespace import as definition 2020-08-26 14:14:20 +02:00
Nathan Smith
05798284ff
@function.method -> @method 2020-08-17 19:30:04 -07:00
Steven Sojka
54b485ba7b
Merge pull request #319 from kyazdani42/feat/add-jsx-fragment-and-self-closing
add jsx fragment and jsx self closing element highlights
2020-08-17 14:25:53 -05:00
Steven Sojka
cab8717959 chore(highlights): remove is predicate usage 2020-08-17 19:27:35 +02:00
kiyan42
9c8c01dc0f add jsx fragment and jsx self closing element highlights 2020-08-17 18:35:15 +02:00