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
This commit is contained in:
Thorsten Ball 2024-05-22 07:18:49 +02:00 committed by GitHub
parent e5b9e2044e
commit 8168ec2a28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 104 additions and 3 deletions

View file

@ -8,7 +8,10 @@ use smol::stream::StreamExt;
use std::{str, sync::Arc};
use util::{asset_str, ResultExt};
use crate::{bash::bash_task_context, python::python_task_context, rust::RustContextProvider};
use crate::{
bash::bash_task_context, go::GoContextProvider, python::python_task_context,
rust::RustContextProvider,
};
mod bash;
mod c;
@ -103,7 +106,7 @@ pub fn init(
"css",
vec![Arc::new(css::CssLspAdapter::new(node_runtime.clone())),]
);
language!("go", vec![Arc::new(go::GoLspAdapter)]);
language!("go", vec![Arc::new(go::GoLspAdapter)], GoContextProvider);
language!("gomod");
language!("gowork");
language!(