summaryrefslogtreecommitdiff
path: root/cli/lsp/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r--cli/lsp/config.rs39
1 files changed, 38 insertions, 1 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index 7b4294943..6cd401b0c 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -21,6 +21,10 @@ pub struct ClientCapabilities {
pub code_action_disabled_support: bool,
pub line_folding_only: bool,
pub status_notification: bool,
+ /// The client provides the `experimental.testingApi` capability, which is
+ /// built around VSCode's testing API. It indicates that the server should
+ /// send notifications about tests discovered in modules.
+ pub testing_api: bool,
pub workspace_configuration: bool,
pub workspace_did_change_watched_files: bool,
}
@@ -139,6 +143,28 @@ pub struct SpecifierSettings {
pub code_lens: CodeLensSpecifierSettings,
}
+#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub struct TestingSettings {
+ /// A vector of arguments which should be used when running the tests for
+ /// a workspace.
+ #[serde(default)]
+ pub args: Vec<String>,
+ /// Enable or disable the testing API if the client is capable of supporting
+ /// the testing API.
+ #[serde(default = "is_true")]
+ pub enable: bool,
+}
+
+impl Default for TestingSettings {
+ fn default() -> Self {
+ Self {
+ args: vec!["--allow-all".to_string(), "--no-check".to_string()],
+ enable: true,
+ }
+ }
+}
+
/// Deno language server specific settings that are applied to a workspace.
#[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
@@ -184,6 +210,10 @@ pub struct WorkspaceSettings {
#[serde(default)]
pub suggest: CompletionSettings,
+ /// Testing settings for the workspace.
+ #[serde(default)]
+ pub testing: TestingSettings,
+
/// An option which sets the cert file to use when attempting to fetch remote
/// resources. This overrides `DENO_CERT` if present.
pub tls_certificate: Option<String>,
@@ -333,7 +363,10 @@ impl Config {
self.client_capabilities.status_notification = experimental
.get("statusNotification")
.and_then(|it| it.as_bool())
- == Some(true)
+ == Some(true);
+ self.client_capabilities.testing_api =
+ experimental.get("testingApi").and_then(|it| it.as_bool())
+ == Some(true);
}
if let Some(workspace) = &capabilities.workspace {
@@ -530,6 +563,10 @@ mod tests {
hosts: HashMap::new(),
}
},
+ testing: TestingSettings {
+ args: vec!["--allow-all".to_string(), "--no-check".to_string()],
+ enable: true
+ },
tls_certificate: None,
unsafely_ignore_certificate_errors: None,
unstable: false,