Commit graph

820 commits

Author SHA1 Message Date
Daniel Ebert
2b02785f19 Improve code style for tree-sitter indentation.
Split extend logic into a separate file.
2022-10-11 16:48:04 +09:00
Triton171
05832f90cb Fix a bug that caused the indent for the line below to also be added in rare cases at the beginning of a file. 2022-10-11 16:48:04 +09:00
Triton171
1ceecbd062 Fix clippy warning. 2022-10-11 16:48:04 +09:00
Triton171
3ab9abb642 Add extend-indented and stop-extend captures for indent queries.
Improve and re-enable python indent queries.
2022-10-11 16:48:04 +09:00
Pascal Kuthe
543d75da23
do not reparse unmodified injections (#4146) 2022-10-11 15:48:12 +09:00
dependabot[bot]
7c33b9c76d
build(deps): bump smallvec from 1.9.0 to 1.10.0 (#4093)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-03 18:38:24 -05:00
Michael Davis
274f2ea459 Use requested direction for new textobject selection range
This changes the behavior of operations like `]f`/`[f` to set the
direction of the new range to the direction of the action.

The original behavior was to always use the head of the next function.
This is inconsistent with the behavior of goto_next_paragraph and makes
it impossible to create extend variants of the textobject motions.

This causes a behavior change when there are nested functions. The
behavior in the parent commit is that repeated uses of `]f` will
select every function in the file even if nested. With this commit,
functions are skipped.

It's notable that it's possible to emulate the original behavior by
using the `ensure_selections_forward` (A-:) command between invocations
of `]f`.
2022-10-03 10:44:08 -04:00
dependabot[bot]
e3fbeeb789
build(deps): bump unicode-general-category from 0.5.1 to 0.6.0 (#3990)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:36:40 -05:00
dependabot[bot]
fd4cdf0b1f
build(deps): bump once_cell from 1.14.0 to 1.15.0 (#3987)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:19:50 -05:00
Riccardo Binetti
888f4fef6f
Split helix_core::find_root and helix_loader::find_local_config_dirs (#3929)
* Split helix_core::find_root and helix_loader::find_local_config_dirs

The documentation of find_root described the following priority for
detecting a project root:
- Top-most folder containing a root marker in current git repository
- Git repository root if no marker detected
- Top-most folder containing a root marker if not git repository detected
- Current working directory as fallback

The commit contained in https://github.com/helix-editor/helix/pull/1249
extracted and changed the implementation of find_root in find_root_impl,
actually reversing its result order (since that is the order that made
sense for the local configuration merge, from innermost to outermost
ancestors).

Since the two uses of find_root_impl have different requirements (and
it's not a matter of reversing the order of results since, e.g., the top
repository dir should be used by find_root only if there's not marker in
other dirs), this PR splits the two implementations in two different
specialized functions.

In doing so, find_root_impl is removed and the implementation is moved
back in find_root, moving it closer to the documented behaviour thus
making it easier to verify it's actually correct

* helix-core: remove Option from find_root return type

It always returns some result, so Option is not needed
2022-09-23 17:04:07 +09:00
Blaž Hrastnik
1df32c917c diagnostics: Use Vec<Tag> instead of Option<Vec<Tag>> 2022-09-20 16:28:00 +09:00
Luke Cycon
64b0745413
Track source and tags in diagnostics (#3898) 2022-09-20 16:21:15 +09:00
dependabot[bot]
947ff63e6d
build(deps): bump textwrap from 0.15.0 to 0.15.1 (#3906)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-19 18:29:00 -05:00
dependabot[bot]
26c3c99330
build(deps): bump unicode-segmentation from 1.9.0 to 1.10.0 (#3903)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-19 18:28:38 -05:00
taupiqueur
a73e83ef4d
Fix typos (#3858) 2022-09-17 06:34:48 -05:00
Alexander Brevig
16b9a1841f
fix: map_err()? instead of unwrap (#3826) 2022-09-13 15:08:23 +09:00
dependabot[bot]
5e1296b888
build(deps): bump once_cell from 1.13.1 to 1.14.0 (#3715)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-05 18:33:01 -05:00
A-Walrus
c93d52cc8a
Fix cargo doc warnings, and add GitHub action to ensure it (#3650) 2022-09-03 09:58:16 -05:00
Michael Davis
4e4c6da3bf Add query-check xtask 2022-08-31 17:45:23 +09:00
Michael Davis
fa1dc7e508 tree-sitter: Prevent panic on loading queries 2022-08-31 17:45:23 +09:00
Michael Davis
4c789cfbda tree-sitter: Refactor lazy query loading
The code for loading queries can be shared between indent and
textobjects queries. In both cases we want to kick an error
message out to the logs.
2022-08-31 17:45:23 +09:00
A-Walrus
78189dd9c1
Fix extra selection with regex anchors (^,$) (#3598)
Also added a bunch of tests to ensure correct behaviour
2022-08-31 10:42:58 +09:00
Daniel S Poulin
7711db3a3a
Adjust m textobject description and minor code clarification (#3343)
* Update description of `m` textobject to its actual functionality

Sometime recently the functionality of `m` was changed to match the
nearest pair to the cursor, rather than the former functionality of
matching the pair only if the cursor was on one of the brace characters
directly.

* Rename surround methods to reflect that they work on pairs

The current naming suggests that they may work generally on any
textobject, whereas their implementation really focuses on pairs.

* Change description of m textobject to match actual functionality

The current implementation of `m` no longer merely looks at the pair
character the cursor is on, but actually will search for the pair
(defined in helix-core/src/surround.rs) that encloses the cursor, and
not the entire selection.

* Accept suggested wording change

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Prefix pair surround for consistency

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-08-17 10:41:59 +09:00
A-Walrus
d6e4fd15fc
Fix failing test with unicode-lines feature (#3455) 2022-08-17 10:37:34 +09:00
A-Walrus
cfa882557e
Fix nondeterministic highlighting (#3275)
* Fix nondeterministic highlighting

This is done by prefering matches in the begining, ie for
`keyword.function`, `keyword` is a better match than `function`.

* Use all positions and not just leftmost

Fixes possible edgecase with something like `function.method.builtin`
and the queries `function.builtin` and `function.method`

* Switch to bitmask for slightly better performance

* Make matches from the start of string

Also change comments to match new behaviour
2022-08-05 09:12:14 +09:00
Matthias Deiml
0ee2061102
Avoid copying fragments (#3136)
* Avoid copying fragments

* Add slice / slices method

* Better documentation for fragment and slice methods
2022-08-04 14:44:43 +09:00
Omnikar
afd292e3b9
Resolve clippy lints (#3307) 2022-08-04 14:32:59 +09:00
PiergiorgioZagaria
219d2c2515
Change default formatter for any language (#2942)
* Change default formatter for any language

* Fix clippy error

* Close stdin for Stdio formatters

* Better indentation and pattern matching

* Return Result<Option<...>> for fn format instead of Option

* Remove unwrap for stdin

* Handle FormatterErrors instead of Result<Option<...>>

* Use Transaction instead of LspFormatting

* Use Transaction directly in Document::format

* Perform stdin type formatting asynchronously

* Rename formatter.type values to kebab-case

* Debug format for displaying io::ErrorKind (msrv fix)

* Solve conflict?

* Use only stdio type formatters

* Remove FormatterType enum

* Remove old comment

* Check if the formatter exited correctly

* Add formatter configuration to the book

* Avoid allocations when writing to stdin and formatting errors

* Remove unused import

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2022-08-04 13:01:48 +09:00
Matthias Deiml
6b244e2fef
Exclude only named children without injection.include-children (#3129)
* Exclude only named children without injection.include-children

* Add injection.include-unnamed-children parameter
2022-08-03 19:18:17 +09:00
dependabot[bot]
f3a3b09337
build(deps): bump similar from 2.1.0 to 2.2.0 (#3293)
Bumps [similar](https://github.com/mitsuhiko/similar) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/mitsuhiko/similar/releases)
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/similar/compare/2.1.0...2.2.0)

---
updated-dependencies:
- dependency-name: similar
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-02 10:06:46 +09:00
Erasin
42115d02bc
Suport diagnostic code (#3096)
* add code for diagnostic.

This PR provides a solution to resolve #2994. missing Code Actions for lsp

* remote unused import
2022-07-26 10:26:50 +09:00
Philipp Mildenberger
b6c700fce9
Replace '; inherits <language>' in treesitter queries with <language> queries instead of appending them (#2470)
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-07-22 10:28:32 +09:00
Bob
8681fb6d9e
respect count in treesitter movement (#3058) 2022-07-14 08:08:09 +08:00
A-Walrus
1378b911b6
Fix some typos (#2978) 2022-07-05 21:49:54 -05:00
dependabot[bot]
f3e8b0f34b
build(deps): bump smallvec from 1.8.1 to 1.9.0 (#2976)
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-05 19:31:01 +09:00
dependabot[bot]
c88d736d5c
build(deps): bump once_cell from 1.12.0 to 1.13.0 (#2969)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-05 11:04:03 +08:00
Falco Hirschenberger
ed89f8897e
Add workspace and document diagnostics picker (#2013)
* Add workspace and document diagnostics picker

fixes #1891

* Fix some of @archseer's annotations

* Add From<&Spans> impl for String

* More descriptive parameter names.

* Adding From<Cow<str>> impls for Span and Spans

* Add new keymap entries to docs

* Avoid some clones

* Fix api change

* Update helix-term/src/application.rs

Co-authored-by: Bjorn Ove Hay Andersen <bjrnove@gmail.com>

* Fix a clippy hint

* Sort diagnostics first by URL and then by severity.

* Sort diagnostics first by URL and then by severity.

* Ignore missing lsp severity entries

* Add truncated filepath

* Typo

* Strip cwd from paths and use url-path without schema

* Make tests a doctest

* Better variable names

Co-authored-by: Falco Hirschenberger <falco.hirschenberger@itwm.fraunhofer.de>
Co-authored-by: Bjorn Ove Hay Andersen <bjrnove@gmail.com>
2022-06-30 18:16:18 +09:00
Triton171
e1b1a5ebc0
Fix edge-case in tree-sitter expand_selection selection command (#2877)
Co-authored-by: Triton171 <triton0171@gmail.com>
2022-06-25 13:12:30 -05:00
Saber Haj Rabiee
3dbad0442f
fixes showing the last prompt on empty input (#2870) 2022-06-24 17:14:48 +02:00
Blaž Hrastnik
19dccade7c
Merge pull request #2359 from dead10ck/test-harness
Integration testing harness
2022-06-21 18:59:02 +02:00
ath3
ce85b9716d
Enable shellwords for Windows (with escaping disabled) (#2767) 2022-06-22 01:48:01 +09:00
Blaž Hrastnik
458b89e21d
Merge branch 'master' into test-harness 2022-06-21 18:38:21 +02:00
Matthew Toohey
6a3f7f2c39
feat: make move_vertically aware of tabs and wide characters (#2620)
* feat: make `move_vertically` aware of tabs and wide characters

* refactor: replace unnecessary checked_sub with comparison

* refactor: leave pos_at_coords unchanged and introduce separate pos_at_visual_coords

* style: include comment to explain `pos_at_visual_coords` breaking condition

* refactor: use `pos_at_visual_coords` in `text_pos_at_screen_coords`

* feat: make `copy_selection_on_line` aware of wide characters
2022-06-22 01:36:36 +09:00
Skyler Hawthorne
ee705dcb33 use main application event loop
Use the Application's main event loop to allow LSP, file writes, etc
2022-06-18 23:54:03 -04:00
Skyler Hawthorne
0f3c10a021 Fix initial selection of Document in new view
When a new View of a Document is created, a default cursor of 0, 0 is
created, and it does not get normalized to a single width cursor until
at least one movement of the cursor happens. This appears to have no
practical negative effect that I could find, but it makes tests difficult
to work with, since the initial selection is not what you expect it to be.

This changes the initial selection of a new View to be the width of the
first grapheme in the text.
2022-06-18 23:54:03 -04:00
Skyler Hawthorne
502d3290fb improve test harness
* Use new macro syntax for encoding sequences of keys
* Make convenience helpers for common test pattern
* Use indoc for inline indented raw strings
* Add feature flag for integration testing to disable rendering
2022-06-18 23:54:03 -04:00
Gokul Soumya
0b8a00ac96
Refactor textobject node capture (#2741) 2022-06-12 00:39:21 +09:00
Blaž Hrastnik
b14c258a2c
prompt: If submitting empty prompt, use default (last used) 2022-06-07 00:23:40 +09:00
farwyler
f92a25a856
Passing extra formatting options to LSPs (#2635)
* allows passing extra formatting options to LSPs

- adds optional field 'format' to [[language]] sections in 'languages.toml'

- passes specified options the LSPs via FormattingOptions

* cleaner conversion of formatting properties

* move formatting options inside lsp::Client

* cleans up formatting properties merge
2022-06-05 19:50:57 +09:00
Ryan Russell
ae12c58f0f
Improve Readability (#2639) 2022-06-01 12:01:37 -05:00
Blaž Hrastnik
370a16d0f0
Update to ropey 1.5 2022-05-30 12:29:07 +09:00
Hugo
89c6e8aa94
Remove unnecessary unwrap (#2599)
`strip_prefix` will itself check whether the string starts with the
prefix, so the extra call to `starts_with` was unnecessary.
2022-05-29 11:13:21 +09:00
dependabot[bot]
da29527258 build(deps): bump once_cell from 1.10.0 to 1.12.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.10.0 to 1.12.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.10.0...v1.12.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 21:25:47 +09:00
Andrey Tkachenko
62fd1f6999
Include macro attributes to impls, structs, enums, functions etc. textobjects (#2494) 2022-05-20 10:19:46 +09:00
dependabot[bot]
0258cf45f3
build(deps): bump etcetera from 0.3.2 to 0.4.0 (#2486)
Bumps [etcetera](https://github.com/arzg/etcetera) from 0.3.2 to 0.4.0.
- [Release notes](https://github.com/arzg/etcetera/releases)
- [Commits](https://github.com/arzg/etcetera/commits)

---
updated-dependencies:
- dependency-name: etcetera
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-17 12:32:18 +09:00
EmmChriss
807cdc60bf
configurable lsp request timeout (#2405) 2022-05-11 09:54:35 +09:00
Matthew Toohey
a5f4925f53
feat(languages): git-ignore and git-attributes (#2397) 2022-05-05 08:47:28 -05:00
Vince Mutolo
f9baced216
add reflow command (#2128)
* add reflow command

Users need to be able to hard-wrap text for many applications, including
comments in code, git commit messages, plaintext documentation, etc. It
often falls to the user to manually insert line breaks where appropriate
in order to hard-wrap text.

This commit introduces the "reflow" command (both in the TUI and core
library) to automatically hard-wrap selected text to a given number of
characters (defined by Unicode "extended grapheme clusters"). It handles
lines with a repeated prefix, such as comments ("//") and indentation.

* reflow: consider newlines to be word separators

* replace custom reflow impl with textwrap crate

* Sync reflow command docs with book

* reflow: add default max_line_len language setting

Co-authored-by: Vince Mutolo <vince@mutolo.org>
2022-05-02 23:24:22 +09:00
Gokul Soumya
22ae1b92a6 Fix tests for surround primitives 2022-04-29 15:51:14 +09:00
Gokul Soumya
76175dbd6d Support m in surround delete and replace 2022-04-29 15:51:14 +09:00
Gokul Soumya
de15d70171 Add m textobject to select closest surround pair 2022-04-29 15:51:14 +09:00
chunghha
3a398eec56
fix typos (#2304) 2022-04-27 14:21:20 -05:00
Thomas
5d5b6bab9b
Add rulers option (#2060)
* Add color_column option

* Rename to ruler

Co-authored-by: DeviousStoat <devious@stoat.com>
2022-04-20 10:44:32 +09:00
Michael Davis
4e877de54d
Fix Golang textobject queries (#2153)
* log textobject query construction errors

The current behavior is that invalid queries are discarded silently
which makes it difficult to debug invalid textobjects (either invalid
syntax or an update may have come through that changed the valid set
of nodes).

* fix golang textobject query

`method_spec_list` used to be a named node but was removed (I think
for Helix, it was when updated to pull in the support for generics).
Instead of a named node for the list of method specs we have a bunch
of `method_spec` children nodes now. We can match on the set of them
with a `+` wildcard.

Example go for this query:

    type Shape interface {
       area() float64
       perimeter() float64
    }

Which is parsed as:

    (source_file
      (type_declaration
        (type_spec
          name: (type_identifier)
          type: (interface_type
            (method_spec
              name: (field_identifier)
              parameters: (parameter_list)
              result: (type_identifier))
            (method_spec
              name: (field_identifier)
              parameters: (parameter_list)
              result: (type_identifier))))))
2022-04-18 23:14:48 +08:00
Kirawi
c2a40d9d52
Add support for local language configuration (#1249)
* add local configuration

* move config loading to Application::new

* simplify find_root_impl
2022-04-18 12:10:51 +09:00
Ivan Tham
62283fdadb
Make textobject select last paragraph (#1992)
* Make textobject select last paragraph

Last paragraph shoud be selected if the cursor was placed on the
whitespace paragraph part and `map` is done, otherwise it would do
nothing useful, but now we select backwards for the last paragraph
which behaves similarly to kakoune, making `map` useful for the last
paragraph with whitespace. Example usecase is to copy and paste last
ledger cli paragraph quickly by `mapyp` to duplicate last entry.

* Fix typo in core textobject

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-04-13 10:02:53 +09:00
Michael Davis
19ff21eaa2
Remove usage of format ident feature from tests (#2028) 2022-04-08 21:26:50 +05:30
Danilo Spinella
6b80cb8a77
Fix toggle_comments command on multiple selections (#1882) 2022-04-05 10:01:58 +09:00
Roland Kovacs
d962e06e91
Add runtime language configuration (#1794) (#1866)
* Add runtime language configuration (#1794)

* Add set-language typable command to change the language of current buffer.
* Add completer for available language options.

* Update set-language to refresh language server as well

* Add language id based config lookup on `syntax::Loader`.
* Add `Document::set_language3` to set programming language based on language
  id.
* Update `Editor::refresh_language_server` to try language detection only if
  language is not already set.

* Remove language detection from Editor::refresh_language_server

* Move document language detection to where the scratch buffer is saved.
* Rename Document::set_language3 to Document::set_language_by_language_id.

* Remove unnecessary clone in completers::language
2022-04-05 09:56:14 +09:00
Ivan Tham
6fc6f87260
Fix next paragraph logic over muliple blank lines (#1951)
Fix #1928
2022-04-05 09:43:14 +09:00
Ivan Tham
ec21de0844 Add missing # back to test output 2022-04-03 00:46:53 +09:00
Ivan Tham
8b91ecde40 Rename _para to _paragraph 2022-04-03 00:46:53 +09:00
Gokul Soumya
64c2490f2d Refactor test print to be more readable 2022-04-03 00:46:53 +09:00
Ivan Tham
45b76db506 Change test mark from ^@ to #[|]# 2022-04-03 00:46:53 +09:00
Ivan Tham
8350ee9a0e Add paragraph textobject
Change parameter/argument key from p to a since paragraph only have p
but parameter are also called arguments sometimes and a is not used.
2022-04-03 00:46:53 +09:00
Ivan Tham
e2a6e33b98 Add next paragraph 2022-04-03 00:46:53 +09:00
Ivan Tham
8b02bf2ea8 Add (prev) paragraph motion
Also improved testing facility.

Fix #1580
2022-04-03 00:46:53 +09:00
antoyo
47fe739757
Jump to the next number on the line before incrementing (#1778)
* Jump to the next number on the line before incrementing

Partially fix #1645

* Refactor to avoid duplicating find_nth_next
2022-04-01 22:14:37 +09:00
Triton171
6bb2298391
Fix an issue that caused an empty indentation query to be used instead of using the fallback method of copying the indentation from the current line. (#1908)
Co-authored-by: Triton171 <triton0171@gmail.com>
2022-04-01 11:27:06 +09:00
Triton171
58758fee61
Indentation rework (#1562)
* WIP: Rework indentation system

* Add ComplexNode for context-aware indentation (including a proof of concept for assignment statements in rust)

* Add switch statements to Go indents.toml (fixes the second half of issue #1523)
Remove commented-out code

* Migrate all existing indentation queries.
Add more options to ComplexNode and use them to improve C/C++ indentation.

* Add comments & replace Option<Vec<_>> with Vec<_>

* Add more detailed documentation for tree-sitter indentation

* Improve code style in indent.rs

* Use tree-sitter queries for indentation instead of TOML config.
Migrate existing indent queries.

* Add documentation for the new indent queries.
Change xtask docgen to look for indents.scm instead of indents.toml

* Improve code style in indent.rs.
Fix an issue with the rust indent query.

* Move indentation test sources to separate files.
Add `#not-kind-eq?`, `#same-line?` and `#not-same-line` custom predicates.
Improve the rust and c indent queries.

* Fix indent test.
Improve rust indent queries.

* Move indentation tests to integration test folder.

* Improve code style in indent.rs.
Reuse tree-sitter cursors for indentation queries.

* Migrate HCL indent query

* Replace custom loading in indent tests with a designated languages.toml

* Update indent query file name for --health command.

* Fix single-space formatting in indent queries.

* Add explanation for unwrapping.

Co-authored-by: Triton171 <triton0171@gmail.com>
2022-03-31 00:08:07 +09:00
dependabot[bot]
3af0a7f3cb
build(deps): bump smartstring from 1.0.0 to 1.0.1 (#1873)
Bumps [smartstring](https://github.com/bodil/smartstring) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/bodil/smartstring/releases)
- [Changelog](https://github.com/bodil/smartstring/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bodil/smartstring/compare/v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: smartstring
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 09:07:07 +09:00
Slin Lee
79477ec6e7
Fix typo in query parsing error message (#1856) 2022-03-22 16:22:57 +05:30
Blaž Hrastnik
0b9620108d
ropey 1.4.1 fixes the issue 2022-03-17 12:03:15 +09:00
Blaž Hrastnik
2376fc875e
Temporarily turn on unicode-lines
Ropey's non-unicode lines impl has some bugs still
2022-03-17 10:53:50 +09:00
Blaž Hrastnik
16e2b2e36b
ropey 1.4.0 is out! 2022-03-17 09:29:47 +09:00
Blaž Hrastnik
f67e1ee172
Put esoteric line endings behind a feature flag 2022-03-17 09:29:47 +09:00
Blaž Hrastnik
b4a282fd36
Configure ropey to only use CR/CRLF line breaks by default
Fixes #1643
2022-03-17 09:29:47 +09:00
Blaž Hrastnik
59f05088b9
Optimize rendering by using Ropey::byte_slice
This avoids costly conversions via byte_to_char (which are then
reversed back into bytes internally in Ropey).

Reduces time spent in slice/byte_to_char from ~24% to ~5%.
2022-03-17 09:29:47 +09:00
Gokul Soumya
2b0835b295
Refactor :set to parse by deserializing values (#1799)
* Refactor :set to parse by deserializing values

* Implement serialize for idle_timeout config
2022-03-15 17:04:22 +09:00
Michael Davis
7044d7d804 rename '--fetch/build-grammars' flags into '--grammar fetch/build'
The old flags were a bit long. --grammar is also aliased to -g to make
it even easier.
2022-03-10 17:31:57 +09:00
Michael Davis
4fc991fdec migrate grammar fetching/building code into helix-loader crate
This is a rather large refactor that moves most of the code for
loading, fetching, and building grammars into a new helix-loader
module. This works well with the [[grammars]] syntax for
languages.toml defined earlier: we only have to depend on the types
for GrammarConfiguration in helix-loader and can leave all the
[[language]] entries for helix-core.
2022-03-10 17:31:57 +09:00
Michael Davis
08ee949dcb add 'use-grammars' to languages.toml
The vision with 'use-grammars' is to allow the long-requested feature
of being able to declare your own set of grammars that you would like.
A simple schema with only/except grammar names controls the list
of grammars that is fetched and built. It does not (yet) control which
grammars may be loaded at runtime if they already exist.
2022-03-10 17:31:57 +09:00
Michael Davis
db3470d973 ensure rust grammar is available in CI 2022-03-10 17:31:57 +09:00
Michael Davis
8081e9f052 replace all submodule documentation with flags documentation 2022-03-10 17:31:57 +09:00
Michael Davis
c1f677ff75 rename tree_sitter_library in LanguageConfig to 'grammar'
This is not strictly speaking necessary. tree_sitter_library was used by
just one grammar: llvm-mir-yaml, which uses the yaml grammar. This will
make the language more consistent, though. Each language can explicitly
say that they use Some(grammar), defaulting when None to the grammar that
has a grammar_id matching the language's language_id.
2022-03-10 17:31:57 +09:00
Michael Davis
eeb3f8e963 migrate helix-syntax crate into helix-core and helix-term
helix-syntax mostly existed for the sake of the build task which
checks and compiles the submodules. Since we won't be relying on
that process anymore, it doesn't end up making much sense to have
a very thin crate just for some functions that we could port to
helix-core.

The remaining build-related code is moved to helix-term which will
be able to provide grammar builds through the --build-grammars CLI
flag.
2022-03-10 17:31:57 +09:00
Michael Davis
c1f90a127b add tree-sitter sources to languages.toml
Here we add syntax to the languages.toml languge

    [[grammar]]
    name = "<name>"
    source = { .. }

Which can be used to specify a tree-sitter grammar separately of
the language that defines it, and we make this distinction for
two reasons:

* In later commits, we will separate this code from helix-core
  and bring it to a new helix-loader crate. Using separate schemas
  for language and grammar configurations allows for a nice divide
  between the types needed to be declared in helix-loader and in
  helix-core/syntax

* Two different languages may use the same grammar. This is currently
  the case with llvm-mir-yaml and yaml. We could accomplish a config
  that works for this with just `[[languages]]`, but it gets a bit
  dicey with languages depending on one another. If you enable
  llvm-mir-yaml and disable yaml, does helix still need to fetch and
  build tree-sitter-yaml? It could be a matter of interpretation.
2022-03-10 17:31:57 +09:00
Gokul Soumya
194b09fbc1
Add --health command for troubleshooting (#1669)
* Move runtime file location definitions to core

* Add basic --health command

* Add language specific --health

* Show summary for all langs with bare --health

* Use TsFeature from xtask for --health

* cargo fmt

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-03-08 14:25:46 +09:00
dependabot[bot]
b67686d318
build(deps): bump once_cell from 1.9.0 to 1.10.0 (#1768)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-08 08:55:23 +08:00
Blaž Hrastnik
fd02d1bf89
Fix tab rendering to use dynamic tab width
Each tab is just wide enough to round to the nearest tab stop.

Refs #1243
2022-03-04 11:01:33 +09:00
Blaž Hrastnik
5d14f56fa9
Reuse visual_coords_at_pos function in view 2022-03-04 09:36:31 +09:00
Blaž Hrastnik
376d99a51d
core: transaction: Resolve some TODOs 2022-03-03 17:04:25 +09:00
Gokul Soumya
e83cdf3fd3 Ensure non empty grouped nodes in textobject queries 2022-03-01 10:32:50 +09:00
Gokul Soumya
e6c36e82cf Allow capturing multiple nodes in textobject queries
Treesitter captures can contain multiple nodes like so:

```
(line_comment)+ @comment
```

This would match each line in a comment as a separate
`@comment` capture when what we actually want is the
whole set of contiguous `line_comment` nodes to be
captured under the `@comment` capture. This commit enables
this behaviour.
2022-03-01 10:32:50 +09:00
dependabot[bot]
0846822371
build(deps): bump smartstring from 0.2.10 to 1.0.0 (#1722)
Bumps [smartstring](https://github.com/bodil/smartstring) from 0.2.10 to 1.0.0.
- [Release notes](https://github.com/bodil/smartstring/releases)
- [Changelog](https://github.com/bodil/smartstring/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bodil/smartstring/compare/v0.2.10...v1.0.0)

---
updated-dependencies:
- dependency-name: smartstring
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 09:38:44 +09:00
Gokul Soumya
c15996aff5
Show surround delete and replace errors in editor (#1709)
* Refactor surround commands to use early returns

* Show surround delete and replace errors in editor
2022-02-28 17:56:39 +09:00
Skyler Hawthorne
a494f47a5d
Configurable auto pairs (#1624)
* impl auto pairs config

Implements configuration for which pairs of tokens get auto completed.

In order to help with this, the logic for when *not* to auto complete
has been generalized from a specific hardcoded list of characters to
simply testing if the next/prev char is alphanumeric.

It is possible to configure a global list of pairs as well as at the
language level. The language config will take precedence over the
global config.

* rename AutoPair -> Pair

* clean up insert_char command

* remove Rc

* remove some explicit cloning with another impl

* fix lint

* review comments

* global auto-pairs = false takes precedence over language settings

* make clippy happy

* print out editor config on startup

* move auto pairs accessor into Document

* rearrange auto pair doc comment

* use pattern in Froms
2022-02-25 17:36:54 +09:00
dependabot[bot]
77b1a4a768
build(deps): bump smartstring from 0.2.9 to 0.2.10 (#1692)
Bumps [smartstring](https://github.com/bodil/smartstring) from 0.2.9 to 0.2.10.
- [Release notes](https://github.com/bodil/smartstring/releases)
- [Changelog](https://github.com/bodil/smartstring/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bodil/smartstring/compare/v0.2.9...v0.2.10)

---
updated-dependencies:
- dependency-name: smartstring
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-22 10:01:14 +09:00
Gokul Soumya
ab2a0f325b Add object.movement for tree-sitter navigation 2022-02-15 14:04:46 +09:00
Gokul Soumya
966fbc5984 Add tree-sitter based function, class navigation 2022-02-15 14:04:46 +09:00
Gokul Soumya
4c424d5ee4
Refactor language config loading (#1658) 2022-02-15 01:41:53 +09:00
Blaž Hrastnik
bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2022-02-13 18:31:51 +09:00
Blaž Hrastnik
f88c077f99 Replace tendril with smartstring
Slightly smaller API surface, less dependencies.
2022-02-10 11:12:47 +09:00
Gokul Soumya
bf773db451 Show infobox with register contents 2022-02-10 10:52:06 +09:00
dependabot[bot]
718d4ab0f0
build(deps): bump unicode-segmentation from 1.8.0 to 1.9.0 (#1632)
Bumps [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/unicode-rs/unicode-segmentation/releases)
- [Commits](https://github.com/unicode-rs/unicode-segmentation/commits)

---
updated-dependencies:
- dependency-name: unicode-segmentation
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-08 07:50:29 +08:00
dependabot[bot]
05aeeaca0b
build(deps): bump unicode-general-category from 0.4.0 to 0.5.1 (#1609)
Bumps [unicode-general-category](https://github.com/yeslogic/unicode-general-category) from 0.4.0 to 0.5.1.
- [Release notes](https://github.com/yeslogic/unicode-general-category/releases)
- [Commits](https://github.com/yeslogic/unicode-general-category/compare/0.4.0...0.5.1)

---
updated-dependencies:
- dependency-name: unicode-general-category
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-01 12:24:23 +09:00
Ivan Tham
759b850859
Allow specifying file start position (#445)
Like helix-term/src/commands.rs:3426:15
2022-01-23 16:54:03 +09:00
Omnikar
f064894e57
Fix Clippy lints in tests (#1563)
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-01-23 16:37:23 +09:00
Blaž Hrastnik
4080341977 cargo fmt + clippy lint 2022-01-23 16:15:27 +09:00
Blaž Hrastnik
7c9ebd05b8 Remove some TODOs 2022-01-23 16:10:36 +09:00
Blaž Hrastnik
66a8612351 cleanup 2022-01-23 16:04:26 +09:00
Blaž Hrastnik
2302869836 fix: ensure_grapheme_boundary_next_byte needs to index at valid char 2022-01-23 16:04:26 +09:00
Blaž Hrastnik
11c3ba9350 Speed up ensure_next_boundary during render
This code:

    let start = ensure_grapheme_boundary_next(text, text.byte_to_char(start));
    let end = ensure_grapheme_boundary_next(text, text.byte_to_char(end));

Would convert byte to char index, but then internally immediately convert back
to byte index, operate on it, then convert it to char index.

This change reduces the amount of time spent in ensure_grapheme_boundary from
29% to 2%.
2022-01-23 16:04:12 +09:00
Blaž Hrastnik
9d41113ae0 Make Layer::parse take &mut tree_sitter::Parser 2022-01-23 16:04:12 +09:00
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
Michael Davis
392dfa0841
add select_next_sibling and select_prev_sibling commands (#1495)
* add select_next_sibling and select_prev_sibling commands

* refactor objects to use higher order functions

* address clippy feedback

* move selection cloning into commands

* add default keybindings under left/right brackets

* use [+t,]+t for selecting sibling syntax nodes

* setup Alt-{j,k,h,l} default keymaps for syntax selection commands

* reduce boilerplate of select_next/prev_sibling in commands

* import tree-sitter Node type in commands
2022-01-21 00:52:33 +09:00
dependabot[bot]
ed45d380eb
build(deps): bump smallvec from 1.7.0 to 1.8.0 (#1532)
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-18 09:42:07 +08:00
Skyler Hawthorne
56a9ce5d83
fix(auto_pairs): fix auto pairs with crlf (#1470)
Auto pairs were resulting in incorrect ranges in the resulting when the
line terminators are CRLF (i.e. Windows). It turns out this is because
when we were checking if the selection was a single-width cursor, it
incorrectly assumed that this would be a single char. This is not the
case, as a cursor can cover a multi-code point grapheme. Therefore,
we must instead explicitly work with and check graphemes to determine
if the cursor should move or extend the selection.

Fixes #1436
2022-01-18 00:39:12 +09:00
Blaž Hrastnik
e7eab95b94 Update to rust 1.58, fix a bunch of optional lints 2022-01-16 14:19:48 +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
Kirawi
8d273a5613
remove outdated note (#1485) 2022-01-12 13:11:00 +09:00
Michael Davis
939261fc07
expand_selection to current node with no children (#1454) 2022-01-09 00:31:05 +09:00
Matouš Dzivjak
2e02a1d6bc
feat(commands): shrink_selection (#1340)
* feat(commands): shrink_selection

Add `shrink_selection` command that can be used to shrink
previously expanded selection.

To make `shrink_selection` work it was necessary to add
selection history to the Document since we want to shrink
the selection towards the syntax tree node that was initially
selected.

Selection history is cleared any time the user changes
selection other way than by `expand_selection`. This ensures
that we don't get some funky edge cases when user calls
`shrink_selection`.

Related: https://github.com/helix-editor/helix/discussions/1328

* Refactor shrink_selection, move history to view

* Remove useless comment

* Add default key mapping for extend&shrink selection

* Rework contains_selection method

* Shrink selection without expand selects first child
2022-01-06 11:12:02 +09:00
Blaž Hrastnik
efaac6c5d3 Release 0.6 2022-01-04 18:54:37 +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
Triton171
4da050b4bb
Add basic indentation for languages without treesitter-based indentation rules (always use the indent of the current line for a new line). (#1341)
Fix several bugs in the treesitter indentation calculation.

Co-authored-by: Triton171 <triton0171@gmail.com>
2022-01-03 11:03:57 +09:00
Alexis Mousset
8a019b423f
Detect workspace root using language markers (#1370)
* Detect workspace root using language markers

* Avoid allocating root_markers

* Update helix-core/src/lib.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Update helix-core/src/lib.rs

Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com>

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com>
2021-12-31 17:06:54 +09:00
Matouš Dzivjak
bd2ab5be43
feat(commands): ensure_selections_forward (#1393)
* feat(commands): ensure_selections_forward

Add command that ensures that selections are in forward direction.

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

* Add keybinding for ensure_selections_forward

Add `A-:` keybinding for the ensure_selections_forward command.

* Re-use range.flip for flip_selections command
2021-12-29 18:17:46 +09:00
Matouš Dzivjak
4b0b1a5657
feat(ui): file encoding in statusline (#1355)
* feat(ui): file encoding in statusline

Display file encoding in statusline if the encoding
isn't UTF-8.

* Re-export encoding_rs from core

From there it can be imported by other mods
that rely on it.
2021-12-26 00:10:46 +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
Stuart Hinson
02f24e1214
Fix match brackets comment (#1346) 2021-12-24 07:27:31 +05:30
Skyler Hawthorne
5b4540fc2d
Auto pairs selection (#1254)
* use auto pairs with selections

Previously, the auto pairs code was converting the user selection into
its cursor form, and setting the transaction's selection to that cursor.
This has the effect of destroying the user's selection if they type a
pair character that gets auto completed.

This fixes the code to work with the user's selection, inserting auto
pairs where appropriate, but either keeping or extending the user's
selection.

* use movement::Direction instead of bool

* assume 0-width cursor is forward
2021-12-21 18:17:33 +09:00
dependabot[bot]
5dfdc95f6f
build(deps): bump once_cell from 1.8.0 to 1.9.0 (#1322)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-21 08:48:53 +09:00
Kirawi
02fc52f6d5
Apply recent nightly suggestions (#1286)
array iterators are now implicit
2021-12-18 14:57:49 +09:00
Skyler Hawthorne
94535fa013
Add auto pairs for same-char pairs (#1219)
* Add auto pairs for same-char pairs

* Add unit tests for all existing functionality
* Add auto pairs for same-char pairs (quotes, etc). Account for
  apostrophe in prose by requiring both sides of the cursor to be
  non-pair chars or whitespace. This also incidentally will work for
  avoiding a double single quote in lifetime annotations, at least until
  <> is added
* Slight factor of moving the cursor transform of the selection to
  inside the hooks. This will enable doing auto pairing with selections,
  and fixing the bug where auto pairs destroy the selection.

Fixes #1014
2021-12-14 00:58:58 +09:00
ath3
3156577fbf
Open files with spaces in filename, allow opening multiple files (#1231) 2021-12-12 21:13:33 +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
Jason Rodney Hansen
539c27e3f5 Remove Clone derive 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
0b7911d921 Remove FormatError 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
584a31cd90 Used checked_add for years and months 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
c74cd48f38 Cleanup 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
febee2dc0c No need to clone format 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
37e484ee38 Add support for time and more date formats 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
c9641fcced Add Increment trait 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
2a0c685a78 Remove dependency on gregorian crate 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
64afd54654 Cleanup 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
cc04fabe40 Formatting 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
57a8e79940 No default features for gregorian 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
95cfeed2fa Add support for incrementing year and month 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
c1f6167e37 Add support for dates for increment/decrement 2021-12-05 16:22:58 +08: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
01f7a312d0 Address new lint on 1.57 2021-12-03 10:02:44 +09:00
Blaž Hrastnik
119dee2980 fix: Correctly detect empty transactions
Fixes #1221
2021-12-02 23:49:54 +09:00
Blaž Hrastnik
d14ca05d6b Simplify some cases that use return None to use ? 2021-12-02 10:31:19 +09:00
George Rodrigues
3e15aead4a
Fix typo on docs (#1201) 2021-12-01 09:11:25 +09:00
Blaž Hrastnik
9ed930b233 Merge remote-tracking branch 'origin/master' into debug 2021-11-30 13:06:30 +09:00
Blaž Hrastnik
30171416cb Gutter functions 2021-11-29 11:00:28 +09:00
Gokul Soumya
dc53e65b9e
Fix surround cursor position calculation (#1183)
Fixes #1077. This was caused by the assumption that a block
cursor is represented as zero width internally and simply
rendered to be a single width selection, where as in reality
a block cursor is an actual single width selection in form and
function.

Behavioural changes:

1. Surround selection no longer works when cursor is _on_ a
    surround character that has matching pairs (like `'`
    or `"`). This was the intended behaviour from the start
    but worked till now because of the cursor position
    calculation mismatch.
2021-11-29 10:33:53 +09:00
ath3
1d773bcefb
Implement black hole register (#1165) 2021-11-28 10:21:40 +09:00
Blaž Hrastnik
d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 2021-11-21 20:06:45 +09:00
Martin Junghanns
a3a3b0b517
Jump to end char of surrounding pair from any cursor pos (#1121)
* Jump to end char of surrounding pair from any cursor pos

* Separate bracket matching into exact and fuzzy search

* Add constants for bracket chars

* Abort early if char under cursor is not a bracket

* Simplify bracket char validation

* Refactor node search and unify find methods

* Remove bracket constants
2021-11-20 23:17:25 +09:00
Blaž Hrastnik
2b7c086653 fix: Expand tilde first, then deal with relative paths
Otherwise the ~ gets treated as a relative path.

Fixes #1107
2021-11-19 12:09:17 +09:00
ath3
90fd09f2cc
Fix selection remove doc comment (#1122) 2021-11-18 09:49:56 +09:00
Jason Hansen
6cb35d28a8
Add command to inc/dec number under cursor (#1027)
* Add command to inc/dec number under cursor

With the cursor over a number in normal mode, Ctrl + A will increment the
number and Ctrl + X will decrement the number. It works with binary, octal,
decimal, and hexidecimal numbers. Here are some examples.

0b01110100
0o1734
-24234
0x1F245

If the number isn't over a number it will try to find a number after the
cursor on the same line.

* Move several functions to helix-core

* Change to work based on word under selection

* It no longer finds the next number if the cursor isn't already over
  a number.
* It only matches numbers that are part of words with other characters
  like "foo123bar".
* It now works with multiple selections.

* Add some unit tests

* Fix for clippy

* Simplify some things

* Keep previous selection after incrementing

* Use short word instead of long word

This change requires us to manually handle minus sign.

* Don't pad decimal numbers if no leading zeros

* Handle numbers with `_` separators

* Refactor and add tests

* Move most of the code into core
* Add tests for the incremented output

* Use correct range

* Formatting

* Rename increment functions

* Make docs more specific

* This is easier to read

* This is clearer

* Type can be inferred
2021-11-16 00:32:58 +09:00
Ivan Tham
b7c3877e94
Add movement shortcut for history (#1088)
alt-u and alt-U
2021-11-15 00:16:47 +09:00
ath3
6fa76d9fe7
Add trim_selections command (#1092) 2021-11-15 00:16:20 +09:00
Blaž Hrastnik
1817b7f581 minor: Import Range too 2021-11-15 00:12:14 +09:00
ath3
35c974c9c4
Implement "Goto last modification" command (#1067) 2021-11-15 00:11:53 +09:00
Omnikar
bf95a9ed04
Add remove_selections command (#1065)
* Add `remove_selections` command

* Document `remove_selections`

* Update helix-term/src/keymap.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-11-12 09:34:08 +09:00
Omnikar
a424ef4e20
Use default languages.toml if user's is invalid (#994) 2021-11-09 11:07:54 +09:00
Blaž Hrastnik
e18198aeb2 Revert "fix(core): stop merging array toml config values (#1004)"
It breaks languages.toml merging

This reverts commit 4304b52ff8.
2021-11-09 10:58:23 +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
82ff5b0ab6 Specify capacity on toggle_line_comments 2021-11-08 10:03:21 +09:00
Daniel S Poulin
1e793c2bbf
Adds single and double quotes to matching pairs (#995)
This enables `mm` to work on quote characters as well as highlighting of
matching quote when on it.
2021-11-08 09:57:26 +09:00
Omnikar
a252ecd8c8
Add WORD textobject (#991)
* Add WORD textobject

* Document WORD textobject
2021-11-08 09:54:39 +09:00
Carter Snook
4304b52ff8
fix(core): stop merging array toml config values (#1004) 2021-11-08 09:50:03 +09:00
Blaž Hrastnik
f2b709a3c3 Merge branch 'master' into debug 2021-11-07 00:28:19 +09:00
Blaž Hrastnik
f979bdc442 Specify capacity on toggle_line_comments 2021-11-06 23:57:42 +09:00
Blaž Hrastnik
e80708eba7 Make sure document diagnostics are sorted 2021-11-06 18:58:58 +09:00
Blaž Hrastnik
6431b26a6a Implement Selection::replace to replace a single range
Fixes #985

Co-authored-by: Daniel S Poulin <crimsonmage+github@gmail.com>
2021-11-06 17:37:45 +09:00
Ivan Tham
3eb829e233
Ensure coords in screen depends on char width (#885)
The issue affected files with lots of tabs at the start as well.

Fix #840
2021-11-03 12:02:29 +09:00
Kirawi
ee889aaa85
Updated tree-sitter query scopes (#896)
* updated theme scopes

variable.property -> variable.field
property -> variable.field

* updated theme scopes

* update book and themes

updated book and themes to reflect scope changes

* wip

* update more queries

* update dark_plus.toml
2021-11-03 12:00:52 +09:00
cossonleo
befecc8a9a select smaller range on some case 2021-10-29 10:04:12 +09:00
Omnikar
45fadf6151
Add hyperlinks to fix cargo doc warn (#931) 2021-10-29 09:55:15 +09:00
Blaž Hrastnik
f3c7f20dbc Release v0.5.0 2021-10-28 16:41:34 +09:00
Gygaxis Vainhardt
0a38983ee3
Remove three transmutes from helix-core syntax.rs (#923) 2021-10-28 10:24:11 +09:00
Kirawi
92c2d5d3bf
Document more of helix-core (#904) 2021-10-26 01:02:16 +09:00
Blaž Hrastnik
3edca7854e completion: fully revert state before apply & insertText common prefix 2021-10-25 11:09:09 +09:00
Blaž Hrastnik
bfb6cff5a9 fix: Compose where changes.compose(empty_other) 2021-10-25 11:09:09 +09:00
Dmitry Sharshakov
6aa9838ea6
dap: support arrays as arguments 2021-10-24 17:24:18 +03:00
Blaž Hrastnik
cee7ad781e Mark a few functions as const 2021-10-24 17:28:29 +09: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
Blaž Hrastnik
182a59b552 Update to rust 1.56 + 2021 edition 2021-10-22 12:15:18 +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
Dmitry Sharshakov
48cb81eff1
Merge branch 'master' into debug 2021-10-09 16:03:46 +03:00
Ivan Tham
4260b31ec0
Update mdbook style and fix unreadable table head (#806)
The styles are now pulled from upstream styles, some of the changes I
submitted it back to upstream.

Fix #796
2021-10-09 20:35:27 +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
dependabot[bot]
8925fdd6f3
build(deps): bump smallvec from 1.6.1 to 1.7.0 (#813)
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 12:18:37 +09:00
dependabot[bot]
97b24fd91e
build(deps): bump similar from 2.0.0 to 2.1.0 (#812)
Bumps [similar](https://github.com/mitsuhiko/similar) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/mitsuhiko/similar/releases)
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/similar/compare/2.0.0...2.1.0)

---
updated-dependencies:
- dependency-name: similar
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 12:18:25 +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
2e0803c8d9 Implement 'remove_primary_selection' as Alt-,
This allows removing search matches from the selection

Fixes #713
2021-09-24 10:30:28 +09:00
Blaž Hrastnik
64e8f0017c ... 2021-09-16 16:04:32 +09:00
Blaž Hrastnik
d8b94ba85f Fix broken test 2021-09-16 15:54:43 +09:00
Blaž Hrastnik
dd0b15e1f1 syntax: Properly handle injection-regex for language injections 2021-09-16 15:50:14 +09:00
dependabot[bot]
51b7f40da1
build(deps): bump similar from 1.3.0 to 2.0.0 (#754)
Bumps [similar](https://github.com/mitsuhiko/similar) from 1.3.0 to 2.0.0.
- [Release notes](https://github.com/mitsuhiko/similar/releases)
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/similar/compare/1.3.0...2.0.0)

---
updated-dependencies:
- dependency-name: similar
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-14 09:21:35 +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
585e3ce830 fix: tree-sitter-scopes would infinitely loop 2021-09-06 15:25:46 +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
Blaž Hrastnik
4d24a43651 dap: use smallvec! macro 2021-08-29 23:02:46 +09:00
Blaž Hrastnik
2a7e38a2b4 helix-core doesn't need to import serde_json 2021-08-29 22:33:42 +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
Brian Shu
fa4caf7e3d remove unsafe 2021-08-27 09:50:57 +09:00
Yusuf Bera Ertan
dc57f8dc89
feat: merge default languages.toml with user provided languages.toml, add a generic TOML value merge function (#654)
* feat: merge default languages.toml with user provided languages.toml

* refactor: use catch-all to override all other values for merge toml

* tests: add a test case for merging languages configs

* refactor: change test module name
2021-08-27 00:29:14 +09:00
Blaž Hrastnik
68bf9fdf02 Fix tests broken by the State change 2021-08-26 09:26:38 +09: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
2ad2838a27
Fix tests 2021-08-25 19:36:49 +03:00
Dmitry Sharshakov
c7759a5aa0
Merge remote-tracking branch 'origin/master' into debug 2021-08-25 19:22:01 +03:00
Kirawi
b99db7c687
Move path util functions from helix-term to helix-core (#650) 2021-08-25 10:04:05 +09:00
Dmitry Sharshakov
c463142e5e
Create new debugger config format 2021-08-24 11:56:18 +03:00