1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00

feat(lsp): add workspace config to status page (#11459)

This commit is contained in:
Kitson Kelly 2021-07-21 11:50:43 +10:00 committed by GitHub
parent e1d3c425c8
commit c34fef4b71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -6,6 +6,7 @@ use deno_core::error::anyhow;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::parking_lot::RwLock; use deno_core::parking_lot::RwLock;
use deno_core::serde::Deserialize; use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::serde_json::Value; use deno_core::serde_json::Value;
use deno_core::url::Url; use deno_core::url::Url;
@ -33,7 +34,7 @@ fn is_true() -> bool {
true true
} }
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CodeLensSettings { pub struct CodeLensSettings {
/// Flag for providing implementation code lenses. /// Flag for providing implementation code lenses.
@ -78,7 +79,7 @@ impl Default for CodeLensSpecifierSettings {
} }
} }
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CompletionSettings { pub struct CompletionSettings {
#[serde(default)] #[serde(default)]
@ -105,7 +106,7 @@ impl Default for CompletionSettings {
} }
} }
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ImportCompletionSettings { pub struct ImportCompletionSettings {
/// A flag that indicates if non-explicitly set origins should be checked for /// A flag that indicates if non-explicitly set origins should be checked for
@ -140,7 +141,7 @@ pub struct SpecifierSettings {
} }
/// Deno language server specific settings that are applied to a workspace. /// Deno language server specific settings that are applied to a workspace.
#[derive(Debug, Default, Clone, Deserialize, PartialEq, Eq)] #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct WorkspaceSettings { pub struct WorkspaceSettings {
/// A flag that indicates if Deno is enabled for the workspace. /// A flag that indicates if Deno is enabled for the workspace.

View file

@ -2441,10 +2441,19 @@ impl Inner {
let mut sources_specifiers = self.sources.specifiers(); let mut sources_specifiers = self.sources.specifiers();
sources_specifiers.sort(); sources_specifiers.sort();
let measures = self.performance.to_vec(); let measures = self.performance.to_vec();
let workspace_settings = self.config.get_workspace_settings();
contents.push_str(&format!( contents.push_str(&format!(
r#"# Deno Language Server Status r#"# Deno Language Server Status
## Workspace Settings
```json
{}
```
## Workspace Details
- <details><summary>Documents in memory: {}</summary> - <details><summary>Documents in memory: {}</summary>
- {} - {}
@ -2463,6 +2472,7 @@ impl Inner {
</details> </details>
"#, "#,
serde_json::to_string_pretty(&workspace_settings).unwrap(),
self.documents.len(), self.documents.len(),
documents_specifiers documents_specifiers
.into_iter() .into_iter()