Commit Graph

353 Commits

Author SHA1 Message Date
Floyd Wang
01fe3eec4d
Fix project panel icon bouncing when renaming (#8988)
I found the project panel icon has a little bounce when I tried to
rename some files.

Release Notes:

- Fix project panel icon bouncing when renaming.

## Before



https://github.com/zed-industries/zed/assets/28998859/76f04c33-da68-40e2-9c83-045e78187679

**Set `buffer_line_height` to `standard`**


https://github.com/zed-industries/zed/assets/28998859/9a9eca93-5fda-4060-ba1d-0cd4e0486eb8



## After


https://github.com/zed-industries/zed/assets/28998859/29b49f1c-a9ae-4281-8921-8f1d8dd74262

**Set `buffer_line_height` to `standard`**


https://github.com/zed-industries/zed/assets/28998859/8f1ccbb5-fe0e-4905-97c4-cb7431e5dc46
2024-03-07 09:18:59 +01:00
Andrew Lygin
effc317a06
Fix project panel scrolling position restoration (#8961)
Project panel loses the last scrolling position every time the user
hides/shows it. This PR fixes the problem.

The reason of the problem is that `UniformListScrollHandle`, which is
intended to store the scrolling position between redrawings, is only
used for ad-hoc autoscrollings to the list items, while the
`interactivity.scroll_handle` that is responsible for the scrolling
position, doesn't survive the project panel hiding.

How the problem looks:


https://github.com/zed-industries/zed/assets/2101250/7c7e3da6-9a9d-4f28-a181-ee9547349d4c

Release Notes:

- Fixed scrolling position restoration in the Project Panel.
2024-03-06 12:00:51 -08:00
Marshall Bowers
22fe03913c
Move Clippy configuration to the workspace level (#8891)
This PR moves the Clippy configuration up to the workspace level.

We're using the [`lints`
table](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table)
to configure the Clippy ruleset in the workspace's `Cargo.toml`.

Each crate in the workspace now has the following in their own
`Cargo.toml` to inherit the lints from the workspace:

```toml
[lints]
workspace = true
```

This allows for configuring rust-analyzer to show Clippy lints in the
editor by using the following configuration in your Zed `settings.json`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "check": {
          "command": "clippy"
        }
      }
    }
  }
```

Release Notes:

- N/A
2024-03-05 12:01:17 -05:00
Andrew Lygin
d7b5c883fe
Optimize project panel subscriptions (#8846)
The project panel now both observes all the project updates and
subscribes to project events it's interested in. The observing handler
updates the list of visible entries on any notification, which looks
pretty excessive.

This PR removes the observer completely, and adds missing event handlers
to the subscription, thus removing unnecessary work.

Release Notes:

- N/A
2024-03-04 20:56:17 +02:00
Marshall Bowers
a6dbaac653
Enable clippy::needless_question_mark (#8759)
This PR enables the
[`clippy::needless_question_mark`](https://rust-lang.github.io/rust-clippy/master/index.html#/needless_question_mark)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 23:40:39 -05:00
Marshall Bowers
5935681c5c
Enable clippy::single_char_pattern (#8727)
This PR enables the
[`clippy::single_char_pattern`](https://rust-lang.github.io/rust-clippy/master/index.html#/single_char_pattern)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:04:59 -05:00
Marshall Bowers
ca2cda8d2a
Remove unneeded 'static lifetimes on &strs in constants (#8698)
This PR removes unneeded `'static` lifetimes on `&str`s stored in
`const` declarations.

This addresses some Clippy lints about
[`redundant_static_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_static_lifetimes).

In item-level `const` declarations we can rely on lifetime elision and
use the default `'static` lifetime.

Note that associated constants still require an explicit `'static`
lifetime, as explained in
https://github.com/rust-lang/rust/issues/115010.

Release Notes:

- N/A
2024-03-02 00:40:49 -05:00
Conrad Irwin
b3b94e64ba
Ensure panel and pane sizes are integral (#8619)
Fixes: #8050

For some reason that we didn't investigate, if you have view caching
enabled,
and you have non-integer sized bounds, and you are right aligning
things, the
co-ordinates can differ by +/- 1px when using the cached view.

The easiest fix for now is to just not do that.

Co-Authored-By: Antonio <as-cii@zed.dev>

Release Notes:

- Fixed the pane icons flickering
([#8050](https://github.com/zed-industries/zed/issues/8050)).

Co-authored-by: Antonio <as-cii@zed.dev>
2024-02-29 09:16:42 -07:00
Kirill Bulatov
2e516261fe Add tests on inventory task sorting 2024-02-28 14:13:40 +02:00
Kirill Bulatov
ca092fb694 Move NumericPrefixWithSuffix into utils 2024-02-28 14:13:40 +02:00
Sai Gokula Krishnan
bd8896a3dc
Add icon support for files without extensions (#8453)
Release Notes:

- Added support for showing file icons for files without suffixes.

Before:

<img width="281" alt="image"
src="https://github.com/zed-industries/zed/assets/25414681/ab4c00ed-72c7-458f-8dda-61c68165590f">


After:

<img width="242" alt="Screenshot 2024-02-27 at 1 51 20 AM"
src="https://github.com/zed-industries/zed/assets/25414681/8f3082c4-9424-4bc3-9100-a527b9adc315">


This screenshot is to show if the file has extension, then the extension
takes precedence.

<img width="193" alt="image"
src="https://github.com/zed-industries/zed/assets/25414681/72fcebd1-361f-444b-8890-f59932963083">


<br>

- Added icons for
    - Docker - https://www.svgrepo.com/svg/473589/docker
    - License - https://www.svgrepo.com/svg/477704/license-1
    - Heroku - https://www.svgrepo.com/svg/341904/heroku
 
 - Updated tests
2024-02-27 20:36:38 -05:00
Thorsten Ball
ac31c824e4
Use numeric sorting if possible in project panel (#8486)
Previously, if you had the following files/folders in your project

    1-abc
    10
    11-def
    ...
    2
    21-abc

that's how we'd display them.

With this change, we now try to parse them as numbers, if possible, and
use that to sort. If we can't parse a component as a number, we fall
back to normal string comparison.

End result is this:

    1-abc
    2
    10
    11-def
    ...
    21-abc


Release Notes:

- Fixed filenames with numeric components (`1.txt`, `1/one.txt`, ...)
not being sorted as numbers, but as string.

Before:

![screenshot-2024-02-27-18 29
43@2x](https://github.com/zed-industries/zed/assets/1185253/2d223126-329f-4ae7-9a12-d33e2c3fe52f)


After:

![after](https://github.com/zed-industries/zed/assets/1185253/f4f98fa0-e66f-40aa-aa28-189143cbb75f)

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-27 18:42:15 +01:00
Thorsten Ball
7acd6879db
Fix copying folders into themselves to create copies (#8484)
This fixes #7314 and #7778.

The problem was copying a folder into itself, which is actually quite a
common operation in macOS's `Finder.app`: you select a folder, hit
`cmd-c` and `cmd-v` and have a copy. That's also how it works in VS
Code.

The fix here is to detect when we're copying a folder into itself and
treating it like we're copying a file into itself: we don't want to copy
into the target, we want to copy into the folder one level higher up,
which will then automatically add a ` copy` to the end of the name.

Release Notes:

- Fixed ability to copy folders into themselves by selecting them in
project panel and hitting `copy` and `paste`. Instead of endless
recursion, a copy of the folder is now created.
([#7314](https://github.com/zed-industries/zed/issues/7314)).

Demo:



https://github.com/zed-industries/zed/assets/1185253/2141310a-991d-491d-8498-eb766275a1f5
2024-02-27 14:57:46 +01:00
Antonio Scandurra
7cbdea2ca0
Revert "Add support of auto folded directories" (#8476)
Reverts zed-industries/zed#7674

@ABckh: reverting this as it introduced a significant performance
slowdown, most likely caused by iterating through all the snapshot
entries to determine whether a directory is foldable/unfoldable/omitted.
It would be great if you could open a new PR that reverts this revert
and addresses the performance issues. Thank you!

/cc: @maxbrunsfeld 

Release notes:

- N/A
2024-02-27 11:26:18 +01:00
Yury Abykhodau
011ae8536c
Add support of auto folded directories (#7674)
Added support of auto collapsed directories, for example when directory
has only one directory inside we should display it as dir1/dir2 (#6935
). Please feel free to propose better solutions, as I am new in Rust

Demo:
https://streamable.com/seo3n9

Release Notes:

- Added support for auto-collapsing directories.
2024-02-26 10:01:59 -08:00
Dzmitry Malyshau
a44fc24445
Clean up many small dependencies (part 3) (#8425)
Follow-up to #8353

Release Notes:
- N/A
2024-02-26 11:08:57 +02:00
Kirill Bulatov
83cffdde1f
Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
Antonio Scandurra
55129d4d6c
Revert "Use Fx* variants of HashMap and HashSet everywhere in Zed" (#7492)
Reverts zed-industries/zed#7481

This would regress performance because we'd be using the standard
library's hash maps everywhere, so reverting for now.
2024-02-07 13:16:22 +01:00
Kirill Bulatov
eb236302c2
Use Fx* variants of HashMap and HashSet everywhere in Zed (#7481)
Release Notes:

- N/A
2024-02-07 09:45:37 +02:00
Piotr Osiewicz
743f9b345f
chore: Move workspace dependencies to workspace.dependencies (#7454)
We should prefer referring to local deps via `.workspace = true` from
now on.

Release Notes:

- N/A
2024-02-06 20:41:36 +01:00
Alfred Kristal Ern
8fed9aaec2
Fix project panel selection related issues (#7245)
Fixes #7003 and #7005.

Selecting as a reaction to actually opening a new item doesn’t seem
robust in all cases, the PR improves that.

Release Notes:

- Fixed missing project panel file selection in certain cases
2024-02-02 11:17:46 +02:00
Conrad Irwin
dcca48482b
disallow opening private files (#7165)
- Disallow sharing gitignored files through collab
- Show errors when failing to open files
- Show a warning to followers when view is unshared

/cc @mikaylamaki, let's update this to use your `private_files` config
before merge.


Release Notes:

- Added the ability to prevent sharing private files over collab.

---------

Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-31 12:05:51 -08:00
Mikayla Maki
f98d636203
WIP: Add a setting to visually redact enviroment variables (#7124)
Release Notes:

- Added bash syntax highlighting to `.env` files. 
- Added a `private_files` setting for configuring which files should be
considered to contain environment variables or other sensitive
information.
- Added a `redact_private_values` setting to add or remove censor bars
over variable values in files matching the `private_files` patterns.
-(internal) added a new `redactions.scm` query to our language support,
allowing different config file formats to indicate where environment
variable values can be identified in the syntax tree, added this query
to `bash`, `json`, `toml`, and `yaml` files.

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-01-31 11:42:09 -08:00
Marshall Bowers
e338f34097
Sort dependencies in Cargo.toml files (#7126)
This PR sorts the dependency lists in our `Cargo.toml` files so that
they are in alphabetical order.

This should make them easier to visually scan when looking for a
dependency.

Apologies in advance for any merge conflicts 🙈 

Release Notes:

- N/A
2024-01-30 21:41:29 -05:00
Piotr Osiewicz
e6ebe7974d
gpui: Add Global marker trait (#7095)
This should prevent a class of bugs where one queries the wrong type of
global, which results in oddities at runtime.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-01-30 14:08:20 -05:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
d1y
5f4dd36a1a
Add ability to expand/collapse directories using the project_panel::Open action (#6914)
#6910

I changed the `open_file` symbol to `open`, because this is more
consistent with the original intention

Release Notes:

- Added the ability to expand/collapse directories using the
`project_panel::Open` action.
2024-01-29 18:21:23 -08:00
Marshall Bowers
d1a6003033
Use Git status color for icons in project panel (#6992)
This PR updates the icons in the file tree in the project panel to also
use the Git status color:

<img width="267" alt="Screenshot 2024-01-29 at 10 21 41 AM"
src="https://github.com/zed-industries/zed/assets/1486634/2f4f6e9e-8050-4f5b-851a-e407aec823a0">

Release Notes:

- Updated icons in project panel to reflect Git status
([#6991](https://github.com/zed-industries/zed/issues/6991)).
2024-01-29 10:26:30 -05:00
George Munyoro
49542757fd
Correctly check existence of target directory in copy_recursive function (#6875)
Fixes https://github.com/zed-industries/zed/issues/6778

Release Notes:

- Fixed issue where copy-paste for folders was not working in the
project panel
([#6778](https://github.com/zed-industries/zed/issues/6778)).
2024-01-29 12:06:02 +02:00
Piotr Osiewicz
0a0a866dd5
Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535)
Release Notes:
- N/A
2024-01-27 13:51:16 +01:00
Conrad Irwin
08de0d88b1 Update channel moving to match 2024-01-26 10:07:51 -07:00
Conrad Irwin
01424a62ea Allow prompts to have detail, and use for good
Make channel panel errors louder
2024-01-24 23:15:37 -07:00
Conrad Irwin
a860ca6a3c Fix tests that were toggling the panel shut 2024-01-24 12:22:12 -07:00
Conrad Irwin
2a11c22760 Ensure chat opens when guests join shared projects
This was broken because the panel was created before being added to a
dock. Invert the control order and add `starts_open()` to the Panel
trait.
2024-01-24 12:06:03 -07:00
Piotr Osiewicz
f2ff7fa4d5
chore: Change AGPL-licensed crates to GPL (except for collab) (#4231)
- [x] Fill in GPL license text.
- [x] live_kit_client depends on live_kit_server as non-dev dependency,
even though it seems to only be used for tests. Is that an issue?

Release Notes:
- N/A
2024-01-24 00:26:58 +01:00
Max Brunsfeld
4e970e978a Use a different color for ignored files in the project panel 2024-01-23 13:00:28 -08:00
Piotr Osiewicz
21e6b09361
Remove license-file from Cargo.toml as it is apparently redundant (#4218)
Release Notes:

- N/A
2024-01-23 17:40:30 +01:00
Piotr Osiewicz
678bdddd7d
chore: Add crate licenses. (#4158)
- GPUI and all dependencies: Apache 2
- Everything else: AGPL

Here's a script that I've generated for it:
https://gist.github.com/osiewicz/6afdd6626e517da24a2092807e6f0b6e

Release Notes:
- N/A

---------

Co-authored-by: David <david@zed.dev>
2024-01-23 16:56:22 +01:00
Mikayla
903176d8ff
Pull out fluent builder helpers into re-usable trait 2024-01-18 15:31:31 -08:00
Mikayla
a5084510a1
Fix popin for project panel by pre-resolving keybindings in terms of the project panel 2024-01-18 15:16:09 -08:00
Joseph T. Lyons
b807e6fe80 Use try_global() 2024-01-18 01:33:30 -05:00
Mikayla Maki
aa7351041d
Add typo detection to CI (#4107)
Adding the typos crate to our CI will take some doing, as we have
several tests which rely on typos in various ways (e.g. checking state
as the user types), but I thought I'd take a first stab at fixing what
it finds.

Release Notes:

- N/A
2024-01-17 17:13:47 -08:00
Piotr Osiewicz
6cbc49e5f0
Editor docs (#4097)
Release Notes:

- N/A

---------

Co-authored-by: Kirill <kirill@zed.dev>
2024-01-18 00:48:37 +01:00
Mikayla
57400e9687
Fix typos detected by crate-ci/typos 2024-01-17 14:31:21 -08:00
Piotr Osiewicz
9a70a89477
Fix project panel being toggled on workspace startup. (#4059)
A sequence of events: Launch Zed -> Quit Zed -> Launch Zed would leave
you with a project panel in a a different state on each open (e.g. if it
is open on 1st one, 2nd run will have it closed). We were essentially
not tracking whether the deserialization took place.

Release Notes:

- Fixed project panel being toggled on/off on startup due to incorrect
tracking of serialization state (solves
https://github.com/zed-industries/community/issues/2406)
2024-01-15 22:23:16 +01:00
Marshall Bowers
90f4c70a82
Rename h_stack and v_stack to h_flex and v_flex, respectively (#4053)
This PR renames the `h_stack` and `v_stack` to `h_flex` and `v_flex`,
respectively.

We were previously using `h_stack` and `v_stack` to match SwiftUI, but
`h_flex` and `v_flex` fit better with the web/flexbox terminology that
the rest of GPUI uses.

Additionally, we were already calling the utility functions used to
implement `h_stack` and `v_stack` by the new names.

Release Notes:

- N/A
2024-01-15 11:34:06 -05:00
Conrad Irwin
29ce109211
chat panel ++ (#4044)
- Update chat panel with current channel
- Open chat panel for guests
- Open chat when joining a channel with guests
- Some tweaks for chat panels
- Don't lose focus on default panel state
- Make chat prettier (to my eyes at least)
- Fix multiple mentions in one message
- Show a border when scrolled in chat
- Fix re-docking chat panel
- Move settings subscription to dock

[[PR Description]]

Release Notes:

- Opens chat by default when joining a public channel
- Improves chat panel UI
2024-01-14 13:54:10 -07:00
Conrad Irwin
4d87a67af8 Remove unused imports 2024-01-13 22:44:47 -07:00
Conrad Irwin
898645681f Move settings subscription to dock
Reduces likelihood of panels being unable to move themselves
2024-01-13 22:41:26 -07:00
Mikayla
5897b18cfd
remove more commented code 2024-01-12 20:10:40 -08:00