rainbow-delimiters.nvim/CONTRIBUTING.rst

39 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2023-01-19 00:21:38 +01:00
.. default-role:: code
#####################
Contributor's guide
#####################
Adding support for a new language
#################################
Languages are supported through language-specific queries. Each language needs
at lease one query which matches the most common delimiters, usually `(`, `)`,
`[`, `]`, `{`, `}`, `<` and `>`. Read `:h rb-delimiters-custom-query` in the
2023-01-19 00:21:38 +01:00
manual first to understand how to write queries. Your query should meet the
following criteria:
- Named `rainbow-delimiters`
2023-11-12 21:58:28 +01:00
- Few `@delimiter` capture groups per `@container`; we do not want the default
query to be too vibrant
2023-01-19 00:21:38 +01:00
- Write one or more files in the language under `test/highlight/<lang>` (where
2023-11-12 21:58:28 +01:00
`<lang>` is the language); the standard file name is `regular.<ext>`
2023-01-19 00:21:38 +01:00
- The test code must have at least one instance of each pattern in the query
- The test code must not have parsing errors
- The test code should ideally have multiple levels of nesting
- The test code should compile and have no linter errors if that is feasible
(this is not a hard rule though)
If there are many test cases or if the code becomes too verbose feel free to
2023-11-12 21:58:28 +01:00
create multiple test files.
2023-11-21 12:32:35 +01:00
In addition to the queries and test file(s), please consider adding the type
annotations in `lua/rainbow-delimiters.types.lua` if you are adding queries
for a new language. You will need to update:
- `@class rainbow_delimiters.config.strategies`
- `@class rainbow_delimiters.config.queries`
2023-11-24 21:00:05 +01:00
- `@class rainbow_delimiters.config.priorities`
2023-11-21 12:32:35 +01:00
- `@alias rainbow_delimiters.language`