Commit Graph

177 Commits (c2c1280f02b83a468da67d88350c199915427535)

Author SHA1 Message Date
Blaž Hrastnik e22dbf102f Use filter_map rather than flat_map 2022-01-23 16:04:12 +09:00
Blaž Hrastnik 2f4a9fea03 Set byte range on cursor again 2022-01-23 16:04:12 +09:00
Blaž Hrastnik 24314bd844 Only call scopes.load() once 2022-01-23 16:04:12 +09:00
Blaž Hrastnik 4b0205f690 Resolve some outdated comments 2022-01-23 16:04:12 +09:00
Blaž Hrastnik 9508684031 fix: Skip modifying the root layer range, it always covers 0..max 2022-01-23 16:04:12 +09:00
Blaž Hrastnik 7315f6f3e4 Update range markers so we can determine which layers can be reused 2022-01-23 16:04:12 +09:00
Blaž Hrastnik 8a53e34e66 Try to reuse an existing layer based on layer.ranges 2022-01-23 16:04:07 +09:00
Blaž Hrastnik 72eb2ce1f1 Ignore layers without highlight captures, avoid cloning ranges 2022-01-23 16:00:24 +09:00
Blaž Hrastnik 5135fa37eb Reuse the source slice between layers 2022-01-23 16:00:24 +09:00
Blaž Hrastnik 53d881f172 Store theme scopes on the loader, this way theme isn't passed around 2022-01-23 16:00:24 +09:00
Blaž Hrastnik 6728e44490 syntax: Split parsing and highlighting 2022-01-23 16:00:24 +09:00
Kevin Sjöberg 3a34036310
Use the correct language ID for JavaScript & TypeScript (#1466)
* Use correct language ID for JavaScript/TypeScript

* Add missing slash

* Only calculate fallback when needed
2022-01-15 15:23:06 +09:00
Sebastian Neubauer 641255ccc8
Add llvm-mir highlighting (#1398)
* Add injection regex for more languages

To support embedding them in other languages like markdown.

* Add llvm-mir highlighting

LLVM Machine IR is dumped as yaml files that can embed LLVM IR and
Machine IR.

To support this, add a llvm-mir-yaml language that uses the yaml
parser, but uses different injections to highlight IR and MIR.

* Update submodule with fixed multiline comments

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-01-04 10:52:34 +09:00
Matouš Dzivjak 0e7d757869
feat(lsp): configurable diagnostic severity (#1325)
* feat(lsp): configurable diagnostic severity

Allow severity of diagnostic messages to be configured.
E.g. allow turning of Hint level diagnostics.

Fixes: https://github.com/helix-editor/helix/issues/1007

* Use language_config() method

* Add documentation for diagnostic_severity

* Use unreachable for unknown severity level

* fix: documentation for diagnostic_severity config
2021-12-25 14:32:43 +09:00
Gokul Soumya d08bdfa838 Use same name used in config files for langs in docs 2021-12-08 10:23:50 +09:00
Gokul Soumya a78b789406 Auto generate docs for language support 2021-12-08 10:23:50 +09:00
ath3 70c62530ee
Support env flags in shebang (#1224) 2021-12-04 00:13:24 +09:00
Blaž Hrastnik 2dbf966293 dap: Start working on runInTerminal support 2021-12-03 11:59:44 +09:00
Blaž Hrastnik d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 2021-11-21 20:06:45 +09:00
Omnikar a424ef4e20
Use default `languages.toml` if user's is invalid (#994) 2021-11-09 11:07:54 +09:00
Blaž Hrastnik f804ed3192 Make shebangs optional, they don't make sense outside of scripts 2021-11-09 10:57:08 +09:00
Blaž Hrastnik 549cdee561 Refactor shebang detection to reuse the loaded buffer 2021-11-09 00:30:34 +09:00
ath3 77dbbc73f9
Detect filetype from shebang line (#1001) 2021-11-09 00:19:44 +09:00
Blaž Hrastnik f2b709a3c3 Merge branch 'master' into debug 2021-11-07 00:28:19 +09:00
Gygaxis Vainhardt 0a38983ee3
Remove three transmutes from helix-core syntax.rs (#923) 2021-10-28 10:24:11 +09:00
Dmitry Sharshakov 6aa9838ea6
dap: support arrays as arguments 2021-10-24 17:24:18 +03:00
Kirawi 0cb5e0b2ca
log syntax highlighting init errors (#895) 2021-10-23 21:52:18 +09:00
Gokul Soumya 4ee92cad19
Add treesitter textobjects (#728)
* Add treesitter textobject queries

Only for Go, Python and Rust for now.

* Add tree-sitter textobjects

Only has functions and class objects as of now.

* Fix tests

* Add docs for tree-sitter textobjects

* Add guide for creating new textobject queries

* Add parameter textobject

Only parameter.inside is implemented now, parameter.around
will probably require custom predicates akin to nvim' `make-range`
since we want to select a trailing comma too (a comma will be
an anonymous node and matching against them doesn't work similar
to named nodes)

* Simplify TextObject cell init
2021-10-23 11:41:19 +09:00
Michael Davis 1766bdb9d4
clean up combined-injections comment (#880) 2021-10-19 13:08:06 +09:00
Blaž Hrastnik 83a8167402 Invert core -> dap dependency 2021-10-17 13:58:11 +09:00
Blaž Hrastnik 0a6b60085a Merge branch 'master' into debug 2021-10-17 13:51:56 +09:00
Midnight Exigent eedcea7e6b
Allow `language.config` (in languages.toml) to be passed in as a toml object (#807)
* allow language.config (in languages.toml) to be passed in as a toml object

* Change config field for languages from json string to toml object

* remove indents on languages.toml config

* fix: remove patch version from serde_json import in helix-core

* Use same tree-sitter-zig as upstream/master
2021-10-08 11:14:12 +09:00
Dmitry Sharshakov d943a51e3e
editor: add Node.js debugger 2021-09-26 21:36:06 +03:00
Dmitry Sharshakov bf53aff27d Merge branch 'master' into debug 2021-09-25 23:14:59 +03:00
Blaž Hrastnik 64e8f0017c ... 2021-09-16 16:04:32 +09:00
Blaž Hrastnik dd0b15e1f1 syntax: Properly handle injection-regex for language injections 2021-09-16 15:50:14 +09:00
Blaž Hrastnik 066367c0a4 fix: Need to reset set_byte_range in case cursor_ref is reused. 2021-09-13 17:44:57 +09:00
Dmitry Sharshakov 413e477dc2 lldb: use stdio transport by default 2021-09-06 13:49:31 +03:00
Blaž Hrastnik 4ac29434cb syntax: Add go & rust locals, improve tree-sitter error message 2021-09-06 18:13:52 +09:00
Blaž Hrastnik 3cb95be452 Update tree-sitter to 0.20
0.20 includes querying improvements, we no longer have to convert
fragments to strings but can return an iterator of chunks instead.
2021-09-06 13:21:53 +09:00
Dmitry Sharshakov b42631942b
Defaults in completions, better schema 2021-08-29 14:51:47 +03:00
Dmitry Sharshakov e315394631
Merge remote-tracking branch 'origin/master' into debug 2021-08-28 14:59:26 +03:00
Blaž Hrastnik 9d4c301563 Reduce State use a bit further
This is a legacy type that should be fully removed.
2021-08-26 09:21:07 +09:00
Dmitry Sharshakov c463142e5e
Create new debugger config format 2021-08-24 11:56:18 +03:00
Dmitry Sharshakov b6b99b2487
config: minor fixes 2021-08-23 17:26:12 +03:00
Dmitry Sharshakov f55a012fb7
editor: add debug session config 2021-08-23 16:56:41 +03:00
Dmitry Sharshakov c5b210df59
Add debug-adapter field to languages.toml 2021-08-23 16:48:06 +03:00
Blaž Hrastnik 7c834d6506 fix: tree sitter rendering glitches with multiple selection edits 2021-08-13 13:15:53 +09:00
Blaž Hrastnik 0fdb626c2c Remove embed_runtime feature
It's no longer practical to maintain. Closes #451
2021-07-30 16:27:22 +09:00
Nathan Vegdahl 43594049dd Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-23 17:23:16 -07:00
fossdd d4bd5b3766 The item `fmt` was imported redundantly
Fixed warning:

```
warning: the item `fmt` is imported redundantly
  --> helix-core/src/syntax.rs:98:9
   |
16 |     fmt,
   |     --- the item `fmt` is already imported here
...
98 |     use std::fmt;
   |         ^^^^^^^^
   |
```
2021-07-22 22:39:17 +09:00
Nathan Vegdahl e462f32723 Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-18 22:02:12 -07:00
Cor Peters cd65a48635
Made toggle_comments language dependent (#463)
* Made toggle_comments language dependent

* Fixed Test Cases

* Added clippy suggestion

* Small Fixes

* Clippy Suggestion

Co-authored-by: Cor <prive@corpeters.nl>
2021-07-19 01:33:38 +09:00
Cor Peters 0aa43902ca
Added option to provide a custom config file to the lsp. (#460)
* Added option to provide a custom config file to the lsp.

* Simplified lsp loading routine with anyhow

* Moved config to language.toml

* Fixed test case

* Cargo fmt

* Revert now-useless changes

* Renamed custom_config to config

Co-authored-by: Cor <prive@corpeters.nl>
2021-07-18 16:56:25 +09:00
Nathan Vegdahl a77274e8bb Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-17 10:49:03 -07:00
Blaž Hrastnik dd2903ff10 Dynamically load grammar libraries at runtime 2021-07-14 10:00:05 +09:00
Kirawi 084a8a9522
Rewritten Rust `highlights.scm` (#425)
* rewrote Rust highlights.scm

* wip

* wip

* wip

* wip

* fixed type highlighting

* wip

* rewrite again

* moved operators

* missing newline

* missing newline

* update book

* fix constructor highlighting

* fix constructor highlighting

* fix const highlighting

* better constructor highlighting

* remove dup, bug was my locals.scm file

* fixed docs

* merge

* fixed for highlighting

* add yield

* remove yield

* added yield back

* fixed yield highlighting

* unecessary
2021-07-09 01:11:20 +09:00
Nathan Vegdahl 85d5b399de Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-05 20:27:49 -07:00
Nathan Vegdahl 22dca3b111 Allow last line in file to lack a line break character. 2021-07-01 23:36:09 -07:00
Perry Thompson e177b27baf Add missing import 2021-07-02 12:10:15 +09:00
Nathan Vegdahl 9f62ad0715 Fixed last `unused` warning. 2021-07-01 19:06:52 -07:00
Nathan Vegdahl c389f41f14 Fix one of the two remaining warnings.
One of them was a lot more obvious than I thought.
2021-07-01 19:06:52 -07:00
Nathan Vegdahl 220bc85821 Fix all remaining warnings in helix-core except for two.
I'm not sure how to address them, because they look like they
might be bugs, and code is involved.  Will poke the relevant people.
2021-07-01 19:06:52 -07:00
Nathan Vegdahl b571f28641 Remove #[allow(unused)] from helix-core, and fix unused imports.
Still a bunch more warnings to fix in core, but it's a start.
2021-07-01 19:06:52 -07:00
Blaž Hrastnik d4e1ec339e Don't crash if diagnostics span past EOF 2021-06-28 14:50:35 +09:00
Blaž Hrastnik 1b102d5532 Extract the merge "operator" into helix-core 2021-06-27 23:28:22 +09:00
Blaž Hrastnik 44566ea812 Release 0.3.0 2021-06-27 13:27:47 +09:00
Nathan Vegdahl e686c3e462 Merge branch 'master' of github.com:helix-editor/helix into line_ending_detection
Rebasing was making me manually fix conflicts on every commit, so
merging instead.
2021-06-20 16:09:14 -07:00
Nathan Vegdahl 4efd6713c5 Work on moving code over to LineEnding instead of assuming '\n'.
Also some general cleanup and some minor fixes along the way.
2021-06-20 15:33:02 -07:00
wojciechkepka 6825e19509 Only reconfiure highlights when setting theme 2021-06-20 00:07:13 +09:00
wojciechkepka ce97a2f05f Add ability to change theme on editor 2021-06-20 00:07:13 +09:00
Wojciech Kępka 716067ba05 Add more ways to detect runtime directory 2021-06-12 17:26:41 +08:00
Blaž Hrastnik 278361a086 Only auto-format for certain languages
Fixes #53
Fixes #207
2021-06-12 10:20:37 +09:00
Ivan Tham 7cc13fefe9 Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
2021-06-10 22:00:08 +09:00
notoria 1a3a924634 Implement Debug for data structure as a feature 2021-06-10 22:00:08 +09:00
Blaž Hrastnik aebdef8257 Reuse a cursor from the pool if available (fixes #202) 2021-06-10 12:49:34 +09:00
Brian Dawn 5463a436a8 Return an error if we request an embedded file that does not exist.
This makes the load_runtime_file function behave like the non-embedded
one.
2021-06-06 10:49:17 +09:00
Brian Dawn e09b0f4eff Add a smoke test around loading runtime files.
This test makes sure we can read some amount of data from the runtime folder.
2021-06-06 10:49:17 +09:00
Brian Dawn f3db12e240 Simplify the load_runtime_file code.
Reduce the number of feature switches for the embed_runtime feature.
2021-06-06 10:49:17 +09:00
Brian Dawn 676719b361 Simplify creating pathbufs.
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-06 10:49:17 +09:00
Brian Dawn ae105812d6 Apply suggestions from code review
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-06 10:49:17 +09:00
Brian Dawn 62d181de78 Provide a feature flag to be able to embed the runtime folder.
These changes provide a new feature flag "embed_runtime" that when
enabled and built in release mode will embed the runtime folder into the
resulting binary.
2021-06-06 10:49:17 +09:00
Blaž Hrastnik 06d8d3f55f Try to detect language when document file path is set
Fixes #91
2021-06-04 11:03:40 +09:00
Blaž Hrastnik 094203c74e Update deps, introduce the new tree-sitter lifetimes 2021-05-28 00:00:51 +09:00
Blaž Hrastnik 4a9d1163e0 Hacky way to specify indent scopes per language via toml configs.
Can't do it via a scm query nicely because it returns an iterator over
all the matches, whereas we want to traverse the tree ourselves.

Can't extract the pattern data from a parsed query either.

Oh well, toml files for now.
2021-05-14 19:21:46 +09:00
Blaž Hrastnik cd1754f783 Fix runtime dir lookup. 2021-05-10 17:37:04 +09:00
Blaž Hrastnik 0f77f543e5 Determine runtime dir based on executable location or env override. 2021-05-10 01:02:53 +09:00
Blaž Hrastnik fd4fd12fa3 clippy lint 2021-05-06 17:20:00 +09:00
Blaž Hrastnik c1e5733b02 Remove the path specifier. 2021-04-09 18:57:46 +09:00
Blaž Hrastnik 71c06c11cb Import tree sitter queries. 2021-04-08 23:25:35 +09:00
Blaž Hrastnik f0d49d3ca4 hack: make queries load relative to source dir for now.
We want to provide a runtime dir later on.
2021-04-07 18:05:59 +09:00
Blaž Hrastnik 9eaef6e333 Fully drop State references. 2021-03-31 15:45:18 +09:00
Blaž Hrastnik b52474cf66 clippy lint 2021-03-27 12:14:58 +09:00
Blaž Hrastnik ad3325db8e minor: Remove a few unwraps. 2021-03-26 11:03:14 +09:00
Blaž Hrastnik 8b28bf2533 Fix broken test. 2021-03-25 16:53:32 +09:00
Blaž Hrastnik e3c4edae32 Add the machinery to load syntax config from TOML.
It's embedded into the binary at build time for now, but it's progress.
2021-03-25 15:26:25 +09:00
Blaž Hrastnik 06aca7691c clippy lint 2021-03-24 14:58:01 +09:00
Blaž Hrastnik 5e6716c89c Add tab_width and indent_unit config. 2021-03-22 13:53:36 +09:00
Blaž Hrastnik cbcacb1063 Merge some imports. 2021-03-22 12:40:07 +09:00
Blaž Hrastnik dbcc099f48 Move things out of state.rs. 2021-03-18 14:07:53 +09:00