Commit Graph

313 Commits (8b0ae3d27912799d59e4948ff11d3a5428e32ce4)

Author SHA1 Message Date
unrelentingtech 20162a426b
feat(commands): make it possible to disable format-on-save via the 'auto-format' option (#2321) 2 years ago
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>
2 years ago
Ryosuke Hayashi f85f0b7272
Add run-shell-command for Commands (#1682)
* add run_shell_command

* docgen

* fix command name

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

* refactored Info::new

* show 'Command failed' if execution fails

* TypedCommand takes care of error handling and printing the error to the statusline.

* docgen

* use Popup instead of autoinfo

* remove to_string in format!

* Revert chage in info.rs

* Show "Command succeed" when success

* Fix info.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
chunghha 3a398eec56
fix typos (#2304) 2 years ago
Michael Davis 773736b03a
Fix paste direction for typed paste commands (#2288) 2 years ago
Daniel 15db6031bb
Add :get-option command (#2231) 2 years ago
ttys3 19d042dde6
chore(lsp): check rename capabilities before send rename action (#2203) 2 years ago
Kirawi dd5a7c6191
Replace line endings using `set_line_ending` command (#1871)
* set_line_ending: now replace line endings

* use ending.len_chars() directly

* account for unicode-lines feaure in line-ending doc
2 years ago
Robin Jadoul 33b7483db5
Send active diagnostics to LSP when requesting code actions. (#2005)
* Send active diagnostics to LSP when requesting code actions.

This allows for e.g. clangd to properly send the quickfix code actions
corresponding to those diagnostics as options.
The LSP spec v3.16.0 introduced an opaque `data` member that would allow
the server to persist arbitrary data between the diagnostic and the code
actions request, but this is not supported yet by this commit.

* Reuse existing range_to_lsp_range functionality
2 years ago
Thomas 2eca2901f3
Pipe typable command (#1972)
Co-authored-by: DeviousStoat <devious@stoat.com>
2 years ago
Omnikar 660e0e44b2
Add `:write!` to create nonexistent subdirectories (#1839)
* Make `:write` create nonexistent subdirectories

Prompting as to whether this should take place remains a TODO.

* Move subdirectory creation to new `w!` command
2 years ago
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
2 years ago
Dr. David A. Kunz 9782204f73
Add typed commands buffer-next and buffer-previous (#1940) 2 years ago
Marcin Puc f2dd3d4469
Avoid using the format ident Rust feature (#1881) 2 years ago
Blaž Hrastnik a516f5881b
Address clippy lint 2 years ago
Blaž Hrastnik 4940db3e2d
Make truncate_start a builder method instead 2 years ago
Blaž Hrastnik 20cf75dfa1
Strip some more params 2 years ago
Blaž Hrastnik 96a4eb8483
Remove more push_layer calls 2 years ago
Blaž Hrastnik 9a6ee88e66
Split off dap event handlers into helix-view to allow reuse 2 years ago
Joe bee05dd32a
Add refresh-config and open-config command (#1803)
* Add refresh-config and open-config command

* clippy

* Use dynamic dispatch for editor config

* Refactor Result::Ok to Ok

* Remove unused import

* cargo fmt

* Modify config error handling

* cargo xtask docgen

* impl display for ConfigLoadError

* cargo fmt

* Put keymaps behind dyn access, refactor config.load()

* Update command names

* Update helix-term/src/application.rs

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

* Switch to unbounded_channel

* Remove --edit-config command

* Update configuration docs

* Revert "Put keymaps behind dyn access", too hard

This reverts commit 06bad8cf49.

* Add refresh for keys

* Refactor default_keymaps, fix config default, add test

* swap -> store, remove unneeded clone

* cargo fmt

* Rename default_keymaps to default

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Blaž Hrastnik f67e1ee172
Put esoteric line endings behind a feature flag 2 years ago
Gokul Soumya 2b0835b295
Refactor :set to parse by deserializing values (#1799)
* Refactor :set to parse by deserializing values

* Implement serialize for idle_timeout config
2 years ago
Joe c0dbd6dc3f
Add horizontal and vertical split scratch buffers (#1763)
Make subcommand name more descriptive

Fix vsplit completer

Run cargo xtask docgen
2 years ago
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.
2 years ago
Emil Fresk bfa533fe78
Fix bug in LSP when creating a file in a folder that does not exist (#1775) 2 years ago
Blaž Hrastnik 5a60989efe
Bump dependencies 2 years ago
Blaž Hrastnik 19247ff0ec
Split out typable commands into a separate file 2 years ago
Gokul Soumya 5c810e5e52
Fix bug with auto replacing components in compositor (#1711)
* Fix bug with auto replacing components in compositor

This was last known to be working with 5995568c at the
time of commit, but now doesn't work with latest rust
stable.

The issue probably stems from using
std::any::type_name() for finding a component in the
compositor, for which the docs explicitly warn against
considering it as a unique identifier for types.

`replace_or_push()` takes a boxed `Component` and
passes it to `find_id()` which compares this with a
bare Component. `type_name()` returns `Box<T>` for
the former and `T` for latter and we have a false
negative. This has been solved by using a generics
instead of trait objects to pass in a `T: Component`
and then use it for comparison.

I'm not exactly sure how this worked fine at the
time of commit of 5995568c; maybe the internal
implementation of `type_name()` changed to properly
indicate indirection with Box.

* Do not compare by type name in compositor find_id
2 years ago
Gokul Soumya 8e07e1b898
Alert if LSP is inactive when command is invoked (#1703) 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
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
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
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
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
Blaž Hrastnik 1422449537 .. 2 years ago
Blaž Hrastnik eeb9b39857 Fix build on master 2 years ago
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2 years ago
Blaž Hrastnik 7ad8eaaef0 wip 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
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
Blaž Hrastnik bf8437d098 clippy lint 3 years ago
Blaž Hrastnik dc8df7ba21 Make thread_picker non-blocking 3 years ago
Blaž Hrastnik d5d1a9b1ae
Apply suggestions from code review
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
3 years ago
Blaž Hrastnik 43fbb6d965 Make dap_start non-blocking 3 years ago
Blaž Hrastnik 2dbf966293 dap: Start working on runInTerminal support 3 years ago
Blaž Hrastnik d14ca05d6b Simplify some cases that use return None to use ? 3 years ago
Blaž Hrastnik de5e5863aa dap: Use cursor_line over cursor + char_to_line 3 years ago
Blaž Hrastnik 54f8e5c9c3 dap: Fix an off-by-one and move the function over to commands/dap 3 years ago
Blaž Hrastnik 573cb39926 dap: Remove some unwraps 3 years ago
Blaž Hrastnik ffc89e483b Mark some more TODOs as resolved 3 years ago
Blaž Hrastnik b4fd3148e3 These TODOs have been resolved 3 years ago
Blaž Hrastnik 8ffafb826f dap: Rewrite breakpoints so that there's a single set maintained 3 years ago
Blaž Hrastnik 3633f85b38 Pass editor into render_view & gutter, reducing the number of params 3 years ago
Blaž Hrastnik 85b4410703 dap: Toggle breakpoints without changing selection, fix offset calc 3 years ago
Blaž Hrastnik b55ca8fdb8 dap: Always edit breakpoints on the correct document 3 years ago
Blaž Hrastnik 0eadeab8c7 dap: Remove the prompt line parameter, use insert_str instead 3 years ago
Blaž Hrastnik 5f329a22c4 dap: Modify breakpoints in place with no cloning 3 years ago
Blaž Hrastnik 05d3ad4a0e dap: Remove an excess clone on enable_exceptions 3 years ago
Blaž Hrastnik c39d9f44a0 dap: Simplify debug_parameter_prompt 3 years ago
Blaž Hrastnik 3042ff3e5a dap: Clean up dap_start_impl, no need to clone arg keys 3 years ago
Blaž Hrastnik 9963a5614d dap: Minor simplifications 3 years ago
Blaž Hrastnik 65868081fc dap: Simplify launch & start
There's no need to re-detect language config, just use the one available
on the document.
3 years ago
Blaž Hrastnik 4f2a01cc09 dap: Error implements Display so we can format with {} 3 years ago
Blaž Hrastnik 2bd8a9b39d dap: Consistently rename type as ty 3 years ago
Blaž Hrastnik 9dd17c46a2 dap: Avoid cloning old_breakpoints if we are immediately replacing them 3 years ago
Blaž Hrastnik 757babb1b4 dap: Avoid cloning *entire* stack frames when picking a thread 3 years ago
Blaž Hrastnik 5803de2067 dap: Simplify more calls 3 years ago
Blaž Hrastnik 9baddc825d dap: Get rid of excessive cloning 3 years ago
Blaž Hrastnik fd9b826f2c dap: Inline empty completer 3 years ago
Blaž Hrastnik 5938ab1bf1 dap: Fully extract template parameter prompts 3 years ago
Blaž Hrastnik 3b8d5102ac Make picker take the whole context, not just editor 3 years ago
Blaž Hrastnik 64bb1f7563 dap: Extract out variable rendering
Will improve on the UI later
3 years ago
Blaž Hrastnik 2e1aa5f15b Fix compilation 3 years ago
Blaž Hrastnik 14a3502cf1 dap: Move template selection into a picker
It's time to move all these components out of ui/editor.rs
3 years ago
Dmitry Sharshakov 6aa9838ea6
dap: support arrays as arguments 3 years ago
Blaž Hrastnik bda05ec4bf Use a newtype for ThreadId 3 years ago
Dmitry Sharshakov 814dcfa8d2
fix lints 3 years ago
Dmitry Sharshakov d943a51e3e
editor: add Node.js debugger 3 years ago
Dmitry Sharshakov 0e51e5fbaf
editor: support setExceptionBreakpoints 3 years ago
Dmitry Sharshakov 507a1f8dd6 Get breakpoint reports from debugger 3 years ago
Dmitry Sharshakov c9cd06e904 Fetch stack traces for all threads when debugger sets all_thread_stopped flag 3 years ago
Dmitry Sharshakov bdd636d8ee Clean up import 3 years ago
Dmitry Sharshakov 9b8c5bdade
Remove redundant fetching of stack traces 3 years ago
Dmitry Sharshakov b6c58ea23e
Support thread previews 3 years ago
Dmitry Sharshakov 8a609047c3 Mouse command for editing logpoint 3 years ago
Dmitry Sharshakov 3b0ec750ff Support editing breakpoint condition with right click 3 years ago
Dmitry Sharshakov 1befbd076c Add command for editing breakpoint condition 3 years ago
Dmitry Sharshakov 430c80ff2a Fix crash when trying to select (view) threads when debuggee is running 3 years ago
Dmitry Sharshakov c6186ce600 jump to selected stack frame 3 years ago
Dmitry Sharshakov 9a1916ebfd show thread states in thread picker 3 years ago
Dmitry Sharshakov 00cccdc62a
Don't show thread picker for single-threaded targets 3 years ago
Dmitry Sharshakov 9939dbf119 Fix clippy warnings 3 years ago
Dmitry Sharshakov cf7237d0b9
compat: make thread IDs signed
Delve needs it
3 years ago
Blaž Hrastnik c63ad60c31 dap: Allow switching between stack frames 3 years ago
Blaž Hrastnik b997d2cdeb dap: Allow setting breakpoints before starting the adapter 3 years ago
Blaž Hrastnik 289303a30d dap: small TODO 3 years ago
Blaž Hrastnik 42f9718f55 dap: Extract thread_picker, make pause explicitly select a thread 3 years ago
Blaž Hrastnik 27c1b3f98b dap: Extract a thread_states map 3 years ago
Blaž Hrastnik 5b920c53f0 Refactor resume_application state handling 3 years ago
Blaž Hrastnik 2c7b75475f dap: refactor frame handling 3 years ago
Blaž Hrastnik 986828e75c dap: Remap keys, match current thread behavior from dap-mode, switch-thread 3 years ago
Blaž Hrastnik d6ccc150c7 Extract dap commands into a separate file 3 years ago