Commit Graph

2123 Commits

Author SHA1 Message Date
Conrad Irwin
8e1bbf32be vim: Fix ctrl-u/ctrl-d
They should work by exactly half a screen, and also move the cursor.
2023-09-26 22:28:04 -06:00
Conrad Irwin
d17d38fe70
vim: Command (#2951)
Release Notes:

- vim: Add v1 of command mode
([#279](https://github.com/zed-industries/community/issues/279)). The
goal was to cover 90% of what most people actually do, but it is very
incomplete. Known omissions are that ranges cannot be specified (except
that `:%s//` must always specify the % range), commands cannot take
arguments (you can `:w` but not `:w [file]`), and there is no history.
Please file feature requests on
https://github.com/zed-industries/community as you notice things that
could be better.
- `:` triggers zed's command palette. If you type a known vim command it
will run it, otherwise you get zed's normal fuzzy search. For this
release supported commands are limited to:
- - `:w[rite][!]`, `:wq[!]`, `:q[uit][!]`, `:wa[ll][!]`, `:wqa[ll][!]`,
`:qa[ll][!]`, `:[e]x[it][!]`, `:up[date]` to save/close tab(s) and
pane(s).
- - `:cq` to quit completely.
- - `:vs[plit]`, `:sp[lit]` to split vertically/horizontally
- - `:new`, `:vne[w]` to create a new file in a new pane above or to the
left
- - `:tabedit`, `:tabnew` to create a new file in a new tab.
- - `:tabn[ext]`, `:tabp[rev]` to go to previous/next tabs
- - `:tabc[lose]` to close tabs
- - `:cn[ext]`, `:cp[rev]`, `:ln[ext]`, `:lp[rev]` to go to the
next/prev diagnostics.
- - `:cc`, `:ll` to open the errors page
- - `:<number>` to jump to a line number.
- - `:$` to jump to end of file
- - `:%s/foo/bar/` (note that /g is always implied, the range must
always be %, and zed uses different regex syntax to vim)
- - `:/foo` and `:?foo` to jump to next/prev line matching foo
- - `:j[oin]`, to join the current line (no range is yet supported)
- - `:d[elete][l][p]`, to delete the current line (no range is yet
supported)
- - `:s[ort] [i]` to sort the current selection (case-insensitively)
- vim: Add `ctrl-w o` (closes everything except the current item) and
`ctrl-w n` (creates a new file in the pane above).
([#1884](https://github.com/zed-industries/community/issues/1884))
- all: Add a "Discard" option to prompt when saving a file with
conflicts (previously this only appeared on close, not on save).

Internal changes:
- The Picker will now wait for pending queries before confirming (to
handle people typing `: w enter` rapidly.
- workspace::save_item and Pane::save_item are now merged together, and
the behavior controlled by `workspace::SaveIntent`.
- Many actions related to closing/saving items now take an optional
`SaveIntent`.
-
2023-09-25 14:07:22 -05:00
Conrad Irwin
769c330b3d Merge branch 'vim-command' 2023-09-25 11:41:13 -06:00
Julia
80eaabd360 Activate correct item when clicking on a code action with the mouse 2023-09-25 13:31:00 -04:00
Julia
a278428bd5 Trigger scroll_to on code action list when moving selection 2023-09-25 11:13:50 -04:00
Kirill Bulatov
afa7045847 Tone down inlay hint update logs 2023-09-22 17:04:11 +03:00
Piotr Osiewicz
dbfa1d7263
[WIP] Replace in project (#2984)
Targeting Preview of 09.27.
This is still pending several touchups/clearups:
- We should watch multibuffer for changes and rescan the excerpts. This
should also update match count.
- Closing editor while multibuffer with 100's of changed files is open
leads to us prompting for save once per each file in the multibuffer.
One could in theory save in multibuffer before closing it (thus avoiding
unnecessary prompts), but it'd be cool to be able to "Save all"/"Discard
All".

Release Notes:

- Added "Replace in project" functionality
2023-09-21 16:27:58 +02:00
Conrad Irwin
6ad1f19a21 Add NewFileInDirection 2023-09-20 20:44:26 -06:00
Conrad Irwin
a4f96e6452 tests: wait deterministically after simulating_keystrokes 2023-09-20 20:44:26 -06:00
Mikayla
fe10875285
Fix panic on select all when query is empty 2023-09-20 17:10:23 -07:00
Mikayla
fdf5278bbf
Only autoscroll on select_next operations 2023-09-20 09:31:12 -07:00
Mikayla
8cc7a02390
Fix rebase 2023-09-20 08:34:18 -07:00
Mikayla
03d4191685
Fix infinite loop in select all matches 2023-09-20 08:25:21 -07:00
Mikayla
c074bfd441
Add select all command to the editor, equivalent to hitting cmd-d as many times as possible 2023-09-20 08:25:20 -07:00
Conrad Irwin
5bb8ba5028 Initialize workspace properly in tests
For vim command I'd like to be able to test that e.g. workspace::Save
works.
2023-09-19 20:49:29 -06:00
Piotr Osiewicz
616d328f3c
chore: Use aho-corasick 1.1 in direct dependencies (#2983)
Nothing too fancy, we've depended indirectly on 1.0/1.1 already, so this
is essentially bookkeeping.

Release Notes:
- N/A
2023-09-18 17:01:08 +02:00
Nate Butler
24974ee2fa Unify icons using multiple variants, remove all unused icons 2023-09-15 12:50:49 -04:00
Kirill Bulatov
8c1df5afa2 Empty both hint cache storages correctly 2023-09-15 10:33:32 +03:00
Kirill Bulatov
e7b5880af0 Combine both text and inlay highlights in randomized tests 2023-09-14 23:53:56 +03:00
Kirill Bulatov
f9b70718ac Store hints in the map, not the snapshot 2023-09-14 23:36:33 +03:00
Kirill Bulatov
4e9f0adcef Improve inlay hint cache lookup 2023-09-14 23:31:50 +03:00
Kirill Bulatov
8ae3f79235 Restructure inlay highlights data for proper access 2023-09-14 23:05:22 +03:00
Kirill Bulatov
9b43acfc88 Remove useless background highlights code 2023-09-14 22:18:30 +03:00
Kirill Bulatov
396efec6e1 Uncomment the rest of the tests 2023-09-14 22:18:26 +03:00
Kirill Bulatov
47e0535f1c Randomize inlay highlight range start 2023-09-14 22:08:12 +03:00
Kirill Bulatov
129fb62182 Consider offsets in inlay chunks 2023-09-14 22:08:12 +03:00
Kirill Bulatov
a9de6c3dba Properly handle inlay highlights in the InlayMap
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-09-14 22:08:12 +03:00
Kirill Bulatov
80b96eb05b Add inlay highlight test 2023-09-14 22:08:12 +03:00
Kirill Bulatov
42bd2be2f3 Implement inlay highlighting 2023-09-14 22:08:12 +03:00
Kirill Bulatov
890a587254 Use standalone inlay background highlights 2023-09-14 22:08:12 +03:00
Kirill Bulatov
9f5314e938 Unify highlights in *Map 2023-09-14 22:08:12 +03:00
Kirill Bulatov
6c00cd8a35 Do not combine inlay and text highlights on the *Map level 2023-09-14 22:08:12 +03:00
Piotr Osiewicz
1eb74acb3e
editor: Do not run brace completion on empty text. (#2965)
Users of keyboard layout with IME complained about the peculiar
behaviour where typing in "sss" and then removing all of it left behind
one 's' and also appended a closing brace. This was not reproducible on
a buffer without language, so I've suspected that brace insertion might
be a problem here. For whatever reason when the user removes the last
character from a run that triggered IME, we receive a notification about
an empty insertion. Sadly, brace completion does not handle an empty
input properly and we erroneously insert a closing brace when deleting
the followup characters. In fact, the brace inserted is always the
closing brace for the first entry in language's config.toml 'brackets'
field (see Scheme vs Markdown). This guard also allows for the proper
removal of the first character.

Closes community tickets zed-industries/community#877
zed-industries/community#1329

Z-2869

Release Notes:
- Fixed handling of bracket completion for international keyboard
layouts that use IME. This led to Zed erroneously inserting the `}`
character while removing the first character that triggered IME.
2023-09-14 20:24:21 +02:00
Antonio Scandurra
70c9b8f8fd Merge remote-tracking branch 'origin/main' into polish-codegen 2023-09-13 11:41:32 +02:00
Piotr Osiewicz
4cb8647702
Z 1200/replace in buffer (#2922)
This is still WIP, mostly pending styling. I added a pretty rudimentary
text field and no buttons whatsoever other than that. I am targeting a
Preview of 09.13, as I am gonna be on PTO for the next week.

I dislike the current implementation slightly because of `regex`'s crate
syntax and lack of support of backreferences. What strikes me as odd wrt
to syntax is that it will just replace a capture name with empty string
if that capture is missing from the regex. While this is perfectly fine
behaviour for conditionally-matched capture groups (e.g. `(foo)?`), I
think it should still error out if there's no group with a given name
(conditional or not).
Release Notes:

- Added "Replace" functionality to buffer search.
2023-09-12 18:46:54 +02:00
Nathan Sobo
e0fdc7d0aa Eliminate PaintContext 2023-09-11 09:00:59 -06:00
Nathan Sobo
a24d94cfda Eliminate LayoutContext 2023-09-11 08:47:00 -06:00
Antonio Scandurra
02078140c0 Extract code generation logic into its own module 2023-09-11 11:25:37 +02:00
Nathan Sobo
ebf8b32811 Checkpoint 2023-09-08 16:25:10 -06:00
Nathan Sobo
362b1a44be Merge branch 'main' into storybook 2023-09-08 14:18:44 -06:00
Nathan Sobo
53a50b8df4 Move refreshing to window 2023-09-08 13:27:29 -06:00
Conrad Irwin
5d782b6cf0
vim . to replay (#2936)
Release Notes:

- vim: Add `.` to replay
([#946](https://github.com/zed-industries/community/issues/946))
- vim: Fix `J` in visual mode, and with counts.
2023-09-08 11:52:35 -06:00
Conrad Irwin
5f897f45a8 Fix f,t on soft-wrapped lines
Also remove the (dangerously confusing) display_map.find_while
2023-09-08 10:16:46 -06:00
Conrad Irwin
1b1d7f22cc Add visual area repeating 2023-09-07 10:45:38 -06:00
Nathan Sobo
37ef28a3bf Merge branch 'main' into storybook 2023-09-07 07:56:57 -06:00
Nathan Sobo
5a778fbde6 Checkpoint 2023-09-06 14:16:15 -06:00
Conrad Irwin
20f98e4d17 vim . to replay
Co-Authored-By: maxbrunsfeld@gmail.com
2023-09-06 13:49:55 -06:00
Conrad Irwin
56db21d54b Split ContextMenu actions
This should have no user-visible impact.

For vim `.` to repeat it's important that actions are replayable.
Currently editor::MoveDown *sometimes* moves the cursor down, and
*sometimes* selects the next completion.

For replay we need to be able to separate the two.
2023-09-02 21:04:19 -06:00
Conrad Irwin
aa7b65bbaf Merge branch 'main' into vim-softwrap-word 2023-09-01 12:23:56 -06:00
Conrad Irwin
6d7949654b Fix accidental visual selection on scroll
As part of this fix partial page distance calculations to more closely
match vim.
2023-09-01 11:14:27 -06:00