Commit Graph

228 Commits

Author SHA1 Message Date
Piotr Osiewicz
4dd05a80e0
YAML: set auto_indent_using_last_non_empty_line to false (fix wonky formatting) (#13351)
This makes us treat yaml like other indentation-sensitive languages
(e.g. Python) and not reformat it on pasting and what not.

Fixes #12236
Fixes #13338

Release Notes:

- Fixed spurious appliance of auto-formatting to YAML blocks.
2024-06-21 10:58:44 +02:00
Piotr Osiewicz
8af8493da6
typescript: Make VTSLS the default language server for Typescript (#13140)
Additionally, limit # of returned completion items + use fuzzy filtering
on VTSLS side. Prime LSP handler for response handling.


Release Notes:

- VTSLS is now a default language server for TypeScript, TSX, and
JavaScript.
2024-06-18 20:16:03 +02: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
Nigel Jose
ba59e66314
Improve Python syntax highlighting (#12868)
Release Notes:

- Improve syntax highlighting in Python #12578 

Before:
<img width="1181" alt="Screenshot 2024-06-08 at 01 44 54"
src="https://github.com/zed-industries/zed/assets/87859239/0b8ab26b-149b-477e-af08-8cd9f2b1c117">

After:

<img width="1184" alt="Screenshot 2024-06-10 at 01 02 35"
src="https://github.com/zed-industries/zed/assets/87859239/a319a5ea-54b7-4681-951d-130ea26aa390">

---------

Co-authored-by: Joseph T Lyons <JosephTLyons@gmail.com>
2024-06-18 12:21:18 -04:00
Panghu
3701e190ce
Add runnable for rust main function (#13087)
Release Notes:

- N/A



https://github.com/zed-industries/zed/assets/21101490/7a57805c-1d31-48b2-bc2c-3a6f0b730d72
2024-06-18 16:25:20 +02:00
Piotr Osiewicz
3a26a4809d
lsp: Revert URL type change (#13193)
This reverts URI changes made in
https://github.com/zed-industries/zed/pull/12928 while keeping the perf
goodies in tact. We should keep an eye out for
https://github.com/gluon-lang/lsp-types/issues/284
Fixes: https://github.com/zed-industries/zed/issues/13135
Fixes: https://github.com/zed-industries/zed/issues/13131
Release Notes:

- N/A
2024-06-18 12:39:56 +02:00
Conrad Irwin
0af6e442a7
Don't generate invalid ranges for C code (#13183)
Fixes: #13128

Release Notes:

- Fixed a panic when editing C code
([#13128](https://github.com/zed-industries/zed/issues/13128)).
2024-06-17 21:13:42 -06: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
Piotr Osiewicz
55ba80ddd1
lsp: Add support for label_details in completions (#13043)
This fixes an issue reported by @Spoutnik97 in
https://github.com/zed-industries/zed/issues/12711#issuecomment-2163785111
- vtsls returns auxiliary docs via .label_details and not plain .details
field.

Release Notes:

- Improved quality of auxiliary details in completions returned by VTSLS
2024-06-14 13:49:08 +02:00
Piotr Osiewicz
7798f64d1b
chore: Bump lsp-types to 0.97.0 (#12928)
This also includes https://github.com/gluon-lang/lsp-types/pull/287,
which should significantly reduce the time it takes for us to
deserialize completion lists.


Release Notes:
- N/A
2024-06-13 13:48:12 +02:00
claytonrcarter
5e9f9b4edd
Wrap JS/TS runnables in quotes (#12932)
Some of the runnables added in #12118 don't work for tests (or code)
that contain spaces. In other words, the runnable for a test like
```js
it('does the thing', () => ...)
```
would end up w/ something like `npx jest does the thing
/path/to/file.spec.js`, but what we really want is `npx jest
--testNamePattern "does the thing" /path/to/file.spec.js`. A similar
thing was happening for the "node execute selection" runnable: selecting
`let foo = 1` would run `node -e let foo = 1`, not `node -e "let foo =
1"`.

In my (somewhat limited?) experience, it's very common for tests like
these to include spaces, and of course a code selection is almost
certain to contain whitespace.

Not covered: 
- this just blindly wraps quotes around the symbol/code; in the future
it may make sense to try to figure out *what type of quote* to use. (eg
`it('does the "thing"', () => ...)` is a valid test name, but
`--testNamePattern "does the "thing""` would not work. Note the doubled
quotes.)
- I did not wrap the filenames in quotes to escape those for the shell,
nor did I test if that's actually an issue. In my experience, I've not
seen many (any?) test files that contain spaces in the name, but I
suspect that it would be an issue if a containing dir includes spaces.
(eg `npx jest ... /path/to/My Documents/Code/file.spec.js`

/cc @RemcoSmitsDev 

Release Notes:

- Fixed some runnables in Javascript/Typescript
2024-06-12 14:58:04 +02:00
Chung Wei Leong
ec95a33d8c
Added TSX test runnables (#12922)
Fix #12884

Release Notes:

- Added runnable tests for TSX files.

---
Runnable tests can be customized via `tsx-test` tag

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-06-12 11:02:24 +02:00
Panghu
e829a8c3b0
Add auto-completion support for package.json files (#12792)
![截屏2024-06-08 07 56
41](https://github.com/zed-industries/zed/assets/21101490/da97e7d4-458b-4262-ac23-a4704af4f015)

Release Notes:

- Added auto-completion support for `package.json` files.
2024-06-08 13:33:29 +03:00
Arseny Kapoulkine
87845a349d
cpp: Highlight sized type specifiers as keywords (#12751)
Without this, `unsigned` or `unsigned int` is not highlighted properly:
`int` is a primitive_type but `unsigned` is a sized_type_specifier. This
is already handled in C as both are part of @type highlight group.

Before:

![image](https://github.com/zed-industries/zed/assets/1106629/7210b769-9dff-428c-9e4f-55b652f91674)

After:

![image](https://github.com/zed-industries/zed/assets/1106629/8661c412-30f0-4b44-a4a2-1860a0b56a4e)

Release Notes:

- N/A
2024-06-08 13:26:10 +03:00
Stanislav Alekseev
07dbd2bce8
Use rust-analyzer from path if possible (#12418)
Release Notes:

- Added support for looking up the `rust-analyzer` binary in `$PATH`. This allows using such tools as `asdf` and nix to configure per-folder rust installations. To enable this behavior, use the `path_lookup` key when configuring the `rust-analyzer` `binary`: `{"lsp": {"rust-analyzer": {"binary": {"path_lookup": true }}}}`.
2024-06-07 06:56:38 +02:00
Nycheporuk Zakhar
3000f6ea22
Use cwd to run package.json script (#12700)
Fixes case when `package.json` is not in root directory. 
Usually in mono repository, where multiple `package.json` may be present

Release Notes:

- Fixed runnable for package.json in monorepos
2024-06-06 15:17:45 +03:00
Dhairya Nadapara
0b75afd322
chore: added inl to cpp config (#12710)
Screenshot:
<img width="1027" alt="image"
src="https://github.com/zed-industries/zed/assets/19250981/1d35d35c-d31c-4feb-b2ca-a417972fadf6">

Release Notes:

- Added `inl` to cpp config ([12605](https://github.com/zed-industries/zed/issues/12605))
2024-06-06 10:23:36 +03:00
Marshall Bowers
2f65c3c6e6
Disable vtsls by default (#12611)
This PR adds default settings to disable `vtsls` by default so that
there aren't multiple TypeScript language servers running.

I also renamed the language server from `vtsls-language-server` to just
`vtsls`, since the `-language-server` suffix was redundant.

Release Notes:

- N/A
2024-06-03 14:30:33 -04:00
Piotr Osiewicz
b1efea1100
typescript: Add support for VTSLS (#12606)
You can opt into using VTSLS instead of typescript-language-server by
pasting the following snippet into your settings:
```
  "languages": {
    "TSX": {
      "language_servers": [
        "!typescript-language-server",
        "vtsls-language-server"
      ]
    }
  },
```

Related to: #5166 
Release Notes:

- Added support for using [vtsls](https://github.com/yioneko/vtsls)
language server for Typescript/Javascript.
2024-06-03 17:11:28 +02:00
Piotr Osiewicz
5e3d85c023
json: Fix tsconfig.json schema overriding other schemas (such as keymap) (#12600)
@mrnugget spotted that tsconfig.json schema is getting applied on
current Nightly. I've tracked it down to a misconfiguration of JSON
language server. Mea culpa.

No release note as that change has not went out to the public yet.

Release Notes:

- N/A
2024-06-03 12:16:09 +02:00
Jayden Seric
b218d8778d
Fix TSX and JavaScript shorthand property syntax highlighting (#12512)
This replicates the fix for the TypeScript language for
https://github.com/zed-industries/zed/issues/5239 in
https://github.com/zed-industries/zed/pull/12505 for the TSX and
JavaScript languages, fixing
https://github.com/zed-industries/zed/issues/12510 and fixing
https://github.com/zed-industries/zed/issues/12509 .

See
https://github.com/zed-industries/zed/pull/12505#issuecomment-2141002505
.

Keep in mind I don't have a proper Zed local development environment
setup to test these simple changes.

Release Notes:

- Fixed TSX shorthand property syntax highlighting
([#12510](https://github.com/zed-industries/zed/issues/12510)).
- Fixed JavaScript shorthand property syntax highlighting
([#12509](https://github.com/zed-industries/zed/issues/12509)).
2024-06-03 00:52:16 +02:00
Rayduck
95e360b170
python: Add runnable unittest tasks (#12451)
Add runnable tasks for Python, starting with `unittest` from the
standard library. Both `TestCase`s (classes meant to be a unit of
testing) and individual test functions in a `TestCase` will have
runnable icons. For completeness, I also included a task that will run
`unittest` on the current file.

The implementation follows the `unittest` CLI. The unittest module can
be used from the command line to run tests from modules, classes or even
individual test methods:

```
python -m unittest test_module.TestClass
python -m unittest test_module.TestClass.test_method
```

```python
import unittest

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        self.assertEqual('foo'.upper(), 'FOO')

    def test_isupper(self):
        self.assertTrue('FOO'.isupper())
        self.assertFalse('Foo'.isupper())

    def test_split(self):
        s = 'hello world'
        self.assertEqual(s.split(), ['hello', 'world'])
        # check that s.split fails when the separator is not a string
        with self.assertRaises(TypeError):
            s.split(2)

if __name__ == '__main__':
    unittest.main()
```

From the snippet provided by `unittest` docs, a user may want to run
test_split independently of the other test functions in the test case.
Hence, I decided to make each test function runnable despite `TestCase`s
being the unit of testing.

## Example of running a `TestCase`
<img width="600" alt="image"
src="https://github.com/zed-industries/zed/assets/16619392/7be38b71-9d51-4b44-9840-f819502d600a">

## Example of running a test function in a `TestCase`
<img width="600" alt="image"
src="https://github.com/zed-industries/zed/assets/16619392/f0b6274c-4fa7-424e-a0f5-1dc723842046">

`unittest` will also run the `setUp` and `tearDown` fixtures.

Eventually, I want to add the more commonly used `pytest` runnables
(perhaps as an extension instead).

Release Notes:

- Added runnable tasks for Python `unittest`.
([#12080](https://github.com/zed-industries/zed/issues/12080)).
2024-06-01 18:46:36 +02:00
Piotr Osiewicz
fbcc5ccdb9
typescript: Add completions for tsconfig.json properties (#12560)
Release Notes:

- Added completions for tsconfig.json config file.
2024-06-01 17:51:58 +02:00
Remco Smits
29b5253a1d
JavaScript: Add runnable tests (#12118)
https://github.com/zed-industries/zed/assets/62463826/2912c940-bd00-483d-9ce7-df1a2539560a


Release Notes:

- Added runnable tests for JavaScript & Typescript files.
- Added task to run selected javascript code.
2024-06-01 14:28:53 +02:00
moshyfawn
dc141d0f61
typescript: Fix shorthand property highlight (#12505)
Release Notes:

- Fixed Typescript shorthand property highlight
([#5239](https://github.com/zed-industries/zed/issues/5239)).

Closes: #5239
2024-05-30 18:27:03 -04:00
Piotr Osiewicz
20f37f0647
chore: Change git deps to crates.io dependencies where possible (#12362)
Release Notes:

- N/A
2024-05-27 23:32:51 +02:00
Piotr Osiewicz
345361cd38
json: Register tasks on Rust side and not via tasks.json (#12345)
/cc @RemcoSmitsDev new task indicators weren't showing for me in JSON
files.
`tasks.json` of native grammars is not being read by anything by
default, so we tend to register tasks as Rust structs, foregoing the
deserialization step. This doesn't apply to tasks registered in
extensions, which have to have tasks.json.

Release Notes:

- N/A
2024-05-27 11:50:45 +02:00
Anıl Şenay
ddb551c794
go: Add runnables for Go (#12003)
Implemented runnables for specially for running tests for Go.

I'm grateful for your feedback because this is my first experience with
Rust and Zed codebase.
![resim](https://github.com/zed-industries/zed/assets/1047345/789b31da-554f-47cd-a08c-444eced104f4)

https://github.com/zed-industries/zed/assets/1047345/ae1abd9e-3657-4322-9c28-02d0752b5ccd


Release Notes:

- Added Runnables/Tasks for:
  - Run test functions which start with "Test"
  - Run subtests
  - Run benchmark tests
  - Run main function



---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-05-26 15:16:52 +02:00
Remco Smits
5665cad250
json: Add runnable for package.json and composer.json scripts (#12285)
**Package.json**


https://github.com/zed-industries/zed/assets/62463826/f8ca12a5-1292-4465-83e1-3c2ab65f5833

**Composer.json**


https://github.com/zed-industries/zed/assets/62463826/61f9e74d-c6ed-4329-855b-d0161e0a117b

Release Notes:

- Added runnable for `package.json` and `composer.json` scripts
([#12215](https://github.com/zed-industries/zed/issues/12215)).
2024-05-26 13:47:49 +02:00
Jakob Hellermann
a1e5b122e7
Fix some warnings/issues uncovered by the new cfg checking (#12310)
Rust recently got the ability to check for typos or errors in `cfg`
attributes: https://blog.rust-lang.org/2024/05/06/check-cfg.html
This PR fixes the new warnings.

- gpui can be run with `RUSTFLAGS="--cfg gles"`, make this explicit in
`[workspace.lints.rust]`
- `cfg!(any(test, sqlite))` was just a bug, it should be
`feature(sqlite)`
- the `languages` crate had a `#[cfg(any(test, feature =
"test-support"))]` function without ever declaring the `test-support`
feature
- the `MarkdownTag` enum had a `cfg_attr` for serde without actually
having serde support


Now the only warnings when building are unused fields
`InlayHover.excerpt`, `SavedConversationMetadata.path` ,
`UserTestPlan.allow_client_reconnection` and `SyntaxMapCapture.depth`.

Release Notes:

- N/A
2024-05-26 12:50:20 +02:00
Kirill Bulatov
32f11dfa00
Use language settings' prettier parsers as a fallback for files with no path (#12273)
Follow-up of
https://github.com/zed-industries/zed/pull/12095#issuecomment-2123230762
reverting back part of https://github.com/zed-industries/zed/pull/11558
that was related to `language.toml` parsing.

Now all extensions that define `prettier_parser_name` in their language
configs, will enable formatting untitled buffers without any extra
language settings like

```json
{
  "languages": {
    "JSON": {
      "prettier": {
        "allowed": true,
        "parser": "json"
      }
    }
  }
}
```



Release Notes:

- Improved ergonomics of untitled buffer formatting with prettier, no
extra language settings are needed by default.
2024-05-25 10:50:53 +03:00
Piotr Osiewicz
27229bba6b
tasks: Provide task variables from matching runnable ranges in task modal (#12237)
In #12003 we found ourselves in need for precise region tracking in
which a given runnable has an effect in order to grab variables from it.
This PR makes it so that in task modal all task variables from queries
overlapping current cursor position.
However, in the process of working on that I've found that we cannot
always use a top-level capture to represent the full match range of
runnable (which has been my assumption up to this point). Tree-sitter
captures cannot capture sibling groups; we did just that in Rust
queries.

Thankfully, none of the extensions are affected as in them, a capture is
always attached to single node. This PR adds annotations to them
nonetheless; we'll be able to get rid of top-level captures in extension
runnables.scm once this PR is in stable version of Zed.


Release Notes:

- N/A
2024-05-24 21:00:23 +02:00
Remco Smits
1e5389a2be
rust: Add runnable icon for #[cfg(test)] mod tests (#12017)
This allows you to run all the tests inside the `mod tests` block. 
Fixes #11967.

<img width="366" alt="Screenshot 2024-05-18 at 16 07 32"
src="https://github.com/zed-industries/zed/assets/62463826/01fc378c-1546-421d-8250-fe0227c1e5a0">

<img width="874" alt="Screenshot 2024-05-18 at 16 37 21"
src="https://github.com/zed-industries/zed/assets/62463826/4a880b91-df84-4917-a16e-5d5fe20e22ac">

Release Notes:

- Added runnable icon for Rust `#[cfg(test)] mod tests` blocks
([#11967](https://github.com/zed-industries/zed/issues/11967)).
2024-05-24 11:02:23 +02:00
Philip Durbin
2177ee8cc0
Highlight files ending in mdwn as Markdown (#12224)
Highlight files ending in `mdwn` as Markdown.

(Ikiwiki uses `mdwn` as the file extension for Markdown.)

This pull request was inspired by this one:

- #1209/

Release Notes:

- Added ".mdwn" as a Markdown file extension.
2024-05-24 10:01:56 +03:00
Piotr Osiewicz
58796a8480
tasks: Expose captured variables to ContextProvider (#12134)
This PR changes the interface of ContextProvider, allowing it to inspect
*all* variables set so far during the process of building
`TaskVariables`. This makes it possible to capture e.g. an identifier in
tree-sitter query, process it and then export it as a task variable.

Notably, the list of variables includes captures prefixed with leading
underscore; they are removed after all calls to `build_context`, but it
makes it possible to capture something and then conditionally preserve
it (and perhaps modify it).

Release Notes:

- N/A
2024-05-22 19:45:43 +02:00
Thorsten Ball
7c9c80d663
go: Highlight constant identifiers (#12111)
Release Notes:

- N/A
2024-05-22 08:37:20 +02:00
d1y
a33aedff81
gomod and gowork add gopls server (#12109)
<img width="684" alt="image"
src="https://github.com/zed-industries/zed/assets/45585937/c22e00d2-e197-44b3-864f-db20eaf47ff7">

Release Notes:

- Added `gopls` support when opening `go.mod` or `go.work` files.

Co-authored-by: Thorsten Ball <thorsten@zed.dev>
2024-05-22 08:16:55 +02:00
Thorsten Ball
8168ec2a28
go: Add runnables (#12110)
This adds support for runnables to Go.

It adds the following tasks:

- `go test $ZED_GO_PACKAGE -run $ZED_SYMBOL`
- `go test $ZED_GO_PACKAGE`
- `go test ./...`
- `go run $ZED_GO_PACKAGE` if it has a `main` function

Release Notes:

- Added built-in Go runnables and tasks that allow users to run Go test
functions, test packages, or run `main` functions.

Demo:



https://github.com/zed-industries/zed/assets/1185253/a6271d80-faf4-466a-bf63-efbec8fe6c35




https://github.com/zed-industries/zed/assets/1185253/92f2b616-7501-463d-b613-1ec1084ae0cd
2024-05-22 07:18:49 +02:00
Piotr Osiewicz
7a90b1124f
html: release 0.1.0 (#12083)
Add config for tag autoclosing: add following to lsp section of your
settings:
    "vscode-html-language-server": {
      "settings": {
        "html": { "tagAutoclosing": true }
      }
    }

It also accepts `css`, `js/ts` and `javascript` as options.

Disable HTML language server in JS/TS/TSX files for now. I decided to
disable it for now as it caused excessive edits in these types of files
(as reported by @mariansimecek in
https://github.com/zed-industries/zed/pull/11761#issuecomment-2122038107);
it looks like HTML language server tries to track language ranges (e.g.
whether a particular span is TS/HTML fragment etc) just like we do.
However in plain JS/TSX files it seems like it treats the whole file as
one big chunk of HTML, which is.. not right, to say the least.

No release note, as HTML extension goodies are not on Preview yet.

Release Notes:

- N/A
2024-05-21 14:04:02 +02:00
Piotr Osiewicz
0b8c1680fb
html: Add support for autoclosing of tags (#11761)
Fixes #5267 
TODO:
- [x] Publish our fork of vscode-langservers-extracted on GH and wire
that through as a language server of choice for HTML extension.
- [x] Figure out how to prevent edits made by remote participants from
moving the cursor of a host.

Release Notes:

- Added support for autoclosing of HTML tags in local projects.
2024-05-20 17:00:27 +02:00
Piotr Osiewicz
7db85b0d2e
golang: autoclose backticks (#12050)
Fixes #12025



Release Notes:
- Fixed backtick characters not getting autoclosed in Golang files
(#12025).
2024-05-20 10:18:12 +02:00
Marshall Bowers
13bbaf1e18
Use UpdateGlobal accessors in more places (#11925)
This PR updates a number of instances that were previously using
`cx.update_global` to use `UpdateGlobal::update_global` instead.

Release Notes:

- N/A
2024-05-16 13:30:04 -04:00
Thorsten Ball
90b631ff3e
tailwind: Allow configuring custom tailwind server build (#11921)
This adds the ability to configure the `tailwindcss-language-server`
integration to use a custom build of the server.

Example configuration in Zed `settings.json`:

```json
{
  "lsp": {
    "tailwindcss-language-server": {
      "binary": {
        "arguments": [
          "/Users/username/tailwindcss-intellisense/packages/tailwindcss-language-server/bin/tailwindcss-language-server",
          "--stdio"
        ]
      }
    }
  }
}
```

This will cause Zed to use its own Node version and run it with the
given arguments.

**Note**: you need to provide `--stdio` as the second argument!

It's also possible to use a custom Node binary:

```json
{
  "lsp": {
    "tailwindcss-language-server": {
      "binary": {
        "path": "/Users/username/bin/my-node",
        "arguments": [
          "/Users/username/tailwindcss-intellisense/packages/tailwindcss-language-server/bin/tailwindcss-language-server",
          "--stdio"
        ]
      }
    }
  }
}
```

This is *super handy* when debugging the language server.

Release Notes:

- Added ability to configure own build of `tailwindcss-language-server`
in Zed settings. Example:
`{"lsp":{"tailwindcss-language-server":{"binary":{"arguments":["/absolute/path/to/tailwindcss-language-server/bin/tailwindcss-language-server",
"--stdio" ]}}}}`
2024-05-16 18:00:30 +02:00
Krzysztof Witkowski
a414b16754
python: Add highlighting to variables (#11851) 2024-05-16 11:43:48 -04:00
Thorsten Ball
58919e9f04
eslint: Change default configuration to fix errors (#11896)
Without this, we'd get constant errors when typing something with ESLint
enabled:

[2024-05-16T10:32:30+02:00 WARN project] Generic lsp request to node
failed: Request textDocument/codeAction failed with message: Cannot read
properties of undefined (reading 'disableRuleComment')
[2024-05-16T10:32:30+02:00 ERROR util]
crates/project/src/project.rs:7023: Request textDocument/codeAction
failed with message: Cannot read properties of undefined (reading
'disableRuleComment')
[2024-05-16T10:32:31+02:00 WARN project] Generic lsp request to node
failed: Request textDocument/codeAction failed with message: Cannot read
properties of undefined (reading 'disableRuleComment')
[2024-05-16T10:32:31+02:00 ERROR util]
crates/project/src/project.rs:7023: Request textDocument/codeAction
failed with message: Cannot read properties of undefined (reading
'disableRuleComment')

This is fixed by changing the default settings for ESLint language
server to have those fields.

I don't think we need to make these configurable yet. These are defaults
that multiple other plugins also use:

- vscode-eslint:
https://sourcegraph.com/github.com/microsoft/vscode-eslint@4d9fc40e71c403d359beaccdd4a6f8d027031513/-/blob/client/src/client.ts?L702-703
- nvim-lspconfig:
https://sourcegraph.com/github.com/neovim/nvim-lspconfig@a27179f56c6f98a4cdcc79ee2971b514815a4940/-/blob/lua/lspconfig/server_configurations/eslint.lua?L94-101
- coc-eslitn:
https://sourcegraph.com/github.com/neoclide/coc-eslint@70eb10d294e068757743f9b580c724e92c5b977d/-/blob/src/index.ts?L698:17-698:35



Release Notes:

- Changed the default ESLint configuration to include the following in
order to silence warnings/errors: `{"codeAction": {
"disableRuleComment": { "enable": true, "location": "separateLine", },
"showDocumentation": { "enable": true } }}`
2024-05-16 10:41:57 +02:00
Kirill Bulatov
cb430fc3e4
Autodetect parser name with prettier by default (#11558)
Closes https://github.com/zed-industries/zed/issues/11517 

* Removes forced prettier parser name for languages, making `auto`
command to run prettier on every file by default.
* Moves prettier configs away from plugin language declarations into
language settings

Release Notes:

- N/A
2024-05-15 22:51:46 +03:00
Thorsten Ball
1b9014bca6
tailwind: Allow Tailwind LS to be used in Scala (#11858)
This fixes the issue mentioned here:
https://github.com/zed-industries/zed/issues/5830#issuecomment-2111947083

In order for other languages to work, we need to pass the following
settings along to the Tailwind language server.

With the following Zed settings, it then also works for Scala:

```json
{
  "languages": {
    "Scala": {
      "language_servers": ["tailwindcss-language-server"]
    },
  },
  "lsp": {
    "tailwindcss-language-server": {
      "settings": {
        "includeLanguages": {
          "scala": "html"
        },
        "experimental": {
          "classRegex": ["[cls|className]\\s\\:\\=\\s\"([^\"]*)"]
        }
      }
    }
  }
}
```

Release Notes:

- Added ability to configure settings for `tailwindcss-language-server`,
namely the `includeLanguages` and `experimental` objects.

**NOTE**: I have only tested that the language server boots up for Scala
files and that the settings are forwarded correctly. I don't have a
Scala+Tailwind project with which to test that the actual completions
also work.

cc @nguyenyou
2024-05-15 15:15:36 +02:00
Piotr Osiewicz
266643440c
rust: reduce false positives in runnables query (#11845)
We were marking `#[cfg(test)]`ed function as a test, which is wrong.
Also allow for other attribute_items (such as #[should_panic]) between
test attribute and a function item.

Release Notes:

- N/A
2024-05-15 11:42:05 +02:00
Piotr Osiewicz
95e0d5ed74
tasks: Reorganize task modal (#11752)
![image](https://github.com/zed-industries/zed/assets/24362066/bc7cc3d3-d9fc-4be6-b9b6-e3d8edf5b533)

Release Notes:
- Improved tasks modal by highlighting a distinction between a task
template and concrete task instance and surfacing available keybindings
more prominently. Task templates are now always available in the modal,
even if there's already a history entry with the same label.
- Changed default key binding for "picker::UseSelectedQuery" to `opt-e`.
2024-05-14 11:22:09 +02:00
Piotr Osiewicz
fa04f7514e
chore: Improve dev build startup time (#11692)
RustEmbed repeatedly compiled regexes for handling of
'include='/'exclude' statements in a hot loop, which caused each call to
Assets::iter() to take 600ms. Since it is being called twice on our
startup path, that alone contributed over a second to startup time in
debug builds. I've filed a PR with them
https://github.com/pyrossh/rust-embed/pull/244 which brings down the
time for a single iter() call to 6ms.

Release Notes:

- N/A
2024-05-11 10:10:13 +02:00
Conrad Irwin
5515ba6043
Extract http from util (#11680)
This avoids the CLI linking libssl etc...

Release Notes:

- N/A
2024-05-10 15:50:20 -06:00
Marshall Bowers
fc584017d1
ruby: Add embedded_template grammar (#11677)
This PR adds the `embedded_template` grammar to the Ruby extension, as
we need it present for ERB.

Release Notes:

- N/A
2024-05-10 16:08:46 -04:00
Marshall Bowers
19994fc190
ruby: Move injections to extension (#11664)
This PR moves the Ruby injections added in #8796 to the right location,
since Ruby support was extracted into an extension in #11360.

Release Notes:

- N/A
2024-05-10 12:06:15 -04:00
Ulysse Buonomo
4f256c7577
Add Ruby language injections (#8796)
This adds support for Ruby heredoc's syntax highlighting. The injection
was directly taken from the tree-sitter
[documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection).

It is quite simple, but has the drawback of only showing highlighting
once the heredoc is fully written and next line is started. This is due
to the fact that we use the last line of the heredoc to determine the
language. As using the first one would require some cleaning up that we
cannot do trivially. (I might have not fully understood the behaviour of
the `#match?` predicate, which could help us)

Fixes #4473



Release Notes:

- Added Ruby language injections
([#4473](https://github.com/zed-industries/zed/issues/4473)).

<img width="359" alt="image"
src="https://github.com/zed-industries/zed/assets/11378424/5115b875-a32d-4f28-b21f-471495169266">
2024-05-10 09:00:51 -07:00
Vitaly Slobodin
400e938997
Extract Ruby extension (#11360)
This PR extracts Ruby and ERB support into an extension and removes the
built-in Ruby and Ruby support from Zed.

As part of this, the new extension is prepared for adding support for
the `Ruby LSP` which has some blockers. See
https://github.com/zed-industries/zed/pull/8613 I was thinking of adding
an initial support for Ruby LSP but I think it would be better to start
with extracting the Ruby extension for now.

The implementation, as the 1st step, matches the bundled version but
with 3 differences:

1. Added signature output to the completion popup. See my comment below.
![CleanShot 2024-05-04 at 09 17
37@2x](https://github.com/zed-industries/zed/assets/1894248/486b7a48-ea0c-44ce-b0c9-9f8f5d3ad42d)

3. Use the shell environment for starting the `solargraph` executable.
See my comment below.
4. Bumped the tree sitter version for Ruby to the latest available
version.

Additionally, I plan to tweak this extension a bit in the future but I
think we should do this bit by bit. Thanks!

Release Notes:

- Removed built-in support for Ruby, in favor of making it available as
an extension.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-05-10 11:53:11 -04:00
Piotr Osiewicz
bff1d8b142
task: Allow obtaining custom task variables from tree-sitter queries (#11624)
From now on, only top-level captures are treated as runnable tags and
the rest is appended to task context as custom environmental variables
(unless the name is prefixed with _, in which case the capture is
ignored). This is most likely gonna help with Pest-like test runners.



Release Notes:

- N/A

---------

Co-authored-by: Remco <djsmits12@gmail.com>
2024-05-09 23:38:18 +02:00
d1y
9d681bda8d
go: support highlight regexp (#11538)
Before:
<img width="521" alt="image"
src="https://github.com/zed-industries/zed/assets/45585937/7b87e552-0cf0-4168-933f-21d1ae84bf64">

After:
<img width="499" alt="image"
src="https://github.com/zed-industries/zed/assets/45585937/f1171375-8c22-4186-a5f1-1bdfa56cf01f">

Release Notes:

- Added go regexp highlighting
2024-05-08 12:52:56 +02:00
Piotr Osiewicz
0c11d841e8
editor: Move runnables querying to background thread (#11487)
Originally reported by @mrnugget and @bennetbo 
Also, instead of requerying them every frame, we do so whenever buffer
changes.

As a bonus, I modified tree-sitter query for Rust tests.

Release Notes:

- N/A
2024-05-07 15:31:07 +02:00
Adam
d0c95c2f43
Add Svelte to list of ESLint languages (#11437)
Release Notes:

- Added ESLint as a default language server for Svelte.
2024-05-06 11:38:55 -04:00
José Olórtegui
6e2be283dd
emmet: Support more languages (#10779)
Hey guys! `emmet-language-server` author here. Thank you so much for the
amazing editor!

This PR adds more languages to the list for the `emmet-language-server`
to attach to.

I have a question though, I saw that you guys don't differentiate yet
between `JavaScript` and `JSX` files. I know that the tree-sitter parser
for `js` comes with the ability to parse both but we still need to make
that difference. Is that part of the plan? or do you have a reason for
doing that?

Aside from that, I've still added support for `JavaScript` files since
is important to have emmet completions in `JSX` files, but I would like
to know what are your thoughts on that since doing this may pollute the
completions in `.js` files.

And one last thing, the emmet language server accepts more filetypes
such as `pug`, `sass`, `scss` and `less` files, which are not currently
supported by zed. Should I create some extensions to add grammar support
to those files later? Should those extensions be part of the zed repo?
I'm just thinking that those are sort of core languages.

Aside from that, let me know if there's anything left to do on my side.
Greetings!

Fixes #10654.

Release Notes:

- N/A
2024-05-06 12:09:19 +02:00
Piotr Osiewicz
5a71d8c7f1
Add support for detecting tests in source files, and implement it for Rust (#11195)
Continuing work from #10873 

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-05-05 16:32:48 +02:00
José Olórtegui
f987ff05fd
Improve JSDoc injection in comments (#10800)
This PR improves JSDoc injection for syntax highlighting. Now we are
only injecting JSDoc in block comments. The regex was mostly adapted
from nvim-treesitter's implementation (lua) to a rust regex.


eb93c3b2fb/queries/ecma/injections.scm (L1-L6)

**Before:**
<img width="441" alt="Screenshot 2024-04-20 at 5 51 04 AM"
src="https://github.com/zed-industries/zed/assets/20072509/8e77851d-22ad-4dc4-8e10-9ac558d3cf40">

**After:**
<img width="441" alt="Screenshot 2024-04-20 at 5 52 05 AM"
src="https://github.com/zed-industries/zed/assets/20072509/a607c219-6973-40c3-958c-44a003d008c3">

Release Notes:

- Changed detection of JSDoc to only do syntax highlighting in block
comments. Improved previous work done in #7826.
2024-05-03 11:43:10 +02:00
adorabilis
2306e3cd50
Add brackets and missing operators to Python grammar (#11180)
Release Notes:

- Fixed #4341 

Before:

![before](https://github.com/zed-industries/zed/assets/16101408/34672e47-5131-481a-803e-064db8126cc9)

After:

![after](https://github.com/zed-industries/zed/assets/16101408/7d2405c6-d04f-4738-ad2e-a9424b1c9d19)
2024-05-03 11:37:44 +02:00
Thorsten Ball
c81230405f
typescript: Complete function calls with snippets (#11157)
This allows function call (i.e. snippet) completion with
`typescript-language-server`. So far that didn't work, because
`typescript-language-server` doesn't respond with `insertText` when
getting the completions, but only when then sending
`completionItem/resolve` requests. See:
https://github.com/hrsh7th/nvim-cmp/issues/646#issuecomment-992765479

What this PR does is to support text edits in the response to
`completionItem/resolve`, which means updating the completion item.

It then enables this feature by default for
`typescript-language-server`.


TODOs:

- [x] Make this work over collab
- [x] Test that this doesn't break existing language server support
- [x] Refactor duplicated code

Release Notes:

- Added support for function call completion when using
`typescript-language-server`. This will result in parameters being
added, which can then be changed and navigated with `<tab>`. For this to
work with `typescript-language-server`, the documentation for a given
completion item needs to be resolved, meaning that if one types very
quickly and accepts completion before `typescript-language-server` could
respond with the documentation, no full function completion is used.

Demo:


https://github.com/zed-industries/zed/assets/1185253/c23ebe12-5902-4b50-888c-d9b8cd32965d
2024-05-02 10:50:01 +02:00
Marshall Bowers
9ff847753e
Register ESLint as an available language server (#11178)
This PR adds the ability for the ESLint language server (`eslint`) to be
controlled by the `language_servers` setting.

Now in your settings you can indicate that the ESLint language server
should be used for a given language, even if that language does not have
the ESLint language server registered for it already:

```json
{
  "languages": {
    "My Language": {
      "language_servers": ["eslint", "..."]
    }
  }
}
```

Release Notes:

- N/A
2024-04-29 13:18:30 -04:00
William Villeneuve
ca187c8386
Allow users to configure ESLint's rulesCustomizations settings (#11135)
https://github.com/zed-industries/zed/assets/2072378/18f0bb28-0546-4234-a11f-39af6c9fcc12

`rulesCustomizations` is an array of rule severity overrides. Globs can
be used to apply default severities for multiple rules. See
[docs](553e632fb4/README.md (L312-L333))
& [type
definitions](553e632fb4/%24shared/settings.ts (L168))

Example Zed `settings.json` to override all eslint errors to warnings:
```jsonc
{
    "lsp": {
        "eslint": {
            "settings": {
                "rulesCustomizations": [
                    // set all eslint errors/warnings to show as warnings
                    { "rule": "*", "severity": "warn" }
                ]
            }
        }
    }
}
```


Release Notes:

- Added support for configuring ESLint's `rulesCustomizations` settings,
ie. `{"lsp": {"eslint": {"settings": {"rulesCustomizations": [{"rule":
"*", "severity": "warn"}]}}}}`
2024-04-29 11:41:48 +03:00
d1y
f72cf2afe3
Highlight reference types directive in TypeScript (#11039)
Before:

<img width="443" alt="image"
src="https://github.com/zed-industries/zed/assets/45585937/a8037edb-ed5b-4b12-92b4-2d409442ad4b">


After:

<img width="429" alt="image"
src="https://github.com/zed-industries/zed/assets/45585937/1fd66523-d667-4041-952f-c1125e7feab9">


Release Notes:

- Add typescript reference types directive highlighted(#11001)
2024-04-29 11:38:53 +03:00
Marshall Bowers
3eac581a62
Allow controlling Tailwind via the language_servers setting (#11012)
This PR adds the ability for the Tailwind language server
(`tailwindcss-language-server`) to be controlled by the
`language_servers` setting.

Now in your settings you can indicate that the Tailwind language server
should be used for a given language, even if that language does not have
the Tailwind language server registered for it already:

```json
{
  "languages": {
    "My Language": {
      "language_servers": ["tailwindcss-language-server", "..."]
    }
  }
}
```

Release Notes:

- N/A
2024-04-25 17:29:47 -04:00
Marshall Bowers
7005f0b424
Remove outdated instructions for adding languages (#11005)
This PR removes the outdated comment regarding adding languages to Zed.

New languages should be added as extensions.

Release Notes:

- N/A
2024-04-25 14:30:31 -04:00
James Thurley
d3f6ca7a1e
Add @operator, @lifetime and @punctuation.delimiters captures for Rust (#10885)
Adds additional captures for theming rust code.

I'm uncertain about whether `#` belongs in the `@operator` capture, but
I didn't see a more appropriate capture name in my brief hunt in other
files. It is the prefix of an `attribute_item`.. suggestions welcome.

Release Notes:

- Added `@operator`, `@lifetime` and `@punctuation.delimiter` captures
to Rust highlights file.
2024-04-25 14:20:20 -04:00
Marshall Bowers
544bd490ac
Extract Elixir extension (#10948)
This PR extracts Elixir support into an extension and removes the
built-in Elixir support from Zed.

As part of this, [Lexical](https://github.com/lexical-lsp/lexical) has
been added as an available language server for Elixir.

Since the Elixir extension provides three different language servers,
you'll need to use the `language_servers` setting to select the one you
want to use:

#### Elixir LS

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "elixir-ls", "!next-ls", "!lexical", "..."]
    }
  }
}
```

#### Next LS

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "next-ls", "!elixir-ls", "!lexical", "..."]
    }
  }
}
```

#### Lexical

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "lexical", "!elixir-ls", "!next-ls", "..."]
    }
  }
}
```

These can either go in your user settings or your project settings.

Release Notes:

- Removed built-in support for Elixir, in favor of making it available
as an extension.
2024-04-25 13:59:14 -04:00
Jakob Hellermann
1cd34fdd9c
Recognize PKGBUILD as bash script (#10946)
[PKGBUILD] is a file used in the build system of arch linux, and it is
basically just a bash script with special functions.


Release Notes:

- Changed `PKGBUILD` files to be recognized as bash.
2024-04-25 09:44:52 -04:00
Thorsten Ball
019821d62c
eslint: register as language server for Vue.js (#10983)
This fixes #9934 and does two things:

1. It registers ESLint as a secondary language server for Vue.js files
(`.vue`)
2. It registers ESLint as a _secondary_ (instead of primary) language
server for TypeScript, JavaScript and TSX.

The second point because I don't see any reason why ESLint should be
registered as a primary language server for these languages. I read
through the code in `project.rs` that uses the primary language server
and I don't think there will be any differences to how it previously
worked.

I also manually tested ESLint support in a Vue.js project, a Next.js
project and a plain old JS project — still works in all three.

Release Notes:

- Added ESLint support for Vue.js files by starting it as a language
server on `.vue` files.
([#9934](https://github.com/zed-industries/zed/issues/9934)).
2024-04-25 14:49:07 +02:00
Kirill Bulatov
6108140a02
Properly extract package name out of cargo pkgid (#10929)
Fixes https://github.com/zed-industries/zed/issues/10925

Uses correct package name to generate Rust `cargo` tasks.
Also deduplicates lines in task modal item tooltips.

Release Notes:

- Fixed Rust tasks using incorrect package name
([10925](https://github.com/zed-industries/zed/issues/10925))
2024-04-24 14:12:59 +03:00
Marshall Bowers
25981550d5
Extract Deno extension (#10912)
This PR extracts Deno support into an extension and removes the built-in
Deno support from Zed.

When using the Deno extension, you'll want to add the following to your
settings to disable the built-in TypeScript and ESLint language servers
so that they don't conflict with Deno's functionality:

```json
{
  "languages": {
    "TypeScript": {
      "language_servers": ["deno", "!typescript-language-server", "!eslint", "..."]
    },
    "TSX": {
      "language_servers": ["deno", "!typescript-language-server", "!eslint", "..."]
    }
  }
}

```

Release Notes:

- Removed built-in support for Deno, in favor of making it available as
an extension.
2024-04-23 20:44:11 -04:00
Joseph T. Lyons
f6eaa8b00f
Clean up whitespace (#10755)
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
2024-04-23 13:31:21 -04:00
Ben Hamment
c96a96b3ce
Add traits in Rust highlights (#10731)
Question: I use type.super here because I made a similar change to the
ruby syntax to apply the same style to superclasses.
With this in mind, should this change be renamed to type.trait or should
it be renamed to something like type.italic so the ruby syntax or any
other language can all use type.italic? or maybe something else
altogether.

<img width="597" alt="image"
src="https://github.com/zed-industries/zed/assets/7274458/9d02dba0-75a4-4439-9f31-fd8aa0873075">

Release Notes:

- Exposed Rust traits as `type.interface` for individual syntax theming.
2024-04-22 16:43:48 -04:00
Thorsten Ball
a0fa8a489b
ruby: Check if solargraph exists in $PATH or is configured (#10835)
This fixes #9811 by checking for the `solargraph` binary in the `$PATH`
as it's setup in the project shell.

It also adds support for configuring the path to `solargraph` manually:

```json
{
  "lsp": {
    "solargraph": {
      "binary": {
        "path": "/Users/thorstenball/bin/solargraph",
        "arguments": ["stdio"]
      }
    }
  }
}
```

## Example

Given the following setup:

- `ruby@3.3.0` used globally, no `solargraph` installed globally
- `ruby@3.2.2` used in a project, `solargraph` installed as binstub in
`$project/bin/solargraph`, `.envrc` to configure `direnv` to add
`$project/bin` to `$PATH

Which looks like this in practice:

```shell
# GLOBAL
~ $ ruby --version
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
~ $ which solargraph
solargraph not found

# IN PROJECT
~ $ cd work/projs/rails-proj
direnv: loading ~/work/projs/rails-proj/.envrc
direnv: export ~PATH
~/work/projs/rails-proj $ ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
~/work/projs/rails-proj $ which solargraph
/Users/thorstenball/work/projs/rails-proj/bin/solargraph
```

The expectation is that Zed, when opening `~/work/projs/rails-proj`,
picks up the local `solargraph`.

But with **Zed Stable** that doesn't work, as we can see in the logs:

```
2024-04-22T10:21:37+02:00 [INFO] starting language server. binary path: "solargraph", working directory: "/Users/thorstenball/work/projs/rails-proj", args: ["stdio"]
2024-04-22T10:21:37+02:00 [ERROR] failed to start language server "solargraph": No such file or directory (os error 2)
```

With the change in this PR, it uses `rails/proj/bin/solargraph`:

```
[2024-04-22T10:33:06+02:00 INFO  language] found user-installed language server for Ruby. path: "/Users/thorstenball/work/projs/rails-proj/bin/solargraph", arguments: ["stdio"]
[2024-04-22T10:33:06+02:00 INFO  lsp] starting language server. binary path: "/Users/thorstenball/work/projs/rails-proj/bin/solargraph", working directory: "/Users/thorstenball/work/projs/rails-proj", args: ["stdio"]
```

**NOTE**: depending on whether `mise` (or `rbenv`, `asdf`, `chruby`,
...) or `direnv` come first in the shell-rc file, it picks one or the
other, depending on what puts itself first in `$PATH`.

## Release Notes

Release Notes:

- Added support for finding the Ruby language server `solargraph` in the
user's `$PATH` as it is when `cd`ing into a project's directory.
([#9811](https://github.com/zed-industries/zed/issues/9811))
- Added support for configuring the `path` and `arguments` for
`solargraph` language server manually. Example from settings: `{"lsp":
{"solargraph": {"binary":
{"path":"/Users/thorstenball/bin/solargraph","arguments": ["stdio"]}}}}`
([#9811](https://github.com/zed-industries/zed/issues/9811))
2024-04-22 10:44:05 +02:00
Kirill Bulatov
13c17267b9
Properly pass nested script arguments for tasks (#10776)
Closes
https://github.com/zed-industries/zed/discussions/10732#discussion-6524347
introduced by https://github.com/zed-industries/zed/pull/10548 while
keeping both Python and Bash run selection capabilities.

Also replaced redundant `SpawnTask` struct with `SpawnInTerminal` that
has identical fields.

Release Notes:

- Fixed incorrect task escaping of nested script arguments

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
2024-04-19 16:24:35 +03:00
Kirill Bulatov
222034cacf
Always provide default task context (#10764)
Based on
https://github.com/zed-industries/zed/issues/8324?notification_referrer_id=NT_kwDOACkO1bI5NTk0NjM0NzkyOjI2OTA3NzM&notifications_query=repo%3Azed-industries%2Fzed+is%3Aunread#issuecomment-2065551553

Release Notes:

- Fixed certain files' task modal not showing context-based tasks
2024-04-19 10:51:50 +03:00
Henrique Ferreiro
c1c8a74c7f
Add ability to specify binary path/args for clangd (#10608)
This uses the language server settings added in #9293 to allow users to
specify the binary path and arguments with which to start up `clangd`.

Example user settings for `clangd`:

```json
{
  "lsp": {
    "clangd": {
      "binary": {
        "path": "/usr/bin/clangd",
        "arguments": ["--log=verbose"]
      },
    }
  }
}
```

Constraints:

* Right now this only allows ABSOLUTE paths.

Release Notes:

- Added ability to specify `clangd` binary `path` (must be absolute) and
`arguments` in user settings. Example: `{"lsp": {"clangd": {"binary":
{"path": "/usr/bin/clangd", "arguments": ["--log=verbose"] }}}}`
2024-04-16 18:17:15 +02:00
Max Brunsfeld
015e2ecd19
Remove built-in Nu support in favor of extension (#10570)
Release Notes:

- Removed built-in Nu language support in favor of an extension.

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-15 10:47:01 -07:00
Kirill Bulatov
db48c75231
Add basic bash and Python tasks (#10548)
Part of https://github.com/zed-industries/zed/issues/5141

* adds "run selection" and "run file" tasks for bash and Python.
* replaces newlines with `\n` symbols in the human-readable task labels
* properly escapes task command arguments when spawning the task in
terminal

Caveats:

* bash tasks will always use user's default shell to spawn the
selections, but they should rather respect the shebang line even if it's
not selected
* Python tasks will always use `python3` to spawn its tasks now, as
there's no proper mechanism in Zed to deal with different Python
executables

Release Notes:

- Added tasks for bash and Python to execute selections and open files
in terminal
2024-04-15 16:07:21 +03:00
Kirill Bulatov
573ba83034
Merge Zed task context providing logic (#10544)
Before, `tasks_ui` set most of the context with `SymbolContextProvider`
providing the symbol data part of the context. Now, there's a
`BasicContextProvider` that forms all standard Zed context and it
automatically serves as a base, with no need for other providers like
`RustContextProvider` to call it as before.

Also, stop adding `SelectedText` task variable into the context for
blank text selection.

Release Notes:

- N/A
2024-04-15 11:52:15 +03:00
Marshall Bowers
f3a78f613a
Extract Vue extension (#10486)
This PR extracts Vue support into an extension and removes the built-in
C# support from Zed.

Release Notes:

- Removed built-in support for Vue, in favor of making it available as
an extension. The Vue extension will be suggested for download when you
open a `.vue` file.

---------

Co-authored-by: Max <max@zed.dev>
2024-04-12 14:39:27 -04:00
Marshall Bowers
b5b872656b
Extract Terraform extension (#10479)
This PR extracts Terraform support into an extension and removes the
built-in Terraform support from Zed.

Release Notes:

- Removed built-in support for Terraform, in favor of making it
available as
an extension. The Terraform extension will be suggested for download
when you
open a `.tf`, `.tfvars`, or `.hcl` file.
2024-04-12 11:49:49 -04:00
Max Brunsfeld
8d7f5eab79
Extract Ocaml language support into an extension (#10450)
Release Notes:

- Extracted Ocaml language support into an extension

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-11 15:20:19 -07:00
Max Brunsfeld
253aa28375
Extract Scheme and Racket language support into extensions (#10442)
Release Notes:

- Extracted Scheme and Racket language support into extensions.

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-11 12:45:46 -07:00
Max Brunsfeld
0ac31302d3
Remove built-in Nix support (#10439)
Release Notes:

- Removed built-in Nix support, now that there is a Nix extension.

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-11 11:44:08 -07:00
Max Brunsfeld
176f440158
Extract lua language support into an extension (#10437)
Release Notes:

- Extracted lua language support into an extension, and improved Lua
highlighting and completion label styling.

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-11 11:32:10 -07:00
Max Brunsfeld
c38f72d194
Extract GLSL language support into an extension (#10433)
Release Notes:

- Extracted GLSL language support into an extension.

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-11 13:52:10 -04:00
Max Brunsfeld
bcd2ca6196
Extract Elm language into an extension (#10432)
Release Notes:

- Extracted Elm language support into an extension

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-11 10:23:49 -07:00
Kirill Bulatov
d1ad96782c
Rework task modal (#10341)
New list (used tasks are above the separator line, sorted by the usage
recency), then all language tasks, then project-local and global tasks
are listed.
Note that there are two test tasks (for `test_name_1` and `test_name_2`
functions) that are created from the same task template:
<img width="563" alt="Screenshot 2024-04-10 at 01 00 46"
src="https://github.com/zed-industries/zed/assets/2690773/7455a82f-2af2-47bf-99bd-d9c5a36e64ab">

Tasks are deduplicated by labels, with the used tasks left in case of
the conflict with the new tasks from the template:
<img width="555" alt="Screenshot 2024-04-10 at 01 01 06"
src="https://github.com/zed-industries/zed/assets/2690773/8f5a249e-abec-46ef-a991-08c6d0348648">

Regular recent tasks can be now removed too:
<img width="565" alt="Screenshot 2024-04-10 at 01 00 55"
src="https://github.com/zed-industries/zed/assets/2690773/0976b8fe-b5d7-4d2a-953d-1d8b1f216192">

When the caret is in the place where no function symbol could be
retrieved, no cargo tests for function are listed in tasks:
<img width="556" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/df30feba-fe27-4645-8be9-02afc70f02da">


Part of https://github.com/zed-industries/zed/issues/10132
Reworks the task code to simplify it and enable proper task labels.

* removes `trait Task`, renames `Definition` into `TaskTemplate` and use
that instead of `Arc<dyn Task>` everywhere
* implement more generic `TaskId` generation that depends on the
`TaskContext` and `TaskTemplate`
* remove `TaskId` out of the template and only create it after
"resolving" the template into the `ResolvedTask`: this way, task
templates, task state (`TaskContext`) and task "result" (resolved state)
are clearly separated and are not mixed
* implement the logic for filtering out non-related language tasks and
tasks that have non-resolved Zed task variables
* rework Zed template-vs-resolved-task display in modal: now all reruns
and recently used tasks are resolved tasks with "fixed" context (unless
configured otherwise in the task json) that are always shown, and Zed
can add on top tasks with different context that are derived from the
same template as the used, resolved tasks
* sort the tasks list better, showing more specific and least recently
used tasks higher
* shows a separator between used and unused tasks, allow removing the
used tasks same as the oneshot ones
* remote the Oneshot task source as redundant: all oneshot tasks are now
stored in the inventory's history
* when reusing the tasks as query in the modal, paste the expanded task
label now, show trimmed resolved label in the modal
* adjusts Rust and Elixir task labels to be more descriptive and closer
to bash scripts

Release Notes:

- Improved task modal ordering, run and deletion capabilities
2024-04-11 02:02:04 +03:00
Nathan Sobo
7abb63cfda
Improve the ergonomics of creating local buffers (#10347)
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>
2024-04-10 08:32:51 -06:00
Max Brunsfeld
a0ee29a806
Use first line comment prefix when toggling comments (#10335)
This fixed an issue introduced in
https://github.com/zed-industries/zed/pull/10126, where, when toggling
comments in a language with multiple line comment prefixes (e.g. Gleam,
Erlang) Zed would insert the *last* prefix instead of the first.

Release Notes:

- Fixed an issue where the `toggle comments` command inserted the wrong
line comment prefix in some languages (preview only).

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-09 17:22:47 -04:00
Kirill Bulatov
0331fdebd3
Parse human readable module name for Rust tasks (#10337)
Part of https://github.com/zed-industries/zed/issues/10132 extracted out
of a bigger PR that refactors tasks and shows labels that look more like
commands (ergo needs better readable package names)

Release Notes:

- N/A
2024-04-10 00:18:09 +03:00
Marshall Bowers
7c5bc3c26f
Add the ability for extensions to provide language settings (#10296)
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>
2024-04-08 19:17:12 -04:00
Kirill Bulatov
4a3032c5e5
Append -- --nocapture to Rust function-level tests (#10299)
Release Notes:

- N/A
2024-04-09 01:36:24 +03:00
Ben Hamment
ce5bc399df
Improve Ruby Syntax (#10255)
Release Notes:

fixes #9995  being able to target constants
<img width="336" alt="image"
src="https://github.com/zed-industries/zed/assets/7274458/9e8cc438-10c4-441f-9140-3f4b418bd3bd">

Adds highlighting for parameters In blocks
<img width="318" alt="image"
src="https://github.com/zed-industries/zed/assets/7274458/4fa45fbe-104b-4778-994b-3b6d6ba930d4">
2024-04-08 13:12:24 +02:00
Marshall Bowers
c851e6edba
Add language_server_workspace_configuration to extension API (#10212)
This PR adds the ability for extensions to implement
`language_server_workspace_configuration` to provide workspace
configuration to the language server.

We've used the Dart extension as a motivating example for this, pulling
it out into an extension in the process.

Release Notes:

- Removed built-in support for Dart, in favor of making it available as
an extension. The Dart extension will be suggested for download when you
open a `.dart` file.

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-04-05 17:04:07 -04:00