I'm not a huge fan of passing around a boolean all around the place, but
this will tame the events for now until we have a better solution.
Release Notes:
- N/A
This changes the vim::MoveToNextMatch event callback to open the
buffer_search toolbar. This fixes an issue where highlights would appear
which were only cancellable by opening then closing the toolbar.
Release Notes:
- the buffer search toolbar now opens on vim::MoveToNextMatch fixing the
issue where highlights were not cancellable
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Fixes a bug where Vim bindings would flash in the mouse context menu and
then be replaced by the default keybindings. Also fixes those bindings
not being usable while the mouse context menu was open.
Release Notes:
- Fixed bug where Vim bindings were not available when mouse context
menu was open
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This cleans up the neovim-backed vim tests:
- removed exempted tests (we'll rely on bug reports to find missing edge
cases)
- moved all assertions into non-async fn's so that failures are
reporting on the right file/line
- removed the NeovimBackedBindingTestContext
- renamed a few things to make them clearer
- reduced the number of permutations tested in some cases to reduce
slowest test from 60s to 5s
Release Notes:
- N/A
Part of https://github.com/zed-industries/zed/issues/8081
To avoid confusion and bugs when converting between various row `u32`'s,
use different types for each.
Further PRs should split `Point` into buffer and multi buffer variants
and make the code more readable.
Release Notes:
- N/A
---------
Co-authored-by: Piotr <piotr@zed.dev>
Release Notes:
- vim: Added support for the changelist. `g;` and `g,` to the
previous/next change
- vim: Added support for the `'.` mark
- vim: Added support for `gi` to resume the previous insert
Release Notes:
- vim: Added support for buffer-local marks (`'a-'z`) and some builtin
marks `'<`,`'>`,`'[`,`']`, `'{`, `'}` and `^`. Global marks (`'A-'Z`),
and other builtin marks (`'0-'9`, `'(`, `')`, `''`, `'.`, `'"`) are not
yet implemented. (#5122)
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
For #11084 In the case of an indentation in front of the current line,
it may also be necessary to deal with the start point of the selected
range
Release Notes:
- N/A
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Release Notes:
- Added support for line ranges in vim replace commands #9428
- not supporting anything other than bare line numbers right now
- ~need to figure out how to show range in question in search bar~
@ConradIrwin implemented showing a highlight of the selected range for a
short direction instead
- ~tests lol~
At the moment, using the default expand_selection seems to do the job
well, without the need for some additional logic, which may also make
the code a little clearer, Fix#10945
Release Notes:
- N/A
Hi there, nice editor!
Here's my attempt at fixing #10865.
Thanks
Release Notes:
-vim: Fix ctrl+a when cursor is on a decimal point
([#10865](https://github.com/zed-industries/zed/issues/10865)).
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
now correctly retrieves range in cases where escape characters are
present. Fixed#10827
Release Notes:
- vim: Fix logic for finding surrounding quotes to ignore escaped
characters (#10827)
I saved the `file_types.json` file and got a diff because it had some
trailing whitespace. I ran
[`lineman`](https://github.com/JosephTLyons/lineman) on the codebase.
I've done this before, but this time, I've added in the following
settings to our `.zed` local settings, to make sure every future save
respects our desire to have consistent whitespace formatting.
```json
"remove_trailing_whitespace_on_save": true,
"ensure_final_newline_on_save": true
```
Release Notes:
- N/A
This PR includes two relevant changes:
- Platform binds (super, windows, cmd) will now parse on all platforms,
regardless of which one is being used. While very counter-intuitive
(this means that `cmd-d` will actually be triggered by `win-d` on
windows) this makes it possible to reuse keymap files across platforms
easily
- There is now a KeyContext `os == linux`, `os == macos` or `os ==
windows` available in keymaps. This allows users to specify certain
blocks of keybinds only for one OS, allowing you to minimize the amount
of keymappings that you have to re-configure for each platform.
Release Notes:
- Added `os` KeyContext, set to either `linux`, `macos` or `windows`
- Fixed keymap parsing errors when `cmd` was used on linux, `super` was
used on mac, etc.
Release Notes:
- Added the current operator stack to the Vim status bar at the bottom
of the editor. #4447
This commit introduces a new feature that displays the current partial
command in the vim mode, similar to the behavior in Vim plugin. This
helps users keep track of the commands they're entering.
This PR renames `language::Buffer::new` to `language::Buffer::local` and
simplifies its interface. Instead of taking a replica id (which should
always be 0 for the local case) and a `BufferId`, which was awkward and
verbose to construct, it simply takes text and a `cx`.
It uses the `cx` to derive a `BufferId` from the `EntityId` associated
with the `cx`, which should always be positive based on the following
analysis...
We convert the entity id to a u64 using this method on `EntityId`, which
is defined by macros in the `slotmap` crate:
```rust
pub fn as_ffi(self) -> u64 {
(u64::from(self.version.get()) << 32) | u64::from(self.idx)
}
```
If you look at the type of `version` in `KeyData`, it is non-zero:
```rust
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct KeyData {
idx: u32,
version: NonZeroU32,
}
```
This commit also adds `Context::reserve_model` and
`Context::insert_model` to determine a model's entity ID before it is
created, which we need in order to assign a `BufferId` in the background
when loading a buffer asynchronously.
Release Notes:
- N/A
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This PR adds the ability for extensions to provide certain language
settings via the language `config.toml`.
These settings are then merged in with the rest of the settings when the
language is loaded from the extension.
The language settings that are available are:
- `tab_size`
- `hard_tabs`
- `soft_wrap`
Additionally, for bundled languages we moved these settings out of the
`settings/default.json` and into their respective `config.toml`s .
For languages currently provided by extensions, we are leaving the
values in the `settings/default.json` temporarily until all released
versions of Zed are able to load these settings from the extension.
---
Along the way we ended up refactoring the `Settings::load` method
slightly, introducing a new `SettingsSources` struct to better convey
where the settings are being loaded from.
This makes it easier to load settings from specific locations/sets of
locations in an explicit way.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Release Notes:
- Fixed `cgn` backwards movement problem in #9982
There are two issues:
- When there are no more matches, the next repetition still moves the
cursor to the left. After that, the recording is cleared. For this I
simply move the cursor to the right, but it doesn't work when the cursor
is at the end of the line.
- If `cgn` is used when there are no matches, it cleans the previous
recorded actions. Maybe there should be a way to revert the recording.
This also happens when using `c` and `esc`
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
For #4965
There are still some minor issues:
1. When change the surround and delete the surround, we should also
decide whether there are spaces inside after deleting/replacing
according to whether it is open parentheses, and replace them
accordingly, but at present, delete and change, haven't done this
adaptation for current pr, I'm not sure if I can fit it in the back or
if it needs to be fitted together.
2. In the selection mode, pressing s plus brackets should also trigger
the Add Surrounds function, but this MR has not adapted the selection
mode for the time being, I think we need to support different add
behaviors for the three selection modes.(Currently in select mode, s is
used for Substitute)
3. For the current change surrounds, if the user does not find the
bracket that needs to be matched after entering cs, but it is a valid
bracket, and will wait for the second input before failing, the better
practice here should be to return to normal mode if the first bracket is
not found
4. I reused BracketPair in language, but two of its properties weren't
used in this mr, so I'm not sure if I should create a new struct with
only start and end, which would have less code
I'm not sure which ones need to be changed in the first issue, and which
ones can be revised in the future, and it seems that they can be solved
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Fixes: #10266
Release Notes:
- Added/Fixed/Improved ...
([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)).
Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.
**or**
- N/A
Release Notes:
- Resolves#4273
@algora-pbc /claim #4273
This is a work-in-progress. The process for `gn` command is:
- maintain updated vim.workspace_state.search.initial_query
- modify editor.select_next_state with
vim.workspace_state.search.initial_query
- use editor.select_next()
- merge selections
- set editor.select_next_state to previous state
To make this possible, several private members and editor structures are
made public. `gN` is not yet implemented and the cursor still does not
jump to the next selection in the first use.
Maybe there is an better way to do this?
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Release Notes:
- N/A
This commit introduces a new method `range` to calculate the target
range for selection expansion based on the current selection, movement
times, and other parameters. The `expand_selection` method is refactored
to use this new `range` method, simplifying the logic for expanding a
selection and making the code more modular and reusable. The `range`
method encapsulates the logic for calculating the new selection range,
including handling linewise selection and adjustments for surrounding
newlines, making it easier to understand and maintain the selection
expansion functionality.
---------
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Refs #9647
Fixes https://github.com/zed-industries/zed/issues/9792
This pull request moves the computation of scrollbar markers off the
main thread, to prevent them from grinding the editor to a halt when we
have a lot of them (e.g., when there are lots of search results on a
large file). With these changes we also avoid generating multiple quads
for adjacent markers, thus fixing an issue where we stop drawing other
primitives because we've drawn too many quads in the scrollbar.
Release Notes:
- Improved editor performance when displaying lots of search results,
diagnostics, or symbol highlights in the scrollbar
([#9792](https://github.com/zed-industries/zed/issues/9792)).
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan <nathan@zed.dev>
Release Notes:
- Fixes#4502
Notes:
I removed this line of code which removes the vim keymap contexts when
an editor is blurred.
16e6f5643c/crates/vim/src/vim.rs (L703-L705)
I tried whether the editor context would be poisoned when switching
between two editors and disabling vim mode and switching back but the
context looked normal. If this change is wrong, please advise. I could
not find why this piece of code was required.
This fixes#4502 as the reason why keybinds did not show up was because
the vim context was removed from the editor's keymap contexts. Other
paths for a fix could be to filter out vim predicates when finding
keybinds for actions but I believe that'd add unnecessary complexity.
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Fix#8994 and #9844
Release notes:
* Fixed the `t` object in Vim mode not working correctly when cursor was
on a tag. #9844 and #8994
This mr fixes the above two problems, for #9844, because our previous
logic is to only think that the minimum html tag containing the current
cursor is qualified, but the approach of nvim is to get the tag after
the current cursor first, followed by the tag around the current cursor,
so I modified the corresponding condition
For #8994, the situation is a bit more complicated, in our previous
implementation, we could only get the range of the object by a `cursor
position`, but there are two possible cases for the html tag:
When the current cursor length is 1, nvim will return the first tag
after the current cursor, as described above
When the current cursor length is greater than 1, nvim will return just
the smallest tag that can cover the current selection
So we may need to pass the current selection to the inside of the
method, and the point alone is not enough to support us in calculating
these conditions
This pull request introduces a new `InlineCompletionProvider` trait,
which enables making `Editor` copilot-agnostic and lets us push all the
copilot functionality into the `copilot_ui` module. Long-term, I would
like to merge `copilot` and `copilot_ui`, but right now `project`
depends on `copilot`, which makes this impossible.
The reason for adding this new trait is so that we can experiment with
other inline completion providers and swap them at runtime using config
settings.
Please, note also that we renamed some of the existing copilot actions
to be more agnostic (see release notes below). We still kept the old
actions bound for backwards-compatibility, but we should probably remove
them at some later version.
Also, as a drive-by, we added new methods to the `Global` trait that let
you read or mutate a global directly, e.g.:
```rs
MyGlobal::update(cx, |global, cx| {
});
```
Release Notes:
- Renamed the `copilot::Suggest` action to
`editor::ShowInlineCompletion`
- Renamed the `copilot::NextSuggestion` action to
`editor::NextInlineCompletion`
- Renamed the `copilot::PreviousSuggestion` action to
`editor::PreviousInlineCompletion`
- Renamed the `editor::AcceptPartialCopilotSuggestion` action to
`editor::AcceptPartialInlineCompletion`
---------
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Kyle <kylek@zed.dev>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
I found that there may be some minor problems here, in editor.edit may
be more dependent on the order of operations, if the same set of
operations, different execution orders may lead to some different
results, so maybe we need to use BTreeSet instead of HashSet, because
HashSet may not be able to ensure that the same set of data order is
consistent, but maybe my worries are too much
Release notes:
- N/A