mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-31 02:21:57 +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,
|
any::Any,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
str::FromStr,
|
||||||
sync::{Arc, OnceLock},
|
sync::{Arc, OnceLock},
|
||||||
};
|
};
|
||||||
use task::{TaskTemplate, TaskTemplates, VariableName};
|
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";
|
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 {
|
pub(super) fn json_task_context() -> ContextProviderWithTasks {
|
||||||
ContextProviderWithTasks::new(TaskTemplates(vec![
|
ContextProviderWithTasks::new(TaskTemplates(vec![
|
||||||
TaskTemplate {
|
TaskTemplate {
|
||||||
@ -74,6 +77,7 @@ impl JsonLspAdapter {
|
|||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
let tasks_schema = task::TaskTemplates::generate_json_schema();
|
let tasks_schema = task::TaskTemplates::generate_json_schema();
|
||||||
|
let tsconfig_schema = serde_json::Value::from_str(TSCONFIG_SCHEMA).unwrap();
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"json": {
|
"json": {
|
||||||
"format": {
|
"format": {
|
||||||
@ -97,6 +101,10 @@ impl JsonLspAdapter {
|
|||||||
&*paths::LOCAL_TASKS_RELATIVE_PATH,
|
&*paths::LOCAL_TASKS_RELATIVE_PATH,
|
||||||
],
|
],
|
||||||
"schema": tasks_schema,
|
"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