Blaž Hrastnik
29cefa1be8
rust: Indent multi line call expressions one level deeper
2021-07-26 11:19:33 +09:00
Blaž Hrastnik
f24007b30f
Improve rust indentation queries
...
if/if let are already handled by block, and keeping these scopes would
indent else blocks one level too far.
2021-07-26 11:19:33 +09:00
Omnikar
112ae5cffe
Determine whether to use a margin of 0 or 1 when uncommenting ( #476 )
...
* Implement `margin` calculation for uncommenting
* Move `margin` calculation to `find_line_comment`
* Fix comment bug with multiple selections on a line
* Fix `find_line_comment` test for new return type
* Generate a single vec of lines for comment toggle
`toggle_line_comments` collects the lines covered by all selections into
a `Vec`, skipping duplicates. `find_line_comment` now returns the lines
to operate on, instead of returning the lines to skip.
* Fix test for `find_line_comment`
* Reserve length of `to_change` instead of `lines`
The length of `lines` includes blank lines which will be skipped, and as
such do not need space for a change reserved for them. `to_change`
includes only the lines which will be changed.
* Use `token.chars().count()` for token char length
* Create `changes` with capacity instead of reserving
* Remove unnecessary clones in `test_find_line_comment`
* Add test case for 0 margin comments
* Add comments explaining `find_line_comment`
2021-07-26 11:00:58 +09:00
Gokul Soumya
e07e42dcfb
fix(term): undo-ing code actions
2021-07-25 19:49:05 +09:00
gbaranski
8da58fe44a
fix(term): use existing implementation of edits_to_transaction
2021-07-25 19:49:05 +09:00
Yusuf Bera Ertan
41f62c3157
build(nix): fix build issues
2021-07-25 19:47:56 +09:00
Nathan Vegdahl
f96b8b769b
Switch to a cleaner range-head moving abstraction.
...
Also fix a bunch of bugs related to it.
2021-07-24 07:44:11 -07:00
Gokul Soumya
6a8a01df6b
Add missing keybinds to docs
2021-07-24 20:11:19 +09:00
Grzegorz Baranski
48e344a2a8
feat: code actions - document edits ( #478 )
...
* wip: Code actions
* fix(term): use current macro instead Context::context
* feat(lsp): set code_action capabilities
* feat(term): set SPC-a to code_action
* feat(term): wip on applying code actions
* deps: `cargo update`
* feat(term): applying code actions edits
* fix(term): cleanup of apply_edit
* fix(term): applying edits as a whole thing instead one by one
* refactor(term): move apply_edits below
* fix(term): improve unimplemented messages for further investigation
* fix(term): change code action command comment
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* fix(term): add matching `}`
* fix(term): cleanup, todo!() on workspace edit
* fix(term): remove unrelated workspace_symbol_picker
* fix(term): apply cargo-clippy suggestions
* fix(term): replace todo!'s with editor.set_error
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-07-24 10:26:43 +09:00
Nathan Vegdahl
20723495d3
Fixed find_till_char and find_char commands.
...
They worked correctly when extending, but not for normal cursor
movement.
2021-07-23 18:03:40 -07:00
Nathan Vegdahl
8f43dc4039
Fix surround replace command replacing the wrong position on the right.
2021-07-23 17:52:45 -07:00
Nathan Vegdahl
43594049dd
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
2021-07-23 17:23:16 -07:00
Nathan Vegdahl
427ae6ac6c
Put selection in separate variable in commands code.
2021-07-23 17:06:14 -07:00
Nathan Vegdahl
ad814b8c2e
Fix append mode, and make insertion always happen at head of range.
2021-07-23 14:27:12 -07:00
Ivan Tham
bda4f5c1cd
Simplify replace dashes with underscore
2021-07-23 18:37:41 +09:00
Blaž Hrastnik
1789dfabfe
fix: ui/menu: Don't allow scrolling past the end of completion
...
Fixes #472
2021-07-23 18:12:33 +09:00
Blaž Hrastnik
e5d438705b
Add rustfmt.toml to force formatting to use rustfmt defaults
...
Closes #480
2021-07-23 18:11:22 +09:00
Blaž Hrastnik
817a7e0bd6
fix: Only try expanding directory completion if it makes sense
...
Fixes #487
2021-07-23 18:10:30 +09:00
Blaž Hrastnik
58d08d36ae
Simplify ui/menu.rs
2021-07-23 18:10:17 +09:00
Nathan Vegdahl
ffb8057a7f
Fix ocassional panic when matching brackets.
2021-07-22 18:47:37 -07:00
Shafkath Shuhan
25103833b2
mark reloaded buffers as unchanged
2021-07-22 17:39:45 -07:00
Nathan Vegdahl
fd684ef693
Revert display-width-based vertical cursor movement.
...
Still needs to be done, but should be part of a separate PR.
2021-07-22 13:21:44 -07:00
Nathan Vegdahl
5841954f58
Calculate the line that the range head is on correctly.
2021-07-22 11:17:03 -07:00
Nathan Vegdahl
673338bdb6
Use Range::line_range()
in some more places I missed.
2021-07-22 10:50:12 -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
Ivan Tham
eba0bbda2e
Resume last picker
...
Inspired by space ' in doom emacs.
2021-07-22 11:22:27 +09:00
Nathan Vegdahl
7d07704e6f
Fix append mode not editing correctly.
...
This is currently a bit of a hack, and still doesn't behave quite how we
probably want. Left a TODO.
2021-07-21 09:56:21 -07:00
Nathan Vegdahl
063aa9452d
Fix yank not working with internally zero-width ranges.
2021-07-21 09:32:48 -07:00
Nathan Vegdahl
bc85c85501
Fix selections not being modified quite correctly with text edits.
2021-07-21 09:23:01 -07:00
Kirawi
df0ed80931
Update dark_plus.toml
...
Corrects primary selection color and makes matching cursor easier to spot.
2021-07-21 11:52:42 +09:00
Nathan Vegdahl
198fe40951
Don't insert a final line ending on file load/reload.
2021-07-20 18:40:41 -07:00
Nathan Vegdahl
c848ed7abc
Fixes for misc bugs with view movement.
2021-07-20 18:15:34 -07:00
Nathan Vegdahl
d5534a6d10
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
2021-07-20 13:35:37 -07:00
Nathan Vegdahl
1194fc842a
Use new Range::line_range()
method in more places, as appropriate.
2021-07-20 12:40:58 -07:00
Nathan Vegdahl
c9300ec35f
Fix comment toggle command also sometimes toggling the next line.
2021-07-20 12:23:40 -07:00
Nathan Vegdahl
1c6b5581f0
Fix various bugs related to goto-end-of-line command.
...
This also fixes a bug with `Selection::normalize()`, that could
result in an out-of-bounds primary index.
2021-07-20 11:58:56 -07:00
Nathan Vegdahl
e8a3980e46
Fix line-wise p
pasting before the current line instead of after.
2021-07-20 10:56:27 -07:00
Nathan Vegdahl
1910fa7723
Fix incorrect line hihglight when a selection is at the end of a line.
2021-07-20 10:26:00 -07:00
Ivan Tham
17f9dfce7e
Fix typo
2021-07-20 22:10:43 +09:00
Luctius
585d6f8242
Fixes toggle_comment not finding the correct language comment token
2021-07-20 17:10:17 +09:00
dependabot[bot]
d754c72b4d
Bump tokio from 1.8.1 to 1.8.2
...
Bumps [tokio](https://github.com/tokio-rs/tokio ) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases )
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.8.1...tokio-1.8.2 )
---
updated-dependencies:
- dependency-name: tokio
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-07-20 13:31:14 +08:00
Nathan Vegdahl
1792dc6f93
Make search work a little nicer when there are already selections.
...
Specifically, if you have text like "aaaaaaaaa" and you search
for "a", the new behavior will actually progress through all of the
"a"s, whereas the previous behavior would be stuck on a single one.
2021-07-19 18:29:26 -07:00
Nathan Vegdahl
c400a60377
Fix Selection::push()
to make the pushed range primary.
...
Apparently I accidentally deleted that behavior in the cleanup.
2021-07-19 18:25:36 -07:00
Nathan Vegdahl
13b0784009
Fix extend line behavior.
2021-07-19 17:44:18 -07:00
Nathan Vegdahl
e98d669c30
Handle edge case in range_to_target()
correctly.
2021-07-19 12:30:08 -07:00
Nathan Vegdahl
b0311f4fc2
Fixed primary cursor position calculation to use 1-width semantics.
...
This had a bunch of knock-on effects that were buggy, such as bracket
match highlighting.
2021-07-19 09:25:10 -07:00
Nathan Vegdahl
079d4ed86d
Properly fix last_line
view calculation.
...
Turned out to be simpler than I thought. Didn't even need to change the
other use-sites.
2021-07-19 08:39:48 -07:00
Nathan Vegdahl
1a9ae72fcb
Fix last line number being drawn in the status bar.
2021-07-18 23:09:55 -07:00
Nathan Vegdahl
e462f32723
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
2021-07-18 22:02:12 -07:00
Nathan Vegdahl
6c038bb015
Update word selection/navigation to work with gap indexing.
...
Also tweaked some of the existing behavior that seemed inconsistent
and/or buggy. It's mostly identical, just a few corner cases are
different.
2021-07-18 21:59:31 -07:00