Add initial package.json
scripts task autodetection (#32497)
Now, every JS/TS-related file will get their package.json script contents added as tasks: <img width="1020" alt="image" src="https://github.com/user-attachments/assets/5bf80f80-fd72-4ba8-8ccf-418872895a25" /> To achieve that, `fn associated_tasks` from the `ContextProvider` was made asynchronous and the related code adjusted. Release Notes: - Added initial `package.json` scripts task autodetection --------- Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
This commit is contained in:
parent
0c0933d1c0
commit
9c513223c4
15 changed files with 782 additions and 661 deletions
|
@ -8,6 +8,7 @@ use http_client::github::AssetKind;
|
|||
use http_client::github::{GitHubLspBinaryVersion, latest_github_release};
|
||||
pub use language::*;
|
||||
use lsp::{InitializeParams, LanguageServerBinary};
|
||||
use project::Fs;
|
||||
use project::lsp_store::rust_analyzer_ext::CARGO_DIAGNOSTICS_SOURCE_NAME;
|
||||
use project::project_settings::ProjectSettings;
|
||||
use regex::Regex;
|
||||
|
@ -628,9 +629,10 @@ impl ContextProvider for RustContextProvider {
|
|||
|
||||
fn associated_tasks(
|
||||
&self,
|
||||
_: Arc<dyn Fs>,
|
||||
file: Option<Arc<dyn language::File>>,
|
||||
cx: &App,
|
||||
) -> Option<TaskTemplates> {
|
||||
) -> Task<Option<TaskTemplates>> {
|
||||
const DEFAULT_RUN_NAME_STR: &str = "RUST_DEFAULT_PACKAGE_RUN";
|
||||
const CUSTOM_TARGET_DIR: &str = "RUST_TARGET_DIR";
|
||||
|
||||
|
@ -798,7 +800,7 @@ impl ContextProvider for RustContextProvider {
|
|||
.collect();
|
||||
}
|
||||
|
||||
Some(TaskTemplates(task_templates))
|
||||
Task::ready(Some(TaskTemplates(task_templates)))
|
||||
}
|
||||
|
||||
fn lsp_task_source(&self) -> Option<LanguageServerName> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue