Commit Graph

1282 Commits (c15996aff597aa8cb63850c6080bc69470bb84a5)

Author SHA1 Message Date
Blaž Hrastnik f10a06f4de ui: Only render menu scrollbar if it doesn't fit 2 years ago
Blaž Hrastnik 094a0aa3f9 Render code actions as a menu, allow adding padding to popup 2 years ago
Blaž Hrastnik f7f55143a1 Improve code action picker by displaying it inline 2 years ago
Blaž Hrastnik 62561e9d23 Stop collecting highlight_iter events then turning back into iter 2 years ago
Blaž Hrastnik 5aead46f4b Remove some unnecessary clippy tags 2 years ago
Blaž Hrastnik 2a7ae963e1 Automatically commit changes to history if not in insert mode
Fixes #1500
2 years ago
CossonLeo d49e5323f9
Use markup scopes for the Markdown component (#1363) 2 years ago
Benjamin 4044c70eb2
Fix picker won't scroll down when it hits the bottom #1544 (#1567) 2 years ago
Ivan Tham 759b850859
Allow specifying file start position (#445)
Like helix-term/src/commands.rs:3426:15
2 years ago
Blaž Hrastnik e2d2f19fd0
Merge pull request #1154 from sudormrfbin/cursor-shape-new
Change cursor shape on mode change
2 years ago
Blaž Hrastnik add3be8528 Slicing micro-optimization 2 years ago
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%.
2 years ago
Blaž Hrastnik 53d881f172 Store theme scopes on the loader, this way theme isn't passed around 2 years ago
Blaž Hrastnik 6728e44490 syntax: Split parsing and highlighting 2 years ago
Michael Davis f453f8724d
change show_subtree command into ':tree-sitter-subtree' typable command (#1524)
* add default keymap for show_subtree command

* remove space+t keymap

* add a typable command ':show-subtree'

* generate documentation for ':show-subtree'

* remove non-typable show_subtree command

* ':show-subtree'->':tree-sitter-subtree'
2 years ago
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
2 years ago
Skyler Hawthorne 96d4ca5f73
Dependabot/cargo/pulldown cmark 0.9.1 (#1533)
* build(deps): bump pulldown-cmark from 0.8.0 to 0.9.1

Bumps [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) from 0.8.0 to 0.9.1.
- [Release notes](https://github.com/raphlinus/pulldown-cmark/releases)
- [Commits](https://github.com/raphlinus/pulldown-cmark/compare/v0.8.0...v0.9.1)

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

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

* cmark 0.9 fixes

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Blaž Hrastnik e7eab95b94 Update to rust 1.58, fix a bunch of optional lints 2 years ago
Mathis Brossier f5b0821860
Fix panics when resizing (#1408)
* Change buffer.get & buffer.get_mut to return Option, Implement Trait Index & IndexMut to panic

* Prevent FilePicker from drawing outside buffer (rust panics)

* apply suggestion

* add function in_bounds to avoid useless calculations

Co-authored-by: mathis <mathis.brossier@universite-paris-saclay.fr>
2 years ago
WindSoilder 22297d0b40
Add alt-backspace, alt-<, alt->, ctrl-j to insert mode (#1441)
* add alt-backspace keymap to delete word backward

* add more useful keymap

* map to correct command

* add C-j to insert_newline
2 years ago
Matouš Dzivjak 38ca8daa09
fix(commands): run fmt for all documents being closed (#1444)
When writing all documents, fmt wouldn't be run.
Run fmt in close all implementation so that all documents
are formatted if necessary.

Fixes: https://github.com/helix-editor/helix/issues/1442
2 years ago
Michael Davis 64d3e7b705
add show_subtree command for viewing tree-sitter subtree in Popup (#1453)
* add show_subtree command for viewing tree-sitter subtree in Popup

* remove '.slice(..)' from show_subtree command

* name docs and subtree Popups 'hover'
2 years ago
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
2 years ago
Mathis Brossier 85cf2648a2
buffer picker allow hsplit / vsplit (#1502) 2 years ago
Gokul Soumya b3b4e78585 Merge branch 'master' into cursor-shape-new 3 years ago
Benoît Cortier 05e5520ec0
Put some tests behind #[cfg(test)] (#1459)
It was missing in a few places.
3 years ago
Gokul Soumya 449624965b Merge branch 'master' into cursor-shape-new 3 years ago
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
3 years ago
Blaž Hrastnik 3e4f81547c fix: Use std::path::MAIN_SEPARATOR to determine completion
Refs #1439
3 years ago
Stuart Hinson b18bda928f
fix slash in search selector status message (#1449) 3 years ago
Blaž Hrastnik 7767703979 fix: Only use shellwords parsing on unix platforms 3 years ago
Blaž Hrastnik bed9aced5f Revert "Convert Windows style path separator in completers to Unix style (#1389)"
This reverts commit 49444f9c05.
3 years ago
Mathis Brossier dbaed0ba83
scroll: change only main selection, only when needed (#1420)
Co-authored-by: mathis <mathis.brossier@universite-paris-saclay.fr>
3 years ago
Omnikar ed97ecceb8
Add `:cquit!` command and prevent `:cquit` from ignoring unsaved changes (#1414)
* Add `:cquit!` command and prevent `:cquit` from ignoring unsaved changes

* `cargo xtask docgen`
3 years ago
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>
3 years ago
Kirawi 93a948d889
switch redundant current! usage to doc! (#1416) 3 years ago
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>
3 years ago
Blaž Hrastnik a066f59dc8 Don't just filter commands by fuzzy match, also order the matches 3 years ago
ath3 49444f9c05
Convert Windows style path separator in completers to Unix style (#1389) 3 years ago
WindSoilder f1ed042c84
Fix: when goto normal mode, only want to remove indentation if the line is blank with no text following (#1349)
* when opened new line contains other characters after current position, don't dedent

* abstract checking logic
3 years ago
Stuart Hinson 34db33e1dc
Use a fuzzy matcher for commands (#1386)
* Use a fuzzy matcher for commands

* Take Clippy up on its suggestion

* Rescope FUZZY_MATCHER
3 years ago
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
3 years ago
Omnikar 5b69e9b466
Fix indentation (#1387) 3 years ago
Matouš Dzivjak a4641a8613
feat(commands): sort command (#1288)
* feat(commands): sort/rsort  command

Add basic implementation of sort command.

* Sort by selections instead, implement reverse sort

* Generate docs

* Rename sort! to rsort
3 years ago
Omnikar 8340d73545 Extract macro parsing to `helix-view` and add unit tests 3 years ago
Omnikar 2d4bc0aec7 Change how macros separate keypresses
* Keypresses are no longer separated by spaces
* Single-character keypresses are serialized as-is
* Multi-character keypresses are delimited by `<>`
3 years ago
Ivan Tham ee3eb4057a Update macro display as [q] in message 3 years ago
Ivan Tham b9cb3930e2 Mark macros as experimental in docs
Given that currently macro does not integrate well with registers and
the internal representation of macros is expected to be changed.
3 years ago
Ivan Tham 9a32617b30 Rename play macro to replay macro
Macro needs to be defined first before playing so replay is more accurate.
Also, replay have the same length as record which makes it looks nice.
3 years ago
Ivan Tham 5326a05117 Improve macro error handling 3 years ago
Ivan Tham c7a59e24e6 Switch macro Q and q 3 years ago
Tamo a306a1052a
Update settings at runtime (#798)
* feat: Update settings at runtime

fix the clippy warning

* update the documentation

* use to_value instead of to_vec+from_value

* drop the equal

* remove an useless comment

* apply suggestion
3 years ago
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.
3 years ago
Gabriel Berto 5d7b5db8ab
Resolve completion item (#1315)
Co-authored-by: Gabriel Berto <gabriel.berto@pottencial.com.br>
3 years ago
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
3 years ago
BB 60f3225c7f
Truncate the start of file paths in the StatusLine (#1351)
* Truncate the start of file paths in the StatusLine

* cargo fmt

Co-authored-by: Bódi Balázs <97936@4ig.hu>
3 years ago
Gokul Soumya c0bbadcaaf Manually draw all block cursors 3 years ago
Matouš Dzivjak 75a8b789d2
LSP code action commands (#1304)
* feat(lsp): codeAction commands

* Don't block on command call

* Fix lifetime of command execution

* Fix lint issues
3 years ago
WindSoilder 600ce70cf6
Improve dedent behavior (#1232)
* tmp add code for dedent

* finish normal_mode with dedent behavior

* use function pointer

* rebase from origin

* check dedent condition inside normal_mode implementation

* using if let...

* fix check

* using char_is_whitespace instead of ch.is_whitespace

* fix clippy

* abstract restore_indent function
3 years ago
Ivan Tham f174d27d0d
Change text for gg to explain <n>gg (#1287) 3 years ago
Kirawi 02fc52f6d5
Apply recent nightly suggestions (#1286)
array iterators are now implicit
3 years ago
Gokul Soumya d4fb1d0633 Merge branch 'master' into cursor-shape-new 3 years ago
Gokul Soumya 016640f4fb Remove ui.cursor.primary and hashmap lookups 3 years ago
Omnikar 6da2174e14
Allow paste commands to take a count (#1261)
* Allow paste commands to take a count

* Call `.repeat` within iterator methods

* Implement counts for paste-replace
3 years ago
Midnight Exigent e188926138
Fix panic when scrolling through completion popup (#1260)
* fix(completion_popup): Fixes #1256

* Update helix-term/src/ui/completion.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
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
3 years ago
Blaž Hrastnik 730d3be201 Add ui.gutter to theme all gutters (i.e. set bg) 3 years ago
Omnikar cce34feb4e Assume true color support on Windows 3 years ago
Omnikar 98ce2a301d Load alt default theme if true color is not supported
* Move `runtime/themes/base16_default_terminal.toml` to
  `base16_theme.toml` alongside `theme.toml`
* Use `terminfo` crate to detect whether the terminal supports true
  color and, if the user has no theme configured and their terminal does
  not support true color, load the alt default theme instead of the
  normal default.

Remove `terminfo` dependency, use `COLORTERM` env instead

Prevent user from switching to an unsupported theme

Add `true-color-override` option

If the terminal is wrongly detected to not support true color,
`true-color-override = true` will override the detection.

Rename `true-color-override` to `true-color`
3 years ago
Blaž Hrastnik 7ad8eaaef0 wip 3 years ago
Blaž Hrastnik b25d453f64 minor: Shorten goto file(s) descriptions 3 years ago
Omnikar e91d357fae
Macros (#1234)
* Macros WIP

`helix_term::compositor::Callback` changed to take a `&mut Context` as
a parameter for use by `play_macro`

* Default to `@` register for macros

* Import `KeyEvent`

* Special-case shift-tab -> backtab in `KeyEvent` conversion

* Move key recording to the compositor

* Add comment

* Add persistent display of macro recording status

When macro recording is active, the pending keys display will be shifted
3 characters left, and the register being recorded to will be displayed
between brackets — e.g., `[@]` — right of the pending keys display.

* Fix/add documentation
3 years ago
ath3 3156577fbf
Open files with spaces in filename, allow opening multiple files (#1231) 3 years ago
Blaž Hrastnik 3307f44ce2 ui: popup: Don't allow scrolling past the end of content 3 years ago
Omnikar b66d3d3d9d
Add `save_selection` command (#1247) 3 years ago
Blaž Hrastnik df3b88387b dap: Improve variables UI 3 years ago
Blaž Hrastnik dac317e620 TODO 3 years ago
Blaž Hrastnik 60c86eff89 dap: Simplify a few more statements that could use the debugger macro 3 years ago
Kirawi 29c053e84e
Only use a single documentation popup (#1241) 3 years ago
Gokul Soumya 71292f9f11 docs: Auto generate command list 3 years ago
Blaž Hrastnik d8351d35ab dap: Extract a macro that fetches a debugger or returns 3 years ago
Blaž Hrastnik e98993d609 dap: Fix an off-by-one error when jumping 3 years ago
WindSoilder 93e276cd9d
Make kill_to_line_end behave like emacs (#1235) 3 years ago
Blaž Hrastnik cab09093dd fix: Normalize backtab into shift-tab
Fixes #1150
3 years ago
Blaž Hrastnik bf8437d098 clippy lint 3 years ago
Blaž Hrastnik dc8df7ba21 Make thread_picker non-blocking 3 years ago
Blaž Hrastnik 2b4de41bf0 dap: Reply to RunInTerminal 3 years ago
Blaž Hrastnik d5d1a9b1ae
Apply suggestions from code review
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
3 years ago
Jason Rodney Hansen 461cd20563 Small change 3 years ago
Jason Rodney Hansen 31ed91dc2e Don't increment for overlapping changes 3 years ago
Jason Rodney Hansen c74cd48f38 Cleanup 3 years ago
Jason Rodney Hansen 37e484ee38 Add support for time and more date formats 3 years ago
Jason Rodney Hansen c9641fcced Add `Increment` trait 3 years ago
Jason Rodney Hansen c1f6167e37 Add support for dates for increment/decrement 3 years ago
ath3 11a2f9ac31
Assert in release mode too on duplicate keys (#1228) 3 years ago
Oskar Nehlin a06871a689
feat: Make it possible to keybind `TypableCommands` (#1169)
* Make TypableCommands mappable

* Fix pr comments

* Update PartialEq implementation
3 years ago
Blaž Hrastnik 5545f8ebb5 dap: Add RunInTerminal reverse request, support replying to requests 3 years ago
Blaž Hrastnik 43fbb6d965 Make dap_start non-blocking 3 years ago
Blaž Hrastnik 371c84f70b cargo fmt 3 years ago
Blaž Hrastnik 34f46e7502 Bump rust to 1.57, fix new lint failures 3 years ago