# HTTP Client Improvements for Extension API
This PR enhances the HTTP client functionality in the Zed extension API,
providing more control over requests and allowing for streaming
responses.
## Key Changes
1. Extended `HttpRequest` struct:
- Added `method` field to specify HTTP method
- Added `headers` field for custom headers
- Added optional `body` field for request payload
2. Introduced `HttpMethod` enum for supported HTTP methods
3. Updated `HttpResponse` struct:
- Added `headers` field to access response headers
- Changed `body` type from `String` to `Vec<u8>` for binary data support
4. Added streaming support:
- New `fetch_stream` function to get a response stream
- Introduced `HttpResponseStream` resource for chunked reading
5. Updated internal implementations to support these new features
6. Modified the Gleam extension to use the new API structure
## Motivation
These changes provide extension developers with more flexibility and
control over HTTP requests. The streaming support is particularly useful
for handling large responses efficiently or ideally streaming into the
UI.
## Testing
- [x] Updated existing tests
- [ ] Added new tests for streaming functionality
## Next Steps
- Consider adding more comprehensive examples in the documentation
- Evaluate performance impact of streaming for large responses
Please review and let me know if any adjustments are needed.
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR refactors the language server loading in the Ruff extension to
mirror our other extensions.
Also fixed an issue where the cached binary path was not being
respected.
Release Notes:
- N/A
Hello, this pull request adds support for specifying and using the
"binary" settings for Rubocop and Solargraph LSPs. AFAIK, Ruby LSP does
not require the bundler context but that could be added later easily.
In Ruby world, like in Node.js world, almost all
projects rely on project specific packages (gems) and their versions.
Solargraph and Rubocop gems are usually installed as project
dependencies. Attempting to use global installation of them fail in most
cases due to incompatible or missing dependencies (gems).
To avoid that, Ruby engineers have the `bundler`
gem that provides the `exec` command. This command executes the given
command in the context of the bundle.
This pull request adds support for pulling the `binary` settings to use
them in starting both LSPs. For instance, to start the Solargraph gem in
the context of the bundler, the end user must configure the binary
settings in the folder-specific settings file like so:
```json
{
"lsp": {
"solargraph": {
"binary": {
"path": "/Users/vslobodin/Development/festivatica/bin/rubocop"
}
}
}
}
```
The `path` key must be an absolute path to the `binstub` of the
`solargraph` gem. The same applies to the "rubocop" gem. Side note but
it would be awesome to use Zed specific environment variables to make
this a bit easier. For instance, we could use the `ZED_WORKTREE_ROOT`
environment variable:
```json
{
"lsp": {
"solargraph": {
"binary": {
"path": "${ZED_WORKTREE_ROOT}/bin/rubocop"
}
}
}
}
```
But this is out of the scope of this pull request. The code is a bit
messy and repeatable in some places, I am happy to improve it here or
later.
References:
- https://bundler.io/v2.4/man/bundle-exec.1.html
- https://solargraph.org/guides/troubleshooting
- https://bundler.io/v2.5/man/bundle-binstubs.1.html
This pull request is based on these two pull requests:
- https://github.com/zed-industries/zed/pull/14655
- https://github.com/zed-industries/zed/issues/15001
Closes https://github.com/zed-industries/zed/issues/5109.
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Hi, this pull request adds support for RBS files for the Ruby language.
[RBS](https://github.com/ruby/rbs) is a language to describe the
structure of Ruby programs.
This pull request:
- adds a new grammar to the Ruby extension for RBS
https://github.com/joker1007/tree-sitter-rbs
- configures the Ruby extension to use the added grammar.
Release Notes:
- N/A
This PR updates the extension API to make the `worktree` argument to
`run_slash_command` optional.
We may not always have a worktree, and not all slash commands need them,
so by making it optional we can allow individual slash commands to
decide what to do when there is no worktree.
Release Notes:
- N/A
Hi. This is a small pull request that changes the "language" field to
the "languages" field
because the `language` field is deprecated.
Additionally, allow the Ruby LSP to run in `*.erb` files.
Release Notes:
- N/A
Release Notes:
- N/A
Currently Windows environments do not have a `shell_env`. This causes
the Zig extension to error when trying to call `worktree.shell_env()`
since extensions api isn't yet on `0.0.7` and thus not using wasm-host
`0.0.7` we need to only call for the shell env only on non-windows
systems. 0.0.7 and onward at the moment return a Result from
`shell_env()`. The binary path is also slightly different on windows.
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
The current Astro Extension fails to load properly if it can't find a
`tsserver.js` file in the current workspaces' `node_modules` folder.
This happens pretty frequently, either if `typescript` is not installed
in the project (which it isn't by default), or if `node_modules` is not
in the workspace root.
This PR adds a fallback method of installing `typescript` alongside the
extensions' language server if it is not found in the workspaces'
`node_modules`, as well as correctly setting the `tsdk` path in the
initialization options.
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR updates the Erlang extension with support for installing the
[Erlang Language
Platform](https://github.com/WhatsApp/erlang-language-platform) (`elp`)
language server from the GitHub Release assets.
Release Notes:
- N/A
Added support for the [Erlang Language
Platform](https://whatsapp.github.io/erlang-language-platform/) language
server to the Erlang extension.
Release Notes:
- N/A
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR fixes an issue in the Lexical language server installation where
the `start_lexical.sh` script was not being made executable when
installed from GitHub.
Release Notes:
- N/A
This PR updates the PHP extension with support for reading LSP settings
when using Intelephense as the language server.
Addresses #4258.
Release Notes:
- N/A
This PR updates the Vue extension with support for installing and using
its own copy of TypeScript if it can't find one in the project.
The way we resolve `typescript` is as follows:
- We check the project's `package.json` for `typescript` in either the
`devDependencies` or `dependencies`
- If found, we set the `typescript.tsdk` to
`node_modules/typescript/lib` to use the project's copy of TypeScript
- If not found, we install the latest version of `typescript` (if not
already downloaded) to the extension's `package.json` and use that
version for `typescript.tsdk`
This should resolve instances where Vue projects that do not have an
explicit `typescript` dependency—such as those using Vue with plain
JavaScript—fail to load the language server due to TypeScript not being
found.
Release Notes:
- N/A
Hi, this pull request adds support for `rubocop` language server. I
noticed that `ruby-lsp` LS is becoming more popular but it still lacks
diagnostics support in Zed. To cover that missing feature, it could be
good to use `rubocop` LS to show diagnostics alongside with the running
Ruby LSP.
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR reverts the changes to the Zig extension dependent on the new
`zed_extension_api` version so that we can publish the Zig extension.
Release Notes:
- N/A