mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 08:32:27 +03:00
typescript: Add completions for tsconfig.json properties (#12560)
Release Notes: - Added completions for tsconfig.json config file.
This commit is contained in:
parent
29b5253a1d
commit
fbcc5ccdb9
@ -15,6 +15,7 @@ use std::{
|
||||
any::Any,
|
||||
ffi::OsString,
|
||||
path::{Path, PathBuf},
|
||||
str::FromStr,
|
||||
sync::{Arc, OnceLock},
|
||||
};
|
||||
use task::{TaskTemplate, TaskTemplates, VariableName};
|
||||
@ -22,6 +23,8 @@ use util::{maybe, paths, ResultExt};
|
||||
|
||||
const SERVER_PATH: &str = "node_modules/vscode-json-languageserver/bin/vscode-json-languageserver";
|
||||
|
||||
// Origin: https://github.com/SchemaStore/schemastore
|
||||
const TSCONFIG_SCHEMA: &str = include_str!("json/schemas/tsconfig.json");
|
||||
pub(super) fn json_task_context() -> ContextProviderWithTasks {
|
||||
ContextProviderWithTasks::new(TaskTemplates(vec![
|
||||
TaskTemplate {
|
||||
@ -74,6 +77,7 @@ impl JsonLspAdapter {
|
||||
cx,
|
||||
);
|
||||
let tasks_schema = task::TaskTemplates::generate_json_schema();
|
||||
let tsconfig_schema = serde_json::Value::from_str(TSCONFIG_SCHEMA).unwrap();
|
||||
serde_json::json!({
|
||||
"json": {
|
||||
"format": {
|
||||
@ -97,6 +101,10 @@ impl JsonLspAdapter {
|
||||
&*paths::LOCAL_TASKS_RELATIVE_PATH,
|
||||
],
|
||||
"schema": tasks_schema,
|
||||
},
|
||||
{
|
||||
"fileMatch": "*/tsconfig.json",
|
||||
"schema":tsconfig_schema
|
||||
}
|
||||
]
|
||||
}
|
||||
|
1426
crates/languages/src/json/schemas/tsconfig.json
Normal file
1426
crates/languages/src/json/schemas/tsconfig.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user