Commit Graph

12 Commits

Author SHA1 Message Date
Anthony Eid
88857f8149
VS Code -> Zed tasks converter (#9538)
We can convert shell, npm and gulp tasks to a Zed format. Additionally, we convert a subset of task variables that VsCode supports.

Release notes:

- Zed can now load tasks in Visual Studio Code task format

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-03-20 16:37:26 +01:00
Kirill Bulatov
dcdd1ece1c
Small improvements of the task terminal spawn behavior (#9399)
* Add a `reveal: always|never` field in task definitions from tasks.json
, allowing to customize task terminal behavior on spawn
* Ensure reveal: always reveals the terminal even if the old task is
already running


Release Notes:

- Added a `reveal: always|never` (`always` is a default) field in task
definitions from tasks.json , allowing to customize task terminal
behavior on spawn

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
2024-03-15 18:32:59 +02: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
Piotr Osiewicz
2201b9b116
task: Add task contexts (#8675)
This PR supplements tasks with additional environment variables; ideally
we'll be able to write a task like:
`cargo test -p $ZED_CURRENT_PACKAGE -- $ZED_CURRENT_FUNCTION`
- [x] Flesh out multibuffer interactions
- [x] Add ZED_SYMBOL detection based on tree-sitter queries
- [ ] Add release note and demo
- [x] Figure out a solution for rerun dilemma - should `task: rerun`
reevaluate contexts for tasks?

This PR introduced the following variables:
- ZED_COLUMN - current line column
- ZED_ROW - current line row
and the following, which are available for buffers with associated
files:
- ZED_WORKTREE_ROOT - absolute path to the root of the current worktree.
- ZED_FILE - absolute path to the file
- ZED_SYMBOL - currently selected symbol; should match the last symbol
shown in a symbol breadcrumb (e.g. `mod tests > fn test_task_contexts`
should be equal to ZED_SYMBOL of `test_task_contexts`). Note that this
isn't necessarily a test function or a function at all.

Also, you can use them in `cwd` field of definitions (note though that
we're using https://docs.rs/subst/latest/subst/#features for that, so
don't expect a full shell functionality to work); the syntax should
match up with your typical Unix shell.


Release Notes:

- Added task contexts, which are additional environment variables set by
Zed for task execution; task content is dependent on the state of the
editor at the time the task is spawned.

---------

Co-authored-by: Anthony <anthonyeid7@protonmail.com>
2024-03-04 21:04:53 +01:00
Piotr Osiewicz
98a1e87fbe
task: Spawn static tasks in separate shell (#8827)
That way one can use environment variables in task definitions.

Fixes: #8660

/cc @SomeoneToIgnore it looks like we don't ever set `separate_shell` to
false anymore, it might be worth streamlining?

Release Notes:

- Fixed static tasks not being run under a separate shell.
- Removed `separate_shell` setting from task definitions. It is now a default for tasks defined in tasks.json file.
2024-03-04 15:57:30 +01:00
Brian Donovan
a84a3c0ebe
docs: Fix "it's" typos that should be "its" (#8690)
These all meant to use the possessive "its" rather than the contraction
of "it is".
2024-03-01 20:32:27 -05:00
Kirill Bulatov
ac30ded80e
Allow .zed/tasks.json local configs (#8536)
![image](https://github.com/zed-industries/zed/assets/2690773/e1511777-b4ca-469e-8636-1e513b615368)

Follow-up of
https://github.com/zed-industries/zed/issues/7108#issuecomment-1960746397

Makes more clear where each task came from, auto (re)load
.zed/config.json changes, properly filtering out other worktree tasks.

Release Notes:

- Added local task configurations
2024-02-29 01:18:13 +02:00
Kirill Bulatov
2e516261fe Add tests on inventory task sorting 2024-02-28 14:13:40 +02:00
Dzmitry Malyshau
83f493b387
Clean up deps for file_finder, language_selector, task, rpc, storybook (#8353)
Following-up on #8330

Invocation
```bash
cargo-machete --with-metadata --skip-target-dir --fix
````

There is more stuff to fix, but it chokes on `async-lock`:
```
cargo-machete found the following unused dependencies in /x/Code/zed:
rpc -- /x/Code/zed/crates/rpc/Cargo.toml:
        async_lock
        prost_build
        serde_derive
Error: Dependency async_lock not found
```

Release Notes:
- N/A
2024-02-25 10:10:07 +02:00
Kirill Bulatov
0c939e5dfc
Add task docs and default keybindings (#8123)
Also group task source modules together

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-02-21 16:43:56 +02:00
Piotr Osiewicz
b9151b9506
Runnables: remove version field from the format (#8118)
This changes the format of runnables slightly (the top-level object is
now a sequence, not a map).
The 2nd commit pulls in aliases from .zshrc and co.
Release Notes:

- N/A
2024-02-21 14:30:16 +01:00
Kirill Bulatov
2679457b02
Rename runnables into tasks (#8119)
Release Notes:

- N/A
2024-02-21 14:56:43 +02:00