Commit Graph

60 Commits

Author SHA1 Message Date
Thorsten Ball
fc4c533d0a
zed: Use CLI env for lang servers, tasks, terminal (#17075)
This changes the Zed CLI `zed` to pass along the environment to the Zed
project that it opens (if it opens a new one).

In projects, this CLI environment will now take precedence over any
environment that's acquired by running a login shell in a projects
folder.

The result is that `zed my/folder` now always behaves as if one would
run `zed --foreground` without any previous Zed version running.


Closes #7894
Closes #16293 

Related issues:
- It fixes the issue described in here:
https://github.com/zed-industries/zed/issues/4977#issuecomment-2305272027


Release Notes:

- Improved the Zed CLI `zed` to pass along the environment as it was on
the CLI to the opened Zed project. That environment is then used when
opening new terminals, spawning tasks, or language servers.
Specifically:
- If Zed was started via `zed my-folder`, a terminal spawned with
`workspace: new terminal` will inherit these environment variables that
existed on the CLI
- Specific language servers that allow looking up the language server
binary in the environments `$PATH` (such as `gopls`, `zls`,
`rust-analyzer` if configured, ...) will look up the language server
binary in the CLI environment too and use that environment when starting
the process.
- Language servers that are _not_ found in the CLI environment (or
configured to not be found in there), will be spawned with the CLI
environment in case that's set. That means users can do something like
`RA_LOG=info zed .` and it will be picked up the rust-analyzer that was
spawned.

Demo/explanation:



https://github.com/user-attachments/assets/455905cc-8b7c-4fc4-b98a-7e027d97cdfa
2024-08-29 18:09:06 +02:00
Vitor Ramos
f45af17fd4
Add option to pipe from stdin on cli (#16084)
Closes #5044

Release Notes:

- Linux: Added CLI pipe support.
2024-08-22 13:31:58 -06:00
Santeri Salmijärvi
13dcb42c1c
Change PathLikeWithPosition<P> into a non-generic type and replace ad-hoc Windows path parsing (#15373)
This simplifies `PathWithPosition` by making the common use case
concrete and removing the manual, incomplete Windows path parsing.
Windows paths also don't get '/'s replaced by '\\'s anymore to limit the
responsibility of the code to just parsing out the suffix and creating
`PathBuf` from the rest. `Path::file_name()` is now used to extract the
filename and potential suffix instead of manual parsing from the full
input. This way e.g. Windows paths that begin with a drive letter are
handled correctly without platform-specific hacks.

Release Notes:

- N/A
2024-07-30 16:39:33 +03:00
Max Brunsfeld
b9a53ffa0b
Add the ability to edit remote directories over SSH (#14530)
This is a first step towards allowing you to edit remote projects
directly over SSH. We'll start with a pretty bare-bones feature set, and
incrementally add further features.

### Todo

Distribution
* [x] Build nightly releases of `zed-remote-server` binaries
    * [x] linux (arm + x86)
    * [x] mac (arm + x86)
* [x] Build stable + preview releases of `zed-remote-server`
* [x] download and cache remote server binaries as needed when opening
ssh project
* [x] ensure server has the latest version of the binary


Auth
* [x] allow specifying password at the command line
* [x] auth via ssh keys
* [x] UI password prompt

Features
* [x] upload remote server binary to server automatically
* [x] opening directories
* [x] tracking file system updates
* [x] opening, editing, saving buffers
* [ ] file operations (rename, delete, create)
* [ ] git diffs
* [ ] project search

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-07-19 10:27:26 -07:00
Cappy Ishihara
0c6105992c
Open URIs from the CLI, support for the zed:// URI scheme on Linux (#14104)
Allows Zed to open custom `zed://` links (redirects from
https://zed.dev/channels) on Linux used XDG MIME types.

This PR also allows the CLI to be able to open Zed (`zed://`) URIs
directly instead of executing the main executable in
`/usr/libexec/zed-editor`.


Release Notes:

- Linux: Allow `zed.dev/channel` (`zed://`) URIs to open on Linux
- CLI: Ability to open URIs from the command line

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-07-16 14:49:15 -06:00
Josef Zoller
49dc63812a
Stop relying on binary location to be in libexec on Linux (#13374)
This fixes #13360 by adding fallback directories that are searched by
the CLI if the main executable cannot be found in the `libexec`
directory.

Release Notes:

- Added the fallback directories `lib/zed` and `lib/zed-editor` for the
main executable search in the CLI
([#13360](https://github.com/zed-industries/zed/issues/13360)).

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-06-26 13:00:52 -06:00
Conrad Irwin
8949460bd7
fix cli welcome screen (#13474)
Release Notes:

- Fixed first launch via cli

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-06-24 12:55:30 -06:00
Jason Lee
d501a877a0
windows: Improve file_finder to support match with unix style path (#12357)
Release Notes:

- Improved file_finder to support match with Unix style path.


Sometimes we may get the Unix style path string, for example the result
of `git status`:

```bash
$ git status
On branch improve-file-finder-match-unix-paths
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   crates/file_finder/src/file_finder.rs
```

For example, from GitHub page:

<img width="760" alt="image"
src="https://github.com/zed-industries/zed/assets/5518/c6fe8d8a-839e-4eef-a162-43b1dde09593">

If we copy that path to file_finder, it will not match any files on
Windows.

## Before

<img width="699" alt="屏幕截图 2024-05-28 001037"
src="https://github.com/zed-industries/zed/assets/5518/2d2d729e-7d27-421b-9a38-cfe4e53cc033">


## After

Use Unix style path:

<img width="689" alt="屏幕截图 2024-05-28 001150"
src="https://github.com/zed-industries/zed/assets/5518/e82dc8d6-bd6c-4b78-bd91-5b5210da73c4">

Use Windows style path:

<img width="629" alt="屏幕截图 2024-05-28 001302"
src="https://github.com/zed-industries/zed/assets/5518/4892019e-b2f4-41aa-bbf7-2f5f8af7aafa">
2024-06-20 11:33:49 -07:00
Marshall Bowers
81475ac4cd
paths: Replace lazy_static! with OnceLock (#13213)
This PR replaces the `lazy_static!` usages in the `paths` crate with
`OnceLock` from the standard library.

This allows us to drop the `lazy_static` dependency from this crate.

The paths are now exposed as accessor functions that reference a private
static value.

Release Notes:

- N/A
2024-06-18 12:22:37 -04:00
Marshall Bowers
258a8a37d8
Extract paths out of util (#13182)
This PR extracts the definition of the various Zed paths out of `util`
and into a new `paths` crate.

`util` is for generic utils, while these paths are Zed-specific. For
instance, `gpui` depends on `util`, and it shouldn't have knowledge of
these paths, since they are only used by Zed.

Release Notes:

- N/A
2024-06-17 19:27:42 -04:00
maan2003
b82350979f
linux: Use filesystem based unix socket instead of abstract namespace (#12756)
Release Notes:

- N/A

fixes: unable to launch multiple zed instances even if the support dirs
are different(example: bwrap based sandboxing)
2024-06-11 19:17:07 -06:00
Mikayla Maki
da29e33f50
Auto updater disabler (#12660)
Supersedes https://github.com/zed-industries/zed/pull/12659
Fixes https://github.com/zed-industries/zed/issues/12588

One of Zed's core features is our collaboration software. As such, it is
important that we notify the user when their RPC protocol is out of
date, and how to update it. This PR adds a mechanism to replace the
existing auto updater with a message explaining how to update Zed for
this environment.

Release Notes:

- N/A
2024-06-04 15:56:18 -07:00
Conrad Irwin
27beb9e697
Update linux binary expectations (#12622)
Fixes #12585

This changes the expectations for installed binaries on linux based on
work
that @jirutka has done for Alpine.

In particular, we now put the cli in place as `bin/zed` and the zed
binary as
`libexec/zed-editor`, and assume that packagers do the same.

cc @someone13574

Release notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-06-04 15:31:01 -07:00
Owen Law
f7115be3d1
Add Flatpak build system and support (#12006)
ping #6687 

This is the third iteration of this PR ([v2
here](https://github.com/zed-industries/zed/pull/11949)) and uses a
different approach to the first two (the process wrapper lib was a
maintainability nightmare). While the first two attempted to spawn the
necessary processes using flatpak-spawn and host-spawn from the app
inside the sandbox, this version first spawns the cli binary which then
restart's itself *outside* of the sandbox using flatpak-spawn. The
restarted cli process than can call the bundled app binary normally,
with no need for flatpak-spawn because it is already outside of the
sandbox. This is done instead of keeping the cli in the sandbox because
ipc becomes very difficult and broken when trying to do it across the
sandbox.

Gnome software (example using nightly channel and release notes
generated using the script):
<img
src="https://github.com/zed-industries/zed/assets/81528246/6391d217-0f44-4638-9569-88c46e5fc4ba"
width="600"/>

TODO in this PR:
- [x] Bundle libs.
- [x] Cleanup release note converter.

Future work:

- [ ] Auto-update dialog
- [ ] Flatpak auto-update (complete 'Auto-update dialog' first)
- [ ] Experimental
[bundle](https://docs.flatpak.org/en/latest/single-file-bundles.html)
releases for feedback (?).

*(?) = Maybe / Request for feedback*

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2024-05-27 19:01:20 -06:00
Conrad Irwin
5b2c019f83
cli: Support --foreground for debugging (#11819)
Release Notes:

- Added `--foreground` to the cli to allow running zed on the current
PTY.
2024-05-14 16:05:40 -06:00
Conrad Irwin
4f9ba28a25
linux cli (#11585)
- [x] Build out cli on linux
- [x] Add support for --dev-server-token sent by the CLI
- [x] Package cli into the .tar.gz
- [x] Link the cli to ~/.local/bin in install.sh

Release Notes:

- linux: Add cli support for managing zed
2024-05-09 21:08:49 -06:00
Conrad Irwin
048fc7ad09
Allow cli to accept --dev-server-token (#10944)
Release Notes:

- N/A
2024-04-24 13:15:19 -06:00
Piotr Osiewicz
1be452744a
cli: Use leading dashes in channel designators (#10858)
/cc @maxbrunsfeld 

Release Notes:

- N/A
2024-04-22 20:26:49 +02:00
Piotr Osiewicz
a111b959d2
cli: Treat first argument as name of release channel to use for the cli (#10856)
With this commit, it is now possible to invoke cli with a release
channel of bundle as an argument. E.g: `zed stable some_arguments` will
find CLI binary of Stable channel installed on your machine and invoke
it with `some_arguments` (so the first argument is essentially omitted).

Fixes #10851

Release Notes:

- CLI now accepts an optional name of release channel as it's first
argument. For example, `zed stable` will always use your Stable
installation's CLI. Trailing args are passed along.
2024-04-22 18:01:06 +02:00
白山風露
94c51c6ac9
Windows: Enable clippy deny warnings (#9920)
~Waiting #9918~

Release Notes:

- N/A
2024-03-28 11:55:35 -04:00
Tobias Decking
df94906508
Make the cli crate depend on workspace clap (#9507)
This fixes an outstanding TODO.

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-03-18 20:00:37 +01:00
Conrad Irwin
646f69583a
Allow opening non-extant files (#9256)
Fixes #7400



Release Notes:

- Improved the `zed` command to not create files until you save them in
the editor ([#7400](https://github.com/zed-industries/zed/issues/7400)).
2024-03-12 22:30:04 -06:00
Conrad Irwin
05dfe96f0c
Add --add/--new to control CLI behaviour (#9202)
When neither is specified, if you open a directory you get a new
workspace, otherwise files are added to your existing workspace.

With --new files are always opened in a new workspace
With --add directories are always added to an existing workspace

Fixes #9076
Fixes #4861
Fixes #5370

Release Notes:

- Added `-n/--new` and `-a/--add` to the zed CLI. When neither is
specified, if you open a directory you get a new workspace, otherwise
files are added to your existing workspace. With `--new` files are
always opened in a new workspace, with `--add` directories are always
added to an existing workspace.
([#9076](https://github.com/zed-industries/zed/issues/9096),
[#4861](https://github.com/zed-industries/zed/issues/4861),
[#5370](https://github.com/zed-industries/zed/issues/5370)).
2024-03-12 14:27:58 -06: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
Mikayla Maki
8a92d28663
Remove todo! comments (#8981)
Switching fully to normal `todo` style

Release Notes:

- N/A
2024-03-06 18:25:20 -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
Marshall Bowers
c9a509c805
Add cargo xtask clippy (#8722)
This PR sets up a `cargo xtask clippy` command for running `cargo
clippy` with our defined set of options.

The intent is to make this easier to manage as we start enabling more
Clippy rules.

Release Notes:

- N/A
2024-03-02 14:46:02 -05:00
Nathan Sobo
4cc4f08a53
Remove ! from todo!() in comments (#8643)
This practice makes it difficult to locate todo!s in my code when I'm
working. Let's take out the bang if we want to keep doing this.

Release Notes:

- N/A
2024-02-29 18:19:05 -07:00
Dzmitry Malyshau
cb75c57fc0
Cleanup dependencies (part 4) (#8468)
Follow-up to #8425 . Final part - adds the CI check.

Release Notes:
- N/A
2024-02-27 20:41:49 +02:00
Bennet Bo Fenner
dc7e14f888
Respect user preferences when formatting timestamp (#7994)
This is a follow up to #7945. The current behaviour reads the locale and
infers from that which type of time format should be used (12 hour/24
hour).
However, in macOS you can override this behaviour, e.g. you can use
en_US locale but still use the 24 hour clock format (Can be customized
under Settings > General > Date & Format > 24-hour time). You can even
customize the date format.

This PR uses the macOS specific `CFDateFormatter` API, which outputs
time format strings, that respect those settings.

Partially fixes #7956 (as its not implemented for linux)

Release Notes:

- Added localization support for all macOS specific date and time
configurations in chat
2024-02-23 19:18:06 -07:00
白山風露
aef299be3d
CI: Enable clippy on Windows (#8240)
Release Notes:

- N/A
2024-02-23 16:23:42 -08:00
Kirill Bulatov
5175c8963a
Actually fail on clippy failures (#7619)
Before the change to `script/clippy`, bash ignored first `clippy`
invocation failure and CI moved on with Linux errors and warnings
emitted.


Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-02-09 10:13:00 -08: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
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
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
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
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
Conrad Irwin
13192fa03c
Code to allow opening zed:/channel/1234
Refactored a bit how url arguments are handled to avoid adding too much
extra complexity to main.
2023-10-05 14:57:45 -07:00
Julia
66bf56fc4f Prevent duplicate instances by coordinating via a socket 2023-07-07 14:19:44 -04:00
Joseph Lyons
7c60f636d5 Fix typos 2023-06-02 22:02:19 -04:00
Kirill Bulatov
5d4fc99750 Unit test file:row:column parsing 2023-05-16 21:07:48 +03:00
Kirill Bulatov
106064c734 Do not break Zed & Zed CLI compatibility 2023-05-16 21:07:47 +03:00
Kirill Bulatov
628558aa39 Attempt to open rows and columns from CLI input 2023-05-16 21:07:26 +03:00
Kirill Bulatov
d719352152 Unify path:row:column parsing, use it in CLI 2023-05-16 21:07:26 +03:00
Kirill Bulatov
903eed964a Allow CLI to start Zed from local sources
Zed now is able to behave as if it's being started from CLI
(`ZED_FORCE_CLI_MODE` env var)

Zed CLI accepts regular binary file path into `-b` parameter (only *.app before),
and tries to start it as Zed editor with `ZED_FORCE_CLI_MODE` env var
and other params needed.
2023-05-16 17:41:32 +03:00
Max Brunsfeld
ebbe52e6b0 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
Antonio Scandurra
5471217089 Use the same serde version across the entire workspace 2023-03-28 09:42:00 -07:00
Antonio Scandurra
1af8f4be19 Deserialize Theme directly into the heap to avoid stack overflow
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-03-17 15:58:52 +01:00
Mikayla Maki
d060114f00 Added complete scripts for generating third party license files 2023-01-23 12:47:12 -08:00