Commit Graph

1319 Commits (c15996aff597aa8cb63850c6080bc69470bb84a5)

Author SHA1 Message Date
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
2 years ago
Michael Davis 39f7ba36e0
ignore Enter keypress when menu has no selection (#1704)
* ignore Enter keypress when menu has no selection

supersedes #1622

Builds on the work in #1285. I want to allow Enter to create a newline
when there is no selection in the autocomplete menu.

This occurs somewhat often when using LSP autocomplete in Elixir which
uses `do/end` blocks (and I set the autocomplete menu delay to 0 which
exacerbates the problem):

```elixir
defmodule MyModule do
  def do_foo(x) do
    x
  end
  def other_function(y) do|
end
```

Here the cursor is `|` in insert mode. The LSP suggests `do_foo` but I
want to create a newline. Hitting Enter currently closes the menu,
so I end up having to hit Enter twice when the module contains any
local with a `do` prefix, which can be inconsistent. With this change,
we ignore the Enter keypress to end up creating the newline in this case.

* pop compositor layer when ignoring Enter keypress

* move closing function out of consumed event result closure

* explicitly label close_fn as an 'Option<Callback>'
2 years ago
Gokul Soumya 8e07e1b898
Alert if LSP is inactive when command is invoked (#1703) 2 years ago
Matouš Dzivjak 951fd1c80e
fix(commands): don't indent empty lines (#1653)
* fix(commands): don't indent empty lines

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

* Apply suggestions

* Update helix-term/src/commands.rs

* Update helix-term/src/commands.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
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
2 years ago
Blaž Hrastnik b935fac957
Fix 1.60 lints 2 years ago
Blaž Hrastnik 9712bbb23b
Use which to resolve lsp/dap binaries
This resolves the following issue: https://github.com/helix-editor/helix/discussions/962#discussioncomment-1580046
2 years ago
Bram 40eb1268c7
Close some popups automatically (#1285)
* Add Event::Used to use event callback without consuming

* Close popup if contents ignored event

* collect event results before executing callbacks

* don't add new result variant, use Ignored(..) instead

* break in match cases

* Make auto_close configurable

* fix merge

* auto close hover popups

* fix formatting
2 years ago
Blaž Hrastnik 24f86017a6
fix: ui: Markdown popups stopped taking vertical padding into account
Fix #1688
2 years ago
Blaž Hrastnik 1ca6ba03ca
Simplify some code 2 years ago
Alex d5ba0b5162
Allow separate styles for markup headings (#1618)
* update markdown highlighting to use separate heading themes

* remove markdown theme scopes in ui
2 years ago
Daniel S Poulin 700058f433
Always ignore the .git directory in file picker (#1604)
Some users (including myself) want to turn off filtering of files
prefixed with `.`, as they are often useful to edit. For example, `.env`
files, configuration for linters `.eslint.json` and the like.
2 years ago
Blaž Hrastnik c7b326be04
ui: prompt: Render aliases + border on the doc 2 years ago
Blaž Hrastnik 2af04325d8
fix: Allow multi-line prompt documentation 2 years ago
Blaž Hrastnik a449156702 Extract a lsp position helper 2 years ago
Blaž Hrastnik 5af9136aec Extract some duplication in lsp goto_ calls 2 years ago
Blaž Hrastnik 1cd710fe01 Extract jump_to_location 2 years ago
Blaž Hrastnik 4e845409b6 Extract a common "language server or return" macro 2 years ago
Blaž Hrastnik c06155ace4 Extract a helper function for lsp::Location 2 years ago
Blaž Hrastnik 504d5ce8bd Move most LSP specific commmands to commands::lsp 2 years ago
Blaž Hrastnik 7b1d682fe5 dap: fix runInTerminal with lldb-vscode 2 years ago
Blaž Hrastnik 4e1b3b12f3 Refactor symbol picker to share code 2 years ago
Michael Davis a8cf0c6b90
filter git revision on git command success exit code (#1674)
The unwrap (or '.ok()' rather) triggers for some errors but not
negative status codes. In the case where helix is being packaged
in an empty git repository, the existing mechanism will fail because

    git init
    git rev-parse HEAD

gives a negative exit code and prints to stderr

    stderr: "fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree....

with a stdout of "HEAD\n" (too short to slice with [..8]).
2 years ago
tomKPZ 368064e316
Fix bug when launching hx file.rs:10 (#1676) 2 years ago
Matouš Dzivjak afec54485a
feat(commands): command palette (#1400)
* feat(commands): command palette

Add new command to display command pallete that can be used
to discover and execute available commands.

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

* Make picker take the whole context, not just editor

* Bind command pallete

* Typable commands also in the palette

* Show key bindings for commands

* Fix tests, small refactor

* Refactor keymap mapping, fix typo

* Ignore sequence key bindings for now

* Apply suggestions

* Fix lint issues in tests

* Fix after rebase

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Blaž Hrastnik 24f90ba8d8 Manually recalculate initial completion where it matters 2 years ago
Blaž Hrastnik af21e2a5b4 Pass through Editor instead of Context 2 years ago
Cole Helbling e023a78919 WIP: show all buffers that couldn't be closed 2 years ago
Cole Helbling 6118486eb2 helix-term: implement buffer completer
In order to implement this completer, the completion function needs to
be able to access the compositor's context (to allow it to get the
list of buffers currently open in the context's editor).
2 years ago
Cole Helbling a1207fd768 helix-term/commands: display buffer id in picker 2 years ago
Blaž Hrastnik d11b652139 Allow static strings in set_status/set_error so API is nicer 2 years ago
Blaž Hrastnik fd0e4b1159 dap: Reduce amount of block_on uses 2 years ago
Gokul Soumya 966fbc5984 Add tree-sitter based function, class navigation 2 years ago
Blaž Hrastnik 1422449537 .. 2 years ago
Blaž Hrastnik eeb9b39857 Fix build on master 2 years ago
Ludwig Stecher 4429993842
Add `PageUp`, `PageDown`, `Ctrl-u`, `Ctrl-d`, `Home`, `End` keyboard shortcuts to file picker (#1612)
* Add `PageUp`, `PageDown`, `Ctrl-u`, `Ctrl-d`, `Home`, `End` keyboard shortcuts to file picker

* Refactor file picker paging logic

* change key mapping

* Add overlay component

* Use closure instead of margin to calculate size

* Don't wrap file picker in `Overlay` automatically
2 years ago
Kirawi 23907a063c
use PathBuf::to_string_lossy() instead of to_str() (#1655) 2 years ago
Gokul Soumya 4c424d5ee4
Refactor language config loading (#1658) 2 years ago
Blaž Hrastnik 97d4b2b5fe Mark DAP as experimental 2 years ago
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2 years ago
Cydiater 7083b98a38
postpone clone after found (#1656) 2 years ago
Blaž Hrastnik 1bcb624ae6 Instant is more suitable than SystemTime for spinners 2 years ago
Blaž Hrastnik f88c077f99 Replace tendril with smartstring
Slightly smaller API surface, less dependencies.
2 years ago
Matouš Dzivjak fdb9a1677b
feat(editor): add config for search wrap_around (#1516)
* feat(editor): add config for search wrap_around

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

* Move search settings into separate config

* Disable linter
2 years ago
Gokul Soumya bf773db451 Show infobox with register contents 2 years ago
Gokul Soumya 5995568c1d Prevent multiple code action popups 2 years ago
Gokul Soumya 547c3ecd0c Preselect first item in code action popup menu 2 years ago
Gokul Soumya e90276df0b Replace if let with early return 2 years ago
Blaž Hrastnik 23553bd37c Update dependencies (crossterm 0.23, tree-sitter 0.20.4)
Fixes #677
2 years ago
Blaž Hrastnik e7f5ec5561 fix: There is no such thing as markup.normal, use ui.text 2 years ago