Commit graph

508 commits

Author SHA1 Message Date
dependabot[bot]
5dfdc95f6f
build(deps): bump once_cell from 1.8.0 to 1.9.0 (#1322)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.8.0...v1.9.0)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-21 08:48:53 +09:00
Gokul Soumya
d4fb1d0633 Merge branch 'master' into cursor-shape-new 2021-12-18 08:33:15 +05:30
Gokul Soumya
016640f4fb Remove ui.cursor.primary and hashmap lookups 2021-12-18 08:26:11 +05:30
Blaž Hrastnik
730d3be201 Add ui.gutter to theme all gutters (i.e. set bg) 2021-12-14 00:52:15 +09:00
Omnikar
42e6d96a75 Use base16_tty as 16-color default, fix theme name 2021-12-14 00:48:45 +09:00
NNB
d9727868dd change to .unwrap_or_default() and fix ui.window and ui.statusline 2021-12-14 00:48:45 +09:00
NNB
a9a9d498e8 Update theme.rs 2021-12-14 00:47:30 +09:00
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`
2021-12-14 00:47:18 +09:00
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
2021-12-12 21:16:48 +09:00
Blaž Hrastnik
35ac815409 Fix compilation
nix-direnv issues still mess with my shell..
2021-12-06 12:50:28 +09:00
Blaž Hrastnik
a2b22ec152 Use binary_search when looking up diagnostics
They're sorted by range so they should also be sorted by line
2021-12-06 12:48:25 +09:00
Blaž Hrastnik
cab09093dd fix: Normalize backtab into shift-tab
Fixes #1150
2021-12-06 12:25:19 +09:00
Blaž Hrastnik
34f46e7502 Bump rust to 1.57, fix new lint failures 2021-12-03 12:48:07 +09:00
Ivan Tham
e2b428cc2d
Add last modified file (gm) (#1093) 2021-12-02 13:46:57 +09:00
Blaž Hrastnik
d14ca05d6b Simplify some cases that use return None to use ? 2021-12-02 10:31:19 +09:00
Blaž Hrastnik
ffc89e483b Mark some more TODOs as resolved 2021-12-01 19:28:29 +09:00
Blaž Hrastnik
662ecf0cd4 Annotate Theme::highlight with #[inline] 2021-12-01 13:13:50 +09:00
Blaž Hrastnik
259678585c ui: Optimize tree-sitter style lookups
Tree sitter returns an index referring to the position of the scope in
the scopes array. We can use that same index to avoid a hashmap lookup
and instead store the styles in an array.

This currently stores the styles in both a map and an array because the
UI still uses hashmap lookups, but it's a reasonable tradeoff.
2021-12-01 13:08:20 +09:00
Blaž Hrastnik
84e939ef58 Provide a single gutter component that does breakpoint || diagnostic 2021-12-01 00:24:45 +09:00
Blaž Hrastnik
d906911417 dap: Prevent crashes on files with no name or breakpoints 2021-11-30 17:59:30 +09:00
Blaž Hrastnik
30ac5869df dap: Extract diagnostics gutter into gutters.rs 2021-11-30 17:56:00 +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
9ed930b233 Merge remote-tracking branch 'origin/master' into debug 2021-11-30 13:06:30 +09:00
Gokul Soumya
058796c18e Change default cursors to block for all modes 2021-11-29 11:09:04 +05:30
Blaž Hrastnik
225e8ccf31 Extract gutters into helix-view 2021-11-29 11:00:28 +09:00
Blaž Hrastnik
30171416cb Gutter functions 2021-11-29 11:00:28 +09:00
RustyStriker
103b5125e4
Detect filetype on :write (#1141)
fixes #1136

* removed a log::info

* removed temp.rs

* cargo clippy no longer complains

* new get_lang_server function

* get_lang_server is now launch_language_server

* launch_lang_server will now close the previous one

* better code readability

* remove resfresh_ls(and a wrong comment)
2021-11-28 10:19:54 +09:00
Blaž Hrastnik
6e62c3de47 Simplify some code in editor.rs 2021-11-26 18:26:22 +09:00
Gokul Soumya
17473b51d3 Use serde attribute to rename to lowercase 2021-11-25 22:35:07 +05:30
Ivan Tham
67bf4250ca
Optimize space for DocumentId with NonZeroUsize (#1097)
Now Option<DocumentId> uses one byte rather than two
2021-11-25 11:07:23 +09:00
Gokul Soumya
7961355ba1 Change cursor shape on mode change
Fixes #323. Due to terminal limitations we can only
change the shape of the primary cursor.
2021-11-24 12:26:49 +05:30
Blaž Hrastnik
177b6fcdc9 cargo fmt 2021-11-22 12:10:37 +09:00
Blaž Hrastnik
5f329a22c4 dap: Modify breakpoints in place with no cloning 2021-11-22 11:09:09 +09:00
Blaž Hrastnik
d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 2021-11-21 20:06:45 +09:00
Dan Nases Sha
6a4d9693ba
File picker config (#988)
* squashed WIP commits

* hide_gitignore working with config

* pass reference to new config parameter of file_picker()

* update config option name to match name on walk builder

* add comments to config and documentation of option to book

* add git_ignore option to WalkBuilder within prompt in commands.rs

* WIP: add FilePickerConfig struct

* WIP: cleanup

* WIP: add more options including max_depth

* WIP: changed defaults to match ignore crate defaults

* WIP: change WalkBuilder in global_search() to use config options

* WIP: removed follow_links, changed max_depth to follow config setting

* WIP: update book with file-picker inline table notation

* update documentation for file-picker config in book

* adjusted to [editor.file-picker] in book configuration.md

* adjust comments in editor.rs to be doc comments, cleanup

* adjust comments

* adjust book
2021-11-20 23:23:36 +09:00
Blaž Hrastnik
27ceeb83bb Simplify view/doc macros 2021-11-18 14:13:42 +09:00
Cole Helbling
225e7904ec
helix-view/editor: use SCRATCH_BUFFER_NAME const (#1104) 2021-11-16 01:46:39 +09:00
Cole Helbling
c638b6b60e
helix-term/commands: implement buffer-close (bc, bclose) (#1035)
* helix-view/view: impl method to remove document from jumps

* helix-view/editor: impl close_document

* helix-view/editor: remove close_buffer argument from `close`

According to archseer, this was never implemented or used properly. Now
that we have a proper "buffer close" function, we can get rid of this.

* helix-term/commands: implement buffer-close (bc, bclose)

This behaves the same as Kakoune's `delete-buffer` / `db` command:

* With 3 files opened by the user with `:o ab`, `:o cd`, and `:o ef`:
  * `buffer-close` once closes `ef` and switches to `cd`
  * `buffer-close` again closes `cd` and switches to `ab`
  * `buffer-close` again closes `ab` and switches to a scratch buffer
* With 3 files opened from the command line with `hx -- ab cd ef`:
  * `buffer-close` once closes `ab` and switches to `cd`
  * `buffer-close` again closes `cd` and switches to `ef`
  * `buffer-close` again closes `ef` and switches to a scratch buffer
* With 1 file opened (`ab`):
  * `buffer-close` once closes `ab` and switches to a scratch buffer
  * `buffer-close` again closes the scratch buffer and switches to a new
    scratch buffer

* helix-term/commands: implement buffer-close! (bclose!, bc!)

Namely, if you have a document open in multiple splits, all the splits
will  be closed at the same time, leaving only splits without that
document focused (or a scratch buffer if they were all focused on that
buffer).

* helix-view/tree: reset focus if Tree is empty
2021-11-16 00:30:45 +09:00
Cole Helbling
87e61a0894
helix-term/commands: implement cquit (#1096)
This allows you to exit helix with an exit code, e.g. `:cq 2`.
2021-11-15 13:06:12 +09:00
ath3
35c974c9c4
Implement "Goto last modification" command (#1067) 2021-11-15 00:11:53 +09:00
Cole Helbling
b824e091a9
helix-term/commands: move SCRATCH_BUFFER_NAME to helix-view/document (#1091)
This way, the name is accessible everywhere `Document` and related types
are.
2021-11-13 13:15:41 +09:00
Ivan Tham
9d591427be
Fix earlier/later missing changeset update (#1069)
Fix #1059
2021-11-11 22:32:44 +09:00
Jason Hansen
cf831b1a65
Allow piping from stdin into a buffer on startup (#996)
* Allow piping from stdin into a buffer on startup

* Refactor

* Don't allow piping into new buffer on macOS

* Update helix-term/src/application.rs

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

* Update helix-term/src/application.rs

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

* Fix

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-11-10 10:53:14 +09:00
CossonLeo
a69caff450
search_impl will only align cursor center when it isn't in view (#959) 2021-11-09 11:11:45 +09:00
Blaž Hrastnik
549cdee561 Refactor shebang detection to reuse the loaded buffer 2021-11-09 00:30:34 +09:00
ath3
77dbbc73f9
Detect filetype from shebang line (#1001) 2021-11-09 00:19:44 +09:00
CossonLeo
29e6849413
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
2021-11-09 00:17:54 +09:00
Blaž Hrastnik
5938ab1bf1 dap: Fully extract template parameter prompts 2021-11-07 18:13:37 +09:00
Blaž Hrastnik
64bb1f7563 dap: Extract out variable rendering
Will improve on the UI later
2021-11-07 17:55:01 +09:00
Omnikar
ed23057ff8
Launch with defaults upon invalid config/theme (#982)
* Launch with defaults upon invalid config/theme

* Startup message if there is a problematic config
* Statusline error if trying to switch to an invalid theme

* Use serde `deny_unknown_fields` for config
2021-11-07 00:57:14 +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
Blaž Hrastnik
f2b709a3c3 Merge branch 'master' into debug 2021-11-07 00:28:19 +09:00
Blaž Hrastnik
e80708eba7 Make sure document diagnostics are sorted 2021-11-06 18:58:58 +09:00
Omnikar
cfc8285867
Allow infoboxes to be disabled (#972)
* Allow infoboxes to be disabled

* Document `infoboxes` default value

* Rename `infoboxes` to `auto_info`

* Document `auto-info`

* Fix incomplete rename
2021-11-05 11:25:08 +09:00
Omnikar
51b4d35dce
Inform when reaching undo/redo bounds (#981)
* Inform when reaching undo/redo bounds

* `Already at oldest change` when undo fails
* `Already at newest change` when redo fails

* Add missing `the`
2021-11-05 10:20:06 +09:00
ath3
aa4d0b4646
Fix crash on changing from empty scratch buffer to itself (#975) 2021-11-04 17:57:04 +09:00
Blaž Hrastnik
e2560f427e Replace documents SlotMap with BTreeMap 2021-11-04 13:43:45 +09:00
Ivan Tham
3eb829e233
Ensure coords in screen depends on char width (#885)
The issue affected files with lots of tabs at the start as well.

Fix #840
2021-11-03 12:02:29 +09:00
Daniel Ebert
eb8745db09 Implement key ordering for info box 2021-11-03 11:56:55 +09:00
Omnikar
2f8ad7f890
If switching away from an empty scratch buffer, remove it (#935)
* If switching away from an empty scratch buffer, remove it

* Move `view.jumps.push` call into `else` clause

* Refactor
2021-10-31 09:42:49 +09:00
Kirawi
cec0cfdaec
Uncomment mapping LSP diagnostics through changes (#925) 2021-10-29 10:11:30 +09:00
Blaž Hrastnik
f3c7f20dbc Release v0.5.0 2021-10-28 16:41:34 +09:00
Blaž Hrastnik
c1e5831b21 set_path: Pass in the function directly 2021-10-28 10:51:19 +09:00
Blaž Hrastnik
3e69a4852e Simplify set_path 2021-10-28 10:50:17 +09:00
Omnikar
e2ed691537
Implement hx --tutor and :tutor to load tutor.txt (#898)
* Implement `hx --tutor` and `:tutor` to load `tutor.txt`

* Document `hx --tutor` and `:tutor`

* Change `Document::set_path` to take an `Option`

* `Document::set_path` accepts an `Option<&Path>` instead of `&Path`.
* Remove `Editor::open_tutor` and make tutor-open functionality use
  `Editor::open` and `Document::set_path`.

* Use `PathBuf::join`

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Add comments explaining unsetting tutor path

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-10-28 10:23:46 +09:00
Blaž Hrastnik
e36ad8b4ed minor: Further simplify take_with 2021-10-27 12:25:00 +09:00
Blaž Hrastnik
3edca7854e completion: fully revert state before apply & insertText common prefix 2021-10-25 11:09:09 +09:00
CossonLeo
2ed01f2d9c
find motion and textobj motion repeat (#891) 2021-10-24 22:47:10 +09:00
Blaž Hrastnik
c913bade0a fix: Indentation used different default on hx vs hx new_file.txt 2021-10-24 17:20:30 +09:00
Kirawi
0cb5e0b2ca
log syntax highlighting init errors (#895) 2021-10-23 21:52:18 +09:00
Oskar Nehlin
0f886af4b9
Add commands for moving between splits with a direction (#860)
* Add commands for moving between splits with a direction

* Update keymaps

* Change picker mapping

* Add test and clean up some comments
2021-10-23 20:06:40 +09:00
Blaž Hrastnik
182a59b552 Update to rust 1.56 + 2021 edition 2021-10-22 12:15:18 +09:00
Blaž Hrastnik
9688cb74a1 Update dependencies to bump crossterm to 0.22.1
Fixes #825
Fixes #690
2021-10-19 23:58:51 +09:00
CossonLeo
9ac0c95161
Improve completion trigger (#838)
* improve idle completion trigger

* add completion-trigger-len to book

* rename semantics_completion to language_server_completion and optimize idle completion trigger
2021-10-18 15:14:50 +09:00
Blaž Hrastnik
0a6b60085a Merge branch 'master' into debug 2021-10-17 13:51:56 +09:00
Ivan Tham
89707a858f
Make auto-completion a config (#853) 2021-10-16 22:57:41 +09:00
Blaž Hrastnik
a930f99179 fix: Make sure to actually use idle_timeout config value for the timers 2021-10-10 22:39:47 +09:00
Blaž Hrastnik
633b981db2 Make idle-timeout configurable 2021-10-10 12:32:06 +09:00
Blaž Hrastnik
66f26e82ce Filter the initial completion 2021-10-05 22:27:35 +09:00
Blaž Hrastnik
f99bea404f idle timer wip 2021-10-05 22:27:10 +09:00
Dmitry Sharshakov
bf53aff27d Merge branch 'master' into debug 2021-09-25 23:14:59 +03:00
lurpahi
a958d34bfb
Add option for automatic insertion of closing-parens/brackets/etc (#779)
* Add auto-pair editor option

* Document auto-pair editor option

* Make cargo fmt happy

* Actually make cargo fmt happy

* Rename auto-pair option to auto-pairs

* Inline a few constants

Co-authored-by: miaomai <cunso@tutanota.com>
2021-09-24 10:28:44 +09:00
kraem
4a003782a5
enable smart case regex search by default (#761) 2021-09-20 13:45:07 +09:00
Kirawi
ef532e0c0d
log errors produced when trying to initialize the LSP (#746) 2021-09-15 14:58:06 +09:00
Blaž Hrastnik
0b1bc566e4 fix: lsp: Regression with textDocument/didSave not getting sent 2021-09-09 11:54:43 +09:00
Blaž Hrastnik
72cf86e462 Regex prompts should have a history with a specifiable register 2021-09-08 16:34:04 +09:00
Blaž Hrastnik
64099af3f1 Don't panic on save if language_server isn't initialized 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
37606bad47 lsp: doc.language_server() is None until initialize completes 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
46f3c69f06 lsp: Don't send notifications until initialize completes
Then send open events for all documents with the LSP attached.
2021-09-06 15:25:46 +09:00
Blaž Hrastnik
59ed1c8c78 Simplify documents & documents_mut() 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
dc7799b980 lsp: Refactor code that could use document_by_path_mut 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
10b690b5bd Drop some &mut bounds where & would have sufficed 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
800d79b584 ls: Refactor textDocument/didSave in a similar vein 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
184637c55a lsp: refactor format so we stop cloning the language_server 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
c00cf238af Simplify textDocument/didClose, we don't need to look up LSP again 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
57ed5180e0 lsp: Improve line ending handling when generating TextEdit 2021-09-06 11:00:33 +09:00
oberblastmeister
99a753a579
Document macros (#693)
* add docs

* clean up

* remove

* more

* Update helix-view/src/macros.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-09-05 12:42:33 +09:00
Gokul Soumya
e4e93e176c fix: Merge default palette with user palette 2021-09-05 12:42:03 +09:00
Gokul Soumya
e40e6db227 feat: Default theme palette using 16 terminal colors 2021-09-05 12:42:03 +09:00