Commit Graph

394 Commits (37f8cbed3c67ba21aa16049fe4190733f3ebcf0f)

Author SHA1 Message Date
Alexis (Poliorcetics) Bourget 34389e1d54 nit: Do less allocations in `ui::menu::Item::label` implementations
This complicates the code a little but it often divides by two the number of allocations done by
the functions. LSP labels especially can easily be called dozens of time in a single menu popup,
when listing references for example.
2022-10-21 07:42:33 -05:00
Skyler Hawthorne 5a848344a9
fix: write-all crash (#4384)
When we do auto formatting, the code that takes the LSP's response and applies
the changes to the document are just getting the currently focused view and
giving that to the function, basically always assuming that the document that
we're applying the change to is in focus, and not in a background view.

This is usually fine for a single view, even if it's a buffer in the
background, because it's still the same view and the selection will get updated
accordingly for when you switch back to it. But it's obviously a problem for
when there are multiple views, because if you don't have the target document in
focus, it will ask the document to update the wrong view, hence the crash.

The problem with this is picking which view to apply any selection change to.
In the absence of any more data points on the views themselves, we simply pick
the first view associated with the document we are saving.
2022-10-21 16:43:22 +09:00
Skyler Hawthorne f486f34ebe
flush writes on force quit (#4397)
When force quitting, we need to block on the pending writes to ensure
that write commands succeed before exiting, and also to avoid a crash
when all the views are gone before the auto format call returns from
the LS.
2022-10-21 13:28:29 +09:00
Charlie Groves 7e29ee6dae
Autosave all when the terminal loses focus (#3178)
* Autosave all when the terminal loses focus

* Correct comment on focus config

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

* Need a block_try_flush_writes in all quit_all paths

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-10-21 10:35:02 +09:00
Pascal Kuthe 9af7c1c9f3 Sort by fixed diagnostics/is_preffered within codeaction categories 2022-10-21 10:03:00 +09:00
Pascal Kuthe 189aa0bfcf never sort menu items when no fuzzy matching is possible 2022-10-21 10:03:00 +09:00
Pascal Kuthe dc3527f52d use permalink to vscode repo 2022-10-21 10:03:00 +09:00
Pascal Kuthe 8d8b5d6624 use stable sort instead of allocating new vectors 2022-10-21 10:03:00 +09:00
Pascal Kuthe 8673c1ec0c sort codeaction by their kind instead of alphabetically 2022-10-21 10:03:00 +09:00
Blaž Hrastnik 78c0cdc519
Merge pull request #2267 from dead10ck/fix-write-fail
Write path fixes
2022-10-20 23:11:22 +09:00
Fisher Darling 4174b25b3d
Pretty print `tree-sitter-subtree` expression (#4295) 2022-10-19 17:17:50 -05:00
Skyler Hawthorne 756253b43f fix tree_sitter_scopes 2022-10-19 00:01:00 -04:00
Skyler Hawthorne e645804b0a Editor::flush_writes returns an error 2022-10-18 22:31:39 -04:00
Blaž Hrastnik b0212b3611 Deduplicate flush_writes 2022-10-18 22:31:39 -04:00
Blaž Hrastnik 30c93994b5 Use a single save_queue on the editor 2022-10-18 22:31:39 -04:00
Skyler Hawthorne 31d1bbfddb review comments 2022-10-18 22:31:39 -04:00
Skyler Hawthorne b530a86d1f remove Callback::Compositor variant
To reduce likelihood of accidental discarding of important callbacks
2022-10-18 22:31:39 -04:00
Skyler Hawthorne af03df3413 fix write scratch buffer to file 2022-10-18 22:31:39 -04:00
Skyler Hawthorne 57de4e6251 various fixes in write-all path 2022-10-18 22:31:39 -04:00
Skyler Hawthorne e5fd5e2a9c fix panic when view of pending write is closed 2022-10-18 22:31:39 -04:00
Skyler Hawthorne aaa1450678 fix write-quit with auto format
write-quit will now save all files successfully even when there is auto
formatting
2022-10-18 22:31:39 -04:00
Skyler Hawthorne c9418582d2 fix modified status with auto format 2022-10-18 22:31:38 -04:00
Skyler Hawthorne cb23399dee improve reliability of shutdown 2022-10-18 22:31:38 -04:00
Skyler Hawthorne b8a07f7d15 add conditional noop render back
It makes it much slower without stubbing this out
2022-10-18 22:31:38 -04:00
Skyler Hawthorne 69c9e44ef2 update write-quit to wait for saves 2022-10-18 22:31:38 -04:00
Skyler Hawthorne e1f7bdb1d2 fix buffer-close 2022-10-18 22:31:38 -04:00
Skyler Hawthorne 83b6042b97 fix(write): do not set new path on document until write succeeds
If a document is written with a new path, currently, in the event that
the write fails, the document still gets its path changed. This fixes
it so that the path is not updated unless the write succeeds.
2022-10-18 22:31:38 -04:00
Skyler Hawthorne a5a93182cd fix: buffer-close ensuring writes
Make sure buffer-close waits for the document to finish its writes.
2022-10-18 22:31:38 -04:00
Skyler Hawthorne d706194597 chore(write): serialize write operations within a Document
The way that document writes are handled are by submitting them to the
async job pool, which are all executed opportunistically out of order. It
was discovered that this can lead to write inconsistencies when there
are multiple writes to the same file in quick succession.

This seeks to fix this problem by removing document writes from the
general pool of jobs and into its own specialized event. Now when a
user submits a write with one of the write commands, a request is simply
queued up in a new mpsc channel that each Document makes to handle its own
writes. This way, if multiple writes are submitted on the same document,
they are executed in order, while still allowing concurrent writes for
different documents.
2022-10-18 22:31:38 -04:00
Roberto Vidal 1f74cf45d4
display tree sitter scopes in a popup (#4337) 2022-10-19 00:00:00 +05:30
ZJPzjp 0e8e7cae3b
fix `:insert-output` doc: inserting output **before** each selection (#4286) 2022-10-15 11:07:42 -05:00
Michael Davis e16c632760
Apply transactions to the jumplist for undo/redo (#4227)
Undo/redo/earlier/later call `Document::apply_impl` which applies
transactions to the document. These transactions also need to be
applied to the view as in 0aedef0.
2022-10-13 00:57:40 +09:00
Michael Davis c388e16e09 Add a helper function for applying transactions
It is easy to forget to call `Document::apply` and/or `View::apply` in
the correct order. This commit introduces a helper function which
closes over both calls.
2022-10-11 12:17:32 +09:00
Michael Davis 0aedef0333 Apply transactions to Views
This change adds View::apply calls for all Document::apply call-sites,
ensuring that changes to a document do not leave invalid entries in
the View's jumplist.
2022-10-11 12:17:32 +09:00
A-Walrus 1d8bb2249b
Change focus to modified docs on quit (#3872)
* Change focus to modified docs on quit

When quitting with modified documents, automatically switch focus to
one of them.

* Update helix-term/src/commands/typed.rs

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>

* Make it work with buffer-close-all and the like

* Cleanup

Use Cow instead of String, and rename DoesntExist -> DoesNotExist

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
2022-10-04 00:07:21 +09:00
ath3 7c9809eeb2
Find workspace from document path (#3553) 2022-10-04 00:02:49 +09:00
Joe bcba5d67f9
Add goto preview (#2982) 2022-10-03 23:33:20 +09:00
Filipe Azevedo 385ccdfc9c
add :lsp-restart command (#3435) 2022-09-20 16:44:36 +09:00
Joe aa00a470f3
Fix preview bug (#3644)
* Fix preview bug

* Add comment to empty case
2022-09-20 16:40:48 +09:00
A-Walrus d38950bdf9
Remove border from code actions popup (#3444) 2022-09-13 05:24:48 -04:00
Blaž Hrastnik c2e41082e4
Remove the .txt suffix from tutor
The tutor file is loaded as .txt which can potentially spawn a
language server. Then the path is unset, but the LS remains active.
This can cause panics since updates are now submitted for a doc
with no path.

As a quick workaround we remove the extension which should avoid
detection.

Fixes #3730
2022-09-11 11:11:07 +09:00
A-Walrus 75e6a64327 Switch to Result for invalid language 2022-09-10 22:23:38 +09:00
A-Walrus e8add6f46d Add error handling to set language command
If you type a nonexistant language an appropriate message will show,
and the language won't be changed.
2022-09-10 22:23:38 +09:00
A-Walrus e14b48af2e
Fix :reflow panic by enusring cursor in view (#3733) 2022-09-07 12:50:54 -05:00
Frojdholm 4c9f144dac
fix: Recalculate completion when going through prompt history (#3193)
* fix: Recalculate completion when going through prompt history

* Update completion when the prompt line is changed

It should not be possible to update the line without also updating the
completion since the completion holds an index into the line.

* Fix Prompt::with_line recalculate completion

with_line was the last function where recalculate completion had to be
done manually. This function now also recalculates the completion so
that it's impossible to forget.

* Exit selection when recalculating completion

Keeping the selection index when the completion has been recalculated
doesn't make sense. This clears the selection automatically, removing
most needs to manually clear it.

* Remove &mut on save_filter

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-09-01 01:26:21 +09:00
Michael Davis 5f043dde56
Derive Document language name from languages.toml name key (#3338)
* Derive Document language name from `languages.toml` `name` key

This changes switches from deriving the language name from the
`languages.toml` `scope` key to `name` (`language_id` in the
`LanguageConfiguration` type). For the most part it works to derive the
language name from scope by chopping off `source.` or `rsplit_once` on
`.` but for some languages we have now like html (`text.html.basic`),
it doesn't. This also should be a more accurate fallback for the
`language_id` method which is used in LSP and currently uses the
`rsplit_once` strategy.

Here we expose the language's name as `language_name` on `Document` and
replace ad-hoc calculations of the language name with the new method.

This is most impactful for the `file-type` statusline element which is
using `language_id`.

* Use `Document::language_name` for the `file-type` statusline element

The `file-type` indicator element in the statusline was using
`Document::language_id` which is meant to be used to for telling
Language Servers what language we're using. That works for languages
with `language-server` configurations in `languages.toml` but shows
text otherwise. The new `Document::language_name` method from the
parent commit is a more accurate way to determine the language.
2022-08-30 10:59:45 +09:00
Michael Davis f32c05db85
Detect indent-style in `:set-language` (#3330)
Indent style may change when choosing a language with `:set-language`.
Line-endings most likely will not change, but `:set-language` should
have a similar effect as reloading a file (`:reload`), plus the two
are currently grouped in the implementation and line-ending detection
is not particularly expensive.
2022-08-05 09:11:31 +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
Danilo Spinella 110eb73045
Add cwd parameter which is not optional anymore (#3240) 2022-07-31 06:59:15 -05:00
Gokul Soumya a8b123fe17
Fix byte index error in signature help highlighting
The language server sends a char offset range within the
signature help label text to highlight as the current parameter,
but helix uses byte offset ranges for rendering highlights. This
was brought up in the [review of the original signature help PR][1],
but the ranges were being highlighted correctly, and there were no
out of bound or indexing panics. Turns out rust-analyzer was
[incorrectly sending byte offsets] instead of char offsets and this
made it seem like all was well and good with offsets in helix during
initial testing.

[1]: https://github.com/helix-editor/helix/pull/1755#discussion_r906715371
[2]: https://github.com/rust-lang/rust-analyzer/pull/12272
2022-07-29 14:31:21 +09:00
Gokul Soumya de8ade8967
Shorten embedded command descriptions (#3070)
* Shorten embedded command descriptions

- Compact descriptions in command palette and infobox

* Shorten typed command descriptions

* Fix typo in decrement command description
2022-07-26 12:04:23 +09:00
Alexis Kalabura 8b2a14153b
add statusline element to display file line endings (#3113)
* add statusline element to display file line endings

* run cargo fmt --all

* change the word *ending* from plural to singular

* support for the unicode-lines feature flag
2022-07-21 13:03:12 +09:00
Gokul Soumya 791bf7e50a
Add lsp signature help (#1755)
* Add lsp signature help

* Do not move signature help popup on multiple triggers

* Highlight current parameter in signature help

* Auto close signature help

* Position signature help above to not block completion

* Update signature help on backspace/insert mode delete

* Add lsp.auto-signature-help config option

* Add serde default annotation for LspConfig

* Show LSP inactive message only if signature help is invoked manually

* Do not assume valid signature help response from LSP

Malformed LSP responses are common, and these should not crash the
editor.

* Check signature help capability before sending request

* Reuse Open enum for PositionBias in popup

* Close signature popup and exit insert mode on escape

* Add config to control signature help docs display

* Use new Margin api in signature help

* Invoke signature help on changing to insert mode
2022-07-19 11:28:24 +09:00
Bob e5c7aaed91
support prefilling prompt (#2459)
* support prefilling prompt

* introduce with_line builder method in Prompt

* extract show_prompt

* use textobject_word as fallback input
2022-07-18 10:17:13 +09:00
Gokul Soumya af35c62407 Show file path only in workspace diagnostic picker 2022-07-06 13:06:46 +02:00
Gokul Soumya a43bcc8765 Display error code only if not none 2022-07-06 13:06:46 +02:00
Gokul Soumya 2c37e25cb5 Display diagnostic text before code in picker 2022-07-06 13:06:46 +02:00
Gokul Soumya c4e022971d Remove source from diagnostic picker display
It is usually the name of the LSP and doesn't add much
useful information.
2022-07-06 13:06:46 +02:00
Joe b26e7e2e8f
Add live preview to theme picker (#1798)
* Add theme picker with live preview

* Add live theme preview to :theme command

* cargo fmt

* Fix clippy warnings

* Remove picker variant

* Remove unused import

* Cleanup

* Change current_theme to last_theme

* Fix accidental comment flash deletion

* Typo

* Remove theme cache

* Add some comments

* Refactor some theme handling

TIL flatmap on Option is called  and_then

* Remove unnecessary renames

* Constrain last_theme theme preview lifecycle

* Switch to bitflag implementation

* Better handling of last_theme

* Sort theme names

* Better memory juggling

* Missed a branch

* Remove name from theme, switch bitand to &

* cargo fmt

* Update helix-view/src/editor.rs

* Switch boolean to enum

* Remove bitflag impl

* cargo fmt

* Remove un-needed type arg

* cargo fmt
2022-07-05 19:44:16 +09:00
Gokul Soumya 6e2aaed5c2
Reuse menu::Item trait in picker (#2814)
* Refactor menu::Item to accomodate external state

Will be useful for storing editor state when reused by pickers.

* Add some type aliases for readability

* Reuse menu::Item trait in picker

This opens the way for merging the menu and picker code in the
future, since a picker is essentially a menu + prompt. More
excitingly, this change will also allow aligning items in the
picker, which would be useful (for example) in the command palette
for aligning the descriptions to the left and the keybinds to
the right in two separate columns.

The item formatting of each picker has been kept as is, even though
there is room for improvement now that we can format the data into
columns, since that is better tackled in a separate PR.

* Rename menu::Item::EditorData to Data

* Call and inline filter_text() in sort_text() completion

* Rename diagnostic picker's Item::Data
2022-07-02 13:21:27 +02: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
lazytanuki 096abdd19b
feat: highlight / select symbol under cursor using LSP textDocument/documentHighlight (#2738)
* feat: highlight symbol under cursor using LSP textDocument/documentHighlight

* fix: please clippy

* fix: shorter description and code style
2022-06-27 20:19:56 +09:00
Blaž Hrastnik 23b5b1e25a Remove a couple more unwraps 2022-06-22 02:26:24 +09:00
Blaž Hrastnik 19dccade7c
Merge pull request #2359 from dead10ck/test-harness
Integration testing harness
2022-06-21 18:59:02 +02:00
Gokul Soumya 8e8367eea6
Refactor Margin for fine grained control (#2727) 2022-06-22 01:52:08 +09:00
ath3 ce85b9716d
Enable shellwords for Windows (with escaping disabled) (#2767) 2022-06-22 01:48:01 +09:00
Skyler Hawthorne 41bf1d5811 fix(command): write-quit: do not quit if write fails
During write-quit, if the file fails to be written for any reason, helix
will still quit without saving the changes. This fixes this behavior by
introducing fallibility to the asynchronous job queues. This will also
benefit all contexts which may depend on these job queues.

Fixes #1575
2022-06-18 23:57:47 -04:00
Skyler Hawthorne ed950fcc56 Add more context; Editor::open doesn't need to own path 2022-06-18 23:57:45 -04:00
Gygaxis Vainhardt debd2405d9
views -> buffers in write-all (#2788) 2022-06-16 16:09:30 -05:00
Gokul Soumya e9283b20b4
Add docstring for language_server!() macro (#2750) 2022-06-12 09:53:58 +09:00
Blaž Hrastnik 26dbdb70fb
Refactor push_jump so we're not needlessly fetching doc twice 2022-06-07 00:23:41 +09:00
Termina94 f1ae496860
Add shell insert commands to typable and config (#2589)
* Add shell insert commands to typable and config

* generate docs

Co-authored-by: Dean Revell <revell@gmail.com>
2022-06-05 19:52:41 +09:00
Michael Davis 1c2aaf3baf
ensure :quit and :quit! take no arguments (#2654) 2022-06-05 19:48:16 +09:00
yzwduck d24ca66dbb
Avoid modifying jumplist until jumping to ref (#2670)
When a goto command is cancelled, the jumplist should remain unchanged.

This commit delays saving the current selection to the jumplist until
jumping to a reference.
2022-06-05 19:44:55 +09:00
Kirawi 4f3d0a7706
append `set_line_ending` to document history (#2649) 2022-06-02 10:46:53 -05:00
Blaž Hrastnik 378f438fb0
fix: lsp: be more defensive about URI conversions 2022-06-02 14:07:19 +09:00
Blaž Hrastnik 6de6a3edbb
fix: lsp: be more defensive about URI conversions 2022-06-02 14:07:19 +09:00
Ryan Russell ae12c58f0f
Improve Readability (#2639) 2022-06-01 12:01:37 -05:00
Leoi Hung Kin 5c864922d8
Fix panic when reloading a shrunk file (#2506)
* fix panic when reloading a shrunk file

* linting

* use scrolloff
2022-05-22 10:24:32 +09:00
amaihoefner a5bc69c2b5
feat(commands): add log-open command (#2422) 2022-05-11 10:18:45 +09:00
Ben Lee-Cohen 09a17e4fa3
Making the 'set-option' command help more descriptive. (#2365)
* Making the 'set-option' command help more descriptive.

* Adding the generated docs

* Making the message multi-line

* Replace newline with break in generated docs
2022-05-04 11:17:08 +09:00
unrelentingtech 20162a426b
feat(commands): make it possible to disable format-on-save via the 'auto-format' option (#2321) 2022-05-02 23:31:07 +09: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
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>
2022-05-02 23:15:02 +09:00
chunghha 3a398eec56
fix typos (#2304) 2022-04-27 14:21:20 -05:00
Michael Davis 773736b03a
Fix paste direction for typed paste commands (#2288) 2022-04-26 23:01:45 +05:30
Daniel 15db6031bb
Add :get-option command (#2231) 2022-04-24 16:00:18 +05:30
ttys3 19d042dde6
chore(lsp): check rename capabilities before send rename action (#2203) 2022-04-23 17:09:16 +09:00
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
2022-04-23 17:01:08 +09:00
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
2022-04-17 12:05:23 +09:00
Thomas 2eca2901f3
Pipe typable command (#1972)
Co-authored-by: DeviousStoat <devious@stoat.com>
2022-04-17 12:03:47 +09:00
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
2022-04-12 16:52:54 +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
Dr. David A. Kunz 9782204f73
Add typed commands buffer-next and buffer-previous (#1940) 2022-04-03 17:56:46 +05:30
Marcin Puc f2dd3d4469
Avoid using the format ident Rust feature (#1881) 2022-03-30 09:08:30 +09:00
Blaž Hrastnik a516f5881b
Address clippy lint 2022-03-28 11:03:42 +09:00
Blaž Hrastnik 4940db3e2d
Make truncate_start a builder method instead 2022-03-28 11:02:49 +09:00
Blaž Hrastnik 20cf75dfa1
Strip some more params 2022-03-28 11:02:39 +09:00
Blaž Hrastnik 96a4eb8483
Remove more push_layer calls 2022-03-28 11:02:21 +09:00
Blaž Hrastnik 9a6ee88e66
Split off dap event handlers into helix-view to allow reuse 2022-03-28 11:01:59 +09:00
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>
2022-03-25 18:05:20 +09:00
Blaž Hrastnik f67e1ee172
Put esoteric line endings behind a feature flag 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
Joe c0dbd6dc3f
Add horizontal and vertical split scratch buffers (#1763)
Make subcommand name more descriptive

Fix vsplit completer

Run cargo xtask docgen
2022-03-14 11:47:52 +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
Emil Fresk bfa533fe78
Fix bug in LSP when creating a file in a folder that does not exist (#1775) 2022-03-09 00:21:19 +05:30
Blaž Hrastnik 5a60989efe
Bump dependencies 2022-03-08 10:33:40 +09:00
Blaž Hrastnik 19247ff0ec
Split out typable commands into a separate file 2022-03-07 14:41:28 +09:00
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
2022-03-03 10:14:50 +09:00
Gokul Soumya 8e07e1b898
Alert if LSP is inactive when command is invoked (#1703) 2022-02-25 17:53:10 +09:00
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
2022-02-23 12:46:12 +09:00
Alex d5ba0b5162
Allow separate styles for markup headings (#1618)
* update markdown highlighting to use separate heading themes

* remove markdown theme scopes in ui
2022-02-21 16:45:48 +09:00
Blaž Hrastnik a449156702 Extract a lsp position helper 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 5af9136aec Extract some duplication in lsp goto_ calls 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 1cd710fe01 Extract jump_to_location 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 4e845409b6 Extract a common "language server or return" macro 2022-02-18 14:37:59 +09:00
Blaž Hrastnik c06155ace4 Extract a helper function for lsp::Location 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 504d5ce8bd Move most LSP specific commmands to commands::lsp 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 7b1d682fe5 dap: fix runInTerminal with lldb-vscode 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 4e1b3b12f3 Refactor symbol picker to share code 2022-02-18 13:50:06 +09:00
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).
2022-02-17 14:02:42 +09:00
Blaž Hrastnik d11b652139 Allow static strings in set_status/set_error so API is nicer 2022-02-15 16:45:28 +09:00
Blaž Hrastnik fd0e4b1159 dap: Reduce amount of block_on uses 2022-02-15 16:30:23 +09:00
Blaž Hrastnik 1422449537 .. 2022-02-15 11:37:33 +09:00
Blaž Hrastnik eeb9b39857 Fix build on master 2022-02-15 10:33:55 +09:00
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2022-02-13 18:31:51 +09:00
Blaž Hrastnik 7ad8eaaef0 wip 2021-12-14 00:41:51 +09:00
Blaž Hrastnik df3b88387b dap: Improve variables UI 2021-12-09 11:28:53 +09:00
Blaž Hrastnik dac317e620 TODO 2021-12-09 10:55:32 +09:00
Blaž Hrastnik 60c86eff89 dap: Simplify a few more statements that could use the debugger macro 2021-12-09 10:55:32 +09:00
Blaž Hrastnik d8351d35ab dap: Extract a macro that fetches a debugger or returns 2021-12-08 00:59:11 +09:00
Blaž Hrastnik e98993d609 dap: Fix an off-by-one error when jumping 2021-12-08 00:22:48 +09:00
Blaž Hrastnik bf8437d098 clippy lint 2021-12-06 09:36:02 +09:00
Blaž Hrastnik dc8df7ba21 Make thread_picker non-blocking 2021-12-06 09:35:59 +09:00
Blaž Hrastnik d5d1a9b1ae
Apply suggestions from code review
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2021-12-06 09:32:11 +09:00
Blaž Hrastnik 43fbb6d965 Make dap_start non-blocking 2021-12-03 13:27:00 +09:00
Blaž Hrastnik 2dbf966293 dap: Start working on runInTerminal support 2021-12-03 11:59:44 +09:00
Blaž Hrastnik d14ca05d6b Simplify some cases that use return None to use ? 2021-12-02 10:31:19 +09:00
Blaž Hrastnik de5e5863aa dap: Use cursor_line over cursor + char_to_line 2021-12-02 10:24:17 +09:00
Blaž Hrastnik 54f8e5c9c3 dap: Fix an off-by-one and move the function over to commands/dap 2021-12-02 10:22:17 +09:00
Blaž Hrastnik 573cb39926 dap: Remove some unwraps 2021-12-02 10:20:19 +09:00
Blaž Hrastnik ffc89e483b Mark some more TODOs as resolved 2021-12-01 19:28:29 +09:00
Blaž Hrastnik b4fd3148e3 These TODOs have been resolved 2021-12-01 12:56:41 +09:00
Blaž Hrastnik 8ffafb826f dap: Rewrite breakpoints so that there's a single set maintained 2021-11-30 17:56:00 +09:00
Blaž Hrastnik 3633f85b38 Pass editor into render_view & gutter, reducing the number of params 2021-11-30 16:47:46 +09:00
Blaž Hrastnik 85b4410703 dap: Toggle breakpoints without changing selection, fix offset calc 2021-11-22 16:30:35 +09:00
Blaž Hrastnik b55ca8fdb8 dap: Always edit breakpoints on the correct document 2021-11-22 11:22:08 +09:00
Blaž Hrastnik 0eadeab8c7 dap: Remove the prompt line parameter, use insert_str instead 2021-11-22 11:14:10 +09:00
Blaž Hrastnik 5f329a22c4 dap: Modify breakpoints in place with no cloning 2021-11-22 11:09:09 +09:00
Blaž Hrastnik 05d3ad4a0e dap: Remove an excess clone on enable_exceptions 2021-11-22 00:02:58 +09:00
Blaž Hrastnik c39d9f44a0 dap: Simplify debug_parameter_prompt 2021-11-07 21:58:06 +09:00
Blaž Hrastnik 3042ff3e5a dap: Clean up dap_start_impl, no need to clone arg keys 2021-11-07 21:47:44 +09:00
Blaž Hrastnik 9963a5614d dap: Minor simplifications 2021-11-07 21:37:00 +09:00
Blaž Hrastnik 65868081fc dap: Simplify launch & start
There's no need to re-detect language config, just use the one available
on the document.
2021-11-07 21:26:03 +09:00
Blaž Hrastnik 4f2a01cc09 dap: Error implements Display so we can format with {} 2021-11-07 21:20:58 +09:00
Blaž Hrastnik 2bd8a9b39d dap: Consistently rename type as ty 2021-11-07 21:18:53 +09:00
Blaž Hrastnik 9dd17c46a2 dap: Avoid cloning old_breakpoints if we are immediately replacing them 2021-11-07 18:58:47 +09:00
Blaž Hrastnik 757babb1b4 dap: Avoid cloning *entire* stack frames when picking a thread 2021-11-07 18:56:09 +09:00
Blaž Hrastnik 5803de2067 dap: Simplify more calls 2021-11-07 18:51:29 +09:00
Blaž Hrastnik 9baddc825d dap: Get rid of excessive cloning 2021-11-07 18:38:04 +09:00
Blaž Hrastnik fd9b826f2c dap: Inline empty completer 2021-11-07 18:15:17 +09:00
Blaž Hrastnik 5938ab1bf1 dap: Fully extract template parameter prompts 2021-11-07 18:13:37 +09:00
Blaž Hrastnik 3b8d5102ac Make picker take the whole context, not just editor 2021-11-07 18:03:04 +09:00
Blaž Hrastnik 64bb1f7563 dap: Extract out variable rendering
Will improve on the UI later
2021-11-07 17:55:01 +09:00
Blaž Hrastnik 2e1aa5f15b Fix compilation 2021-11-07 00:32:28 +09:00
Blaž Hrastnik 14a3502cf1 dap: Move template selection into a picker
It's time to move all these components out of ui/editor.rs
2021-11-07 00:28:57 +09:00
Dmitry Sharshakov 6aa9838ea6
dap: support arrays as arguments 2021-10-24 17:24:18 +03:00
Blaž Hrastnik bda05ec4bf Use a newtype for ThreadId 2021-10-17 14:06:52 +09:00
Dmitry Sharshakov 814dcfa8d2
fix lints 2021-09-26 21:54:36 +03:00
Dmitry Sharshakov d943a51e3e
editor: add Node.js debugger 2021-09-26 21:36:06 +03:00
Dmitry Sharshakov 0e51e5fbaf
editor: support setExceptionBreakpoints 2021-09-26 10:24:58 +03:00
Dmitry Sharshakov 507a1f8dd6 Get breakpoint reports from debugger 2021-09-06 08:47:54 +03:00
Dmitry Sharshakov c9cd06e904 Fetch stack traces for all threads when debugger sets all_thread_stopped flag 2021-09-05 16:09:38 +03:00
Dmitry Sharshakov bdd636d8ee Clean up import 2021-09-05 15:21:39 +03:00
Dmitry Sharshakov 9b8c5bdade
Remove redundant fetching of stack traces 2021-09-05 15:19:52 +03:00
Dmitry Sharshakov b6c58ea23e
Support thread previews 2021-09-05 13:39:27 +03:00
Dmitry Sharshakov 8a609047c3 Mouse command for editing logpoint 2021-09-05 08:50:03 +03:00
Dmitry Sharshakov 3b0ec750ff Support editing breakpoint condition with right click 2021-09-05 08:14:17 +03:00
Dmitry Sharshakov 1befbd076c Add command for editing breakpoint condition 2021-09-04 22:57:58 +03:00
Dmitry Sharshakov 430c80ff2a Fix crash when trying to select (view) threads when debuggee is running 2021-09-04 10:28:11 +03:00
Dmitry Sharshakov c6186ce600 jump to selected stack frame 2021-09-04 10:24:00 +03:00
Dmitry Sharshakov 9a1916ebfd show thread states in thread picker 2021-09-04 10:14:04 +03:00
Dmitry Sharshakov 00cccdc62a
Don't show thread picker for single-threaded targets 2021-09-04 09:19:19 +03:00
Dmitry Sharshakov 9939dbf119 Fix clippy warnings 2021-09-04 09:08:52 +03:00
Dmitry Sharshakov cf7237d0b9
compat: make thread IDs signed
Delve needs it
2021-09-03 23:11:06 +03:00
Blaž Hrastnik c63ad60c31 dap: Allow switching between stack frames 2021-09-03 17:25:11 +09:00
Blaž Hrastnik b997d2cdeb dap: Allow setting breakpoints before starting the adapter 2021-09-03 13:26:30 +09:00
Blaž Hrastnik 289303a30d dap: small TODO 2021-09-03 11:48:55 +09:00
Blaž Hrastnik 42f9718f55 dap: Extract thread_picker, make pause explicitly select a thread 2021-09-03 11:43:11 +09:00
Blaž Hrastnik 27c1b3f98b dap: Extract a thread_states map 2021-09-03 11:30:25 +09:00
Blaž Hrastnik 5b920c53f0 Refactor resume_application state handling 2021-09-03 11:11:22 +09:00
Blaž Hrastnik 2c7b75475f dap: refactor frame handling 2021-08-30 11:07:59 +09:00
Blaž Hrastnik 986828e75c dap: Remap keys, match current thread behavior from dap-mode, switch-thread 2021-08-29 23:32:46 +09:00
Blaž Hrastnik d6ccc150c7 Extract dap commands into a separate file 2021-08-29 22:43:08 +09:00