diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-12-22 02:04:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-22 02:04:02 +0100 |
commit | cdbf902499dc62a4fb9f8cbf2a47a7b446623929 (patch) | |
tree | acded191f368894e02c024f39946b1e7cb0972a4 /cli/lsp/config.rs | |
parent | f86456fc26d1c02f6c511125037efed576f87458 (diff) |
feat(lsp): allow to connect V8 inspector (#21482)
This commit adds a way to connect to the TS compiler host that is run
as part of the "deno lsp" subcommand. This can be done by specifying
"DENO_LSP_INSPECTOR" variable.
---------
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r-- | cli/lsp/config.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index 42478b593..717508752 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -407,6 +407,30 @@ pub struct LanguageWorkspaceSettings { pub update_imports_on_file_move: UpdateImportsOnFileMoveOptions, } +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +#[serde(untagged)] +pub enum InspectSetting { + Bool(bool), + String(String), +} + +impl Default for InspectSetting { + fn default() -> Self { + InspectSetting::Bool(false) + } +} + +impl InspectSetting { + pub fn to_address(&self) -> Option<String> { + match self { + InspectSetting::Bool(false) => None, + InspectSetting::Bool(true) => Some("127.0.0.1:9222".to_string()), + InspectSetting::String(s) => Some(s.clone()), + } + } +} + /// Deno language server specific settings that are applied to a workspace. #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] @@ -454,6 +478,9 @@ pub struct WorkspaceSettings { #[serde(default)] pub internal_debug: bool, + #[serde(default)] + pub internal_inspect: InspectSetting, + /// Write logs to a file in a project-local directory. #[serde(default)] pub log_file: bool, @@ -506,6 +533,7 @@ impl Default for WorkspaceSettings { import_map: None, code_lens: Default::default(), internal_debug: false, + internal_inspect: Default::default(), log_file: false, lint: true, document_preload_limit: default_document_preload_limit(), @@ -1080,6 +1108,10 @@ impl Config { self.settings.unscoped.log_file } + pub fn internal_inspect(&self) -> &InspectSetting { + &self.settings.unscoped.internal_inspect + } + pub fn update_capabilities( &mut self, capabilities: &lsp::ClientCapabilities, @@ -1330,6 +1362,7 @@ mod tests { test: true, }, internal_debug: false, + internal_inspect: InspectSetting::Bool(false), log_file: false, lint: true, document_preload_limit: 1_000, |