Commit Graph

18576 Commits

Author SHA1 Message Date
Thorsten Ball
fe70a2646f
Fix relative glob patterns not working for language servers (#9179)
If a language server would send us a glob pattern like `**/*.rb` or
`**/{package.json}` we'd end up ignoring it and never sending the
language server any notifications, because we try to `strip_prefix` the
projects absolute path from the pattern, BUT if that path is not in the
pattern, we'd return `None`.

This change fixes that.

Release Notes:

- Fixed language server glob patterns for file watching being ignored if
they were relative patterns.

Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Remco <djsmits12@gmail.com>
2024-03-11 20:39:07 +01:00
Thorsten Ball
b2981f4baa
Fix completion-filtering by checking actual word boundaries & reduce Ruby word chars (#9170)
This fixes https://github.com/zed-industries/zed/issues/9069 by

1. reverting https://github.com/zed-industries/zed/issues/7819 
2. fixing completion filtering with regards to word boudaries

For (2) see explanation in commit message:

> Previously, this would only split words on upper-lower boundaries or
> on `_`/`-`.
> 
> The result was that we would filter out completions too aggressively.
> The filter works by taking a suggested completion, say `foo_bar_lol`,
split
> it up into words - `foo`, `bar, `lol` - and check whether any of the
words
> start with the same characters as what the user already typed: `fo`,
or `bar`,
> ...
> 
> In the case of Ruby, though, `:` wasn't considered a word boundary. If
the
> LSP would return `:foobar` when the user typed `:foo`, we'd check if
there are
> any completions that match `foo` (because that's the current word) but
> we'd compare against `foobar`, not `:` or `:foobar`.
> 
> With this change, we get more match candidates and thus more
completions in Ruby.

With that we can do (1) because we don't need these characters as word
characters anymore to trigger completions.

Release Notes:

- Fixed word boundaries in Ruby by restoring old behavior (`@`, `:`, ...
are no longer considered word characters)
([#9069](https://github.com/zed-industries/zed/issues/9069))
- Fixed completions being filtered out when they happened at word
boundaries on special characters (e.g. `:`)

---------

Co-authored-by: Max <max@zed.dev>
2024-03-11 20:38:37 +01:00
Marshall Bowers
f2aa183512
ui: Extend KeyBinding with support for displaying keybindings for other platforms (#9192)
This PR extends the `KeyBinding` component with support for displaying
keybindings for platforms other than macOS.

<img width="824" alt="Screenshot 2024-03-11 at 2 41 59 PM"
src="https://github.com/zed-industries/zed/assets/1486634/7108b17d-dfc3-42ee-9bfd-c58b334d7374">

Release Notes:

- N/A
2024-03-11 15:03:55 -04:00
Max Brunsfeld
dfcc143ead
Rename 'project_core' crate to 'worktree', make it just about worktrees (#9189)
This is just a refactor. I noticed that we now have a `project_core`
crate, which mainly contains the `Worktree` type and its private
helpers, plus the project's settings.

In this PR, I've renamed that crate to `worktree` and did some minor
simplification to its module structure. I also extracted a new
`WorktreeSettings` settings type from the `ProjectSettings`, so that the
worktree settings could live in the worktree crate. This way, the crate
is now exclusively about worktree logic.

Release Notes:

- N/A
2024-03-11 11:35:27 -07:00
Antonio Scandurra
2b67bb27cf Occlude only modal and not the space around it used to center it 2024-03-11 18:13:00 +01:00
Antonio Scandurra
91a0923fc4
Fix a few regressions related to the flicker fix (#9190)
This pull request fixes
https://github.com/zed-industries/zed/issues/9187 and fixes also ix a
rendering problem that would show cursors on the same plane:


![image](https://github.com/zed-industries/zed/assets/482957/208304a4-286a-4fd9-a3d8-e2913e3a3dc7)


Release Notes:

- N/A
2024-03-11 18:07:26 +01:00
Ivan Žužak
b4ddc83e85
Allow overriding font style and weight via experimental.theme_overrides in settings (#9122)
Release Notes:

- Added support for overriding the current theme's syntax font styles
and weights in settings
([#9121](https://github.com/zed-industries/zed/issues/9121)).

| Before | After |
| ------ | ----- |
| ![Screenshot 2024-03-09 at 22 20
01@2x](https://github.com/zed-industries/zed/assets/38924/c693468d-1e04-45b4-b7c0-869e2a22a44c)
| ![Screenshot 2024-03-09 at 22 21
09@2x](https://github.com/zed-industries/zed/assets/38924/d8b09676-dd8b-46ac-8e9d-6cf2094a9c7e)
|
2024-03-11 12:21:37 -04:00
Vitor Ramos
3bd9d14420
linux: Fix panic missing screen mode for crtc specified mode ID (#9106)
Fix panic caused by missing screen mode for specified crtc mode id #9105
by searching over all crtcs instead of using the first one which may be
invalid.
2024-03-11 09:04:05 -07:00
charles-r-earp
95b311cb90
linux: gpui add Keysym::ISO_Left_Tab (#9126)
Fixes #9089.

On linux, pressing shift and tab together can potentially produce
`ISO_Left_Tab`. This PR maps this key to "tab" with the shift modifier,
similar to `SHIFT_TAB_KEY` in gpui::platform::mac::events.

Note: The [default linux
keymaps](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-linux.json)
have shift-tab mapped to editor::TabPrev and ctrl-[ mapped to
editor::Outdent. Both actions appear to have the same effect.

Release Notes:

- Support shift-tab on linux (#9089).
2024-03-11 09:03:15 -07:00
Antonio Scandurra
8eea281288
Show modals on top of zoomed pane (#9183)
Release Notes:

- N/A
2024-03-11 16:57:17 +01:00
Kirill Bulatov
373a4e7614
Properly display deleted diff hunks (#9182)
Follow-up of https://github.com/zed-industries/zed/pull/9068 

Release Notes:

- Fixed removal diff hunks not being displayed properly in the editor
2024-03-11 17:53:45 +02:00
Piotr Osiewicz
f9f9f0670f
editor: Rearrange float operations in layout (#9176)
We were seeing weird layouts with large files, where - starting with
some verylargelineindex - lines were rendered at weird y offsets. It
turned out that in some cases we're doing operations on Pixel values of
different magnitude, which then led to wrong results in calculations.
This commit addresses some of these problems, visible at glance when
working with large plaintext files. I *did not* dig into things like
inlay hints or diagnostics to see if they are subject to the same
potential precision loss.

Fixes #5371 

Release Notes:

- Fixed editor layout for large files, where the lines might have been
laid out with incorrect Y offset from the top.
2024-03-11 16:46:20 +01:00
Joel Selvaraj
20d5f5e8da
linux: wayland cursor fixes (#9047)
Release Notes:

- Fixed wayland cursor style handling


In upcoming Gnome 46, cursor icon names are considerably changing. For
example: this commit
74e9b79471
removed/modified a lot of cursor names. Then some of the names were
reintroduced in this commit
6f64dc55dc.
I also tried upcoming KDE Plasma 6. Some of the cursor names are not
used commonly between Gnome and KDE. From my analysis, these set of
cursor names should be more widely available in both previous and
upcoming release of Gnome and KDE.

Also, If a cursor style is not available, let's fallback to default
cursor style. This avoids scenarios where we get stuck with special
cursor styles like IBeam/Resize* because the current cursor style is not
available. This will lead to an unpleasant/broken experience. Falling
back to default cursor seems to be more acceptable.
2024-03-11 08:38:52 -07:00
Thorsten Ball
f066dd268f
Fix race when language server registers for workspace/didChangeWatchedFiles (#9177)
This fixes #8896 by storing the `watched_paths` in a separate HashMap,
allowing us to handle the request even before we mark the language
server as running.

Downside is that we have yet another data structure for language
servers, but it also makes the `Running` enum case a bit smaller.

And it fixes the race condition.

Release Notes:

- Fixed language servers not being notified of file changes if language
server registers for file-notification right after starting up.
([#8896](https://github.com/zed-industries/zed/issues/8896)).

Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Remco <djsmits12@gmail.com>
2024-03-11 16:30:30 +01:00
Mart Zielman
0be20d0817
fix: vulkan dependencies in script/linux (#9116)
Just a quick pull request and a small fix, someone reported a dependency
was erroring for him, so I decided to open a small pull request. On top
of that, any `devel` header is not needed because Vulkan is only a
runtime dependency.

Release Notes:

- Fixed names of Vulkan dependencies that didn't exist
2024-03-11 08:29:06 -07:00
白山風露
a04932c4eb
Windows: fix crash with unhandled window (#9164)
On Windows, some windows may be created that are not managed by the
application.
For example, the Japanese IME creates pop-ups like this one.

<img width="325" alt="image"
src="https://github.com/zed-industries/zed/assets/6465609/503aaa0a-7568-485a-a138-e689ae67001c">

The internal data associated with such a window is different from
`WindowsWindowInner` and will crash if referenced.
Therefore, before calling `try_get_window_inner`, it checks if it is an
owned window.


Release Notes:

- N/A
2024-03-11 08:28:18 -07:00
Antonio Scandurra
ceadb39c38
Prevent text from wrapping in code actions menu (#9178)
Right now we're basing the width of the menu on the longest code action
title. That is only an approximation and doesn't always coincide
perfectly with the true, longest code action.

Given that it's pretty close, however, this commit simply disables text
wrapping on the code action menu.

Release Notes:

- Fixed a rendering glitch that could cause code actions to not display
correctly ([#8341](https://github.com/zed-industries/zed/issues/8341))
2024-03-11 16:25:17 +01:00
白山風露
2244419dfd
Add missed pad (#9175)
Sorry I missed explicitly `Quad::pad` insertion at #9172.

The struct layout is unchanged and does not affect the behavior.

Release Notes:

- N/A
2024-03-11 08:21:52 -07:00
Bennet Bo Fenner
a8fa1f7363
chat: fix emoji completions when word consists of emojis (#9107)
https://github.com/zed-industries/zed/assets/53836821/f4b31c47-d306-43f5-b971-0969f64a48f9

Fix for #9096 @JosephTLyons 

Release Notes:
- Fixed emoji completion not showing up when word contains only emojis
(#9096)
2024-03-11 09:08:18 -06:00
白山風露
eb5e18c66d
Fix blade validation failure (#9172)
Fix: #9167

Release Notes:

- N/A
2024-03-11 08:06:20 -07:00
Antonio Scandurra
830e107921
Hide hover popover when mouse hovers over negative space (#9173)
Fixes https://github.com/zed-industries/zed/issues/8340

Release Notes:

- Fixed a bug that would cause hover information to not be dismissed
when hovering over negative space.
2024-03-11 15:29:44 +01:00
Piotr Osiewicz
45c4d35da8 rope: Preallocate chunks buffer
This commit also specializes 'fn push' for large text quantities. That specialized version uses a Vec instead of SmallVec.
This commit shaves off about ~100ms out of 800ms when loading a 600Mb text buffer.
2024-03-11 13:28:10 +01:00
Antonio Scandurra
298314d526
Fix regressions introduced by flicker fix (#9162)
This pull request fixes a couple of easy regressions we discovered right
after using #9012 on nightly:

- Popover buttons for a chat message were being occluded by the message
itself.
- Scrolling was not working on the `List` element.

Release Notes:

- N/A
2024-03-11 12:11:51 +01:00
Kirill Bulatov
2f6c78b0c0
Fix incorrect outline selections after submit (#9160)
Follow-up of https://github.com/zed-industries/zed/pull/9153

Release Notes:

- N/A
2024-03-11 12:07:42 +02:00
Antonio Scandurra
4700d33728
Fix flickering (#9012)
See https://zed.dev/channel/gpui-536

Fixes https://github.com/zed-industries/zed/issues/9010
Fixes https://github.com/zed-industries/zed/issues/8883
Fixes https://github.com/zed-industries/zed/issues/8640
Fixes https://github.com/zed-industries/zed/issues/8598
Fixes https://github.com/zed-industries/zed/issues/8579
Fixes https://github.com/zed-industries/zed/issues/8363
Fixes https://github.com/zed-industries/zed/issues/8207


### Problem

After transitioning Zed to GPUI 2, we started noticing that interacting
with the mouse on many UI elements would lead to a pretty annoying
flicker. The main issue with the old approach was that hover state was
calculated based on the previous frame. That is, when computing whether
a given element was hovered in the current frame, we would use
information about the same element in the previous frame.

However, inspecting the previous frame tells us very little about what
should be hovered in the current frame, as elements in the current frame
may have changed significantly.

### Solution

This pull request's main contribution is the introduction of a new
`after_layout` phase when redrawing the window. The key idea is that
we'll give every element a chance to register a hitbox (see
`ElementContext::insert_hitbox`) before painting anything. Then, during
the `paint` phase, elements can determine whether they're the topmost
and draw their hover state accordingly.

We are also removing the ability to give an arbitrary z-index to
elements. Instead, we will follow the much simpler painter's algorithm.
That is, an element that gets painted after will be drawn on top of an
element that got painted earlier. Elements can still escape their
current "stacking context" by using the new `ElementContext::defer_draw`
method (see `Overlay` for an example). Elements drawn using this method
will still be logically considered as being children of their original
parent (for keybinding, focus and cache invalidation purposes) but their
layout and paint passes will be deferred until the currently-drawn
element is done.

With these changes we also reworked geometry batching within the
`Scene`. The new approach uses an AABB tree to determine geometry
occlusion, which allows the GPU to render non-overlapping geometry in
parallel.

### Performance

Performance is slightly better than on `main` even though this new
approach is more correct and we're maintaining an extra data structure
(the AABB tree).


![before_after](https://github.com/zed-industries/zed/assets/482957/c8120b07-1dbd-4776-834a-d040e569a71e)

Release Notes:

- Fixed a bug that was causing popovers to flicker.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-11 10:45:57 +01:00
Thorsten Ball
9afd78b35e
Add ESLint information to JavaScript docs (#9158)
Release Notes:

- N/A
2024-03-11 10:30:25 +01:00
Yanguk
9ff3cff6f8
Respect eslint.nodePath setting (#9073)
I'm using Yarn Plug'n'Play.
In this case, by default, eslint cannot find the path, so configuration
like `"eslint.nodePath": ".yarn/sdks"` is required.
So, I want to add this!

Release Notes:

- Added eslint config nodePath
2024-03-11 10:15:06 +01:00
Kainoa Kanter
d66f8f99bd
docs: Move Linux tracking issue (#9130)
Release Notes:

- N/A
2024-03-11 10:08:14 +02:00
Hans
269848775c
Fix Vim code formating (#9098)
- N/A
2024-03-11 10:03:51 +02:00
Andrew
39bd12a557
gpui: add set menus example (#9131)
Add an example showing how to add a menu item, register an action with
the `AppContext`, and successfully call the action.

Release Notes:

- N/A
2024-03-11 09:56:45 +02:00
Max
e1f8a1e8b2
Fix <!DOCTYPE html> syntax highlighting (#9108)
Release Notes:

- Added `<!DOCTYPE html>` syntax highlighting ([4318](https://github.com/zed-industries/zed/issues/4318))
2024-03-11 09:56:35 +02:00
Kirill Bulatov
41dc5fc412
Allow highlighting editor rows from multiple sources concurrently (#9153) 2024-03-11 02:17:32 +02:00
Thorsten Ball
f4a86e6fea
Always single-quote directory when cd'ing to get shell env (#9145)
This avoids us potentially executing code (if someone were to name their
directory `$(echo you-are-pwned > /secure-files)`, for example).

Works with zsh, bash, fish, nushell. Tested locally with all of them.

Release Notes:

- N/A
2024-03-10 13:53:24 +01:00
Kirill Bulatov
597465b0f5
Slightly simplify editor highlights code (#9123)
Prepare for git diff hunk highlights by grouping all inlay highlight
properties into one struct, and removing the dead background highlight
code.


Release Notes:

- N/A
2024-03-10 00:38:45 +02:00
Max
ccc939124f
Remove obsolete separator (#9117) 2024-03-09 15:33:19 -05:00
Joseph T. Lyons
a03fecafbb
Remove feedback button from status bar (#9100)
This PR removes the feedback button from the status bar, as Nathan and I
discussed. We discussed the fact that we likely no longer need to take
up valuable screen real estate for this, with where Zed as at now.

This PR also moves the `Share Feedback...` collab menu item to the
`Help` menu, as that's where VS Code puts their action to send in-app
feedback (which might help with future discoverability) and renames it
to `Give Feedback...`, to make it consistent with the name of the
command palette action.

Release Notes:

- Removed the feedback button from the status bar.
2024-03-09 06:15:08 -05:00
Mikayla Maki
ca696fd5f6
Add rs-notify implementation of fs::watch (#9040)
This PR simplifies the Zed file system abstraction and implements
`Fs::watch` for linux and windows.

TODO:
- [x] Figure out why this fails to initialize the file watchers when we
have to initialize the config directory paths, but succeeds on
subsequent runs.
- [x] Fix macOS dependencies on old fsevents::Event crate

Release Notes:

- N/A
2024-03-08 22:18:44 -08:00
Jason Wen
456efb53ad
windows: Add file dialog using IFileOpenDialog (#8919)
Release Notes:

- Added a file dialog for Windows
2024-03-08 20:07:48 -08:00
Adam
d4ec78f328
Add strikethrough to deprecated methods in CompletionsMenu (#9086)
Release Notes:

- Added ([#8390](https://github.com/zed-industries/zed/issues/8390)).
- Also Grays out deprecated methods

Before

<img width="730" alt="image"
src="https://github.com/zed-industries/zed/assets/71665039/8b5e8009-22c2-43f7-b85b-79e571a5d282">

After

<img width="773" alt="image"
src="https://github.com/zed-industries/zed/assets/71665039/0aff572b-6d3f-4ed9-b08b-d925ee650817">
2024-03-08 20:01:28 -08:00
bbb651
efe5203a09
GPUI: Wayland: Add fullscreen, minimize and avoid unnecessary resizes (#9060)
Release Notes:
- N/A
2024-03-08 19:52:36 -08:00
Kirill Bulatov
146971fb02
Splice remove suggesion hints when those are cleared in the editor. (#9088)
Closes https://github.com/zed-industries/zed/issues/6793

Release Notes:

- Fixed copilot suggestions not disappearing after disabling the tool
([6793](https://github.com/zed-industries/zed/issues/6793))
2024-03-09 02:00:01 +02:00
Kirill Bulatov
347178039c
Add editor::RevertSelectedHunks to revert git diff hunks in the editor (#9068)
https://github.com/zed-industries/zed/assets/2690773/653b5658-e3f3-4aee-9a9d-0f2153b4141b

Release Notes:

- Added `editor::RevertSelectedHunks` (`cmd-alt-z` by default) for
reverting git hunks from the editor
2024-03-09 01:37:24 +02:00
Jadi
6a7a3b257a
Add missing docstrings to settings.rs (#9054)
![image](https://github.com/zed-industries/zed/assets/1290639/46c13110-8506-4b03-91d4-b1cfcafe824a)

Add documentation for theme-related settings.

Release Notes:

- Add documentation for theme-related settings ([8383](https://github.com/zed-industries/zed/issues/8383))
2024-03-09 00:46:47 +02:00
Max Brunsfeld
8a6264d933
Provide wasm extensions with APIs needed for using pre-installed LSP binaries (#9085)
In this PR, we've added two new methods that LSP extensions can call:
* `shell_env()`, for retrieving the environment variables set in the
user's default shell in the worktree
* `which(command)`, for looking up paths to an executable (accounting
for the user's shell env in the worktree)

To test this out, we moved the `uiua` language support into an
extension. We went ahead and removed the built-in support, since this
language is extremely obscure. Sorry @mikayla-maki. To continue coding
in Uiua in Zed, for now you can `Add Dev Extension` from the extensions
pane, and select the `extensions/uiua` directory in the Zed repo. Very
soon, we'll support publishing these extensions so that you'll be able
to just install it normally.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-08 17:18:06 -05:00
Jason Lee
5abcc1c3c5
Let LineColumn on StatusBar as clickable to open GoToLineColumn (#9002)
Release Notes:

- Added to let LineColumn on StatusBar as clickable to open
GoToLineColumn.
- Added placeholder to GoToLineColumn input, and show help message on
input changed.

## Screenshot


![go-to-line-column](https://github.com/zed-industries/zed/assets/5518/90a4f644-07d4-4208-8caa-5510e1537f37)
2024-03-08 14:11:17 -07:00
Conrad Irwin
977af37cfe
open zed urls (#9081)
Release Notes:

- Added support for opening files on the zed protocol `open
zed:///Users/example/Desktop/a.txt`
([#8482](https://github.com/zed-industries/zed/issues/8482)).
2024-03-08 13:44:01 -07:00
Evren Sen
1756c1fc1e
Improve UI of popover buttons when hovering over chat messages (#9041)
### Before


https://github.com/zed-industries/zed/assets/146845123/4a16c1ce-a671-4e39-abc9-3a0cb25bc0cd

### After


https://github.com/zed-industries/zed/assets/146845123/cfab3d00-246e-427d-9c40-8ee520a0a186




Release Notes:
- Improved the UI of popover buttons when hovering over chat messages.
2024-03-08 12:46:51 -07:00
Marshall Bowers
be953b78ef
Add script for setting up WASI dependencies (#9078)
This PR adds a script for setting up the WASI dependencies needed for
extensions.

These already get downloaded when needed when using Zed, but in the
tests the HTTP client is faked out, so if you don't already have them
installed the `test_extension_store_with_gleam_extension` test will
fail.

Release Notes:

- N/A
2024-03-08 14:05:29 -05:00
Max Brunsfeld
51ebe0eb01
Allow wasm extensions to do arbitrary file I/O in their own directory to install language servers (#9043)
This PR provides WASM extensions with write access to their own specific
working directory under the Zed `extensions` dir. This directory is set
as the extensions `current_dir` when they run. Extensions can return
relative paths from the `Extension::language_server_command` method, and
those relative paths will be interpreted relative to this working dir.

With this functionality, most language servers that we currently build
into zed can be installed using extensions.

Release Notes:

- N/A
2024-03-08 08:49:27 -08:00
张小白
a550b9cecf
Impl prompts and savefile dialog on Windows (#9009)
### Description
This is a part of #8809 , and this PR dose not include `open file
dialog`, as I already saw two PRs impl this.



https://github.com/zed-industries/zed/assets/14981363/3223490a-de77-4892-986f-97cf85aec3ae




Release Notes:

- N/A
2024-03-08 08:14:47 -08:00