mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
parent
57927781ed
commit
0e17f086ce
3 changed files with 41 additions and 35 deletions
|
@ -184,6 +184,7 @@ impl LspClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
fn read_request<R>(&mut self) -> Result<(u64, String, Option<R>), AnyError>
|
fn read_request<R>(&mut self) -> Result<(u64, String, Option<R>), AnyError>
|
||||||
where
|
where
|
||||||
R: de::DeserializeOwned,
|
R: de::DeserializeOwned,
|
||||||
|
@ -238,6 +239,7 @@ impl LspClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
fn write_response<V>(&mut self, id: u64, result: V) -> Result<(), AnyError>
|
fn write_response<V>(&mut self, id: u64, result: V) -> Result<(), AnyError>
|
||||||
where
|
where
|
||||||
V: Serialize,
|
V: Serialize,
|
||||||
|
@ -294,15 +296,16 @@ fn bench_big_file_edits(deno_exe: &Path) -> Result<Duration, AnyError> {
|
||||||
}),
|
}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let (id, method, _): (u64, String, Option<Value>) = client.read_request()?;
|
// TODO(@kitsonk) work around https://github.com/denoland/deno/issues/10603
|
||||||
assert_eq!(method, "workspace/configuration");
|
// let (id, method, _): (u64, String, Option<Value>) = client.read_request()?;
|
||||||
|
// assert_eq!(method, "workspace/configuration");
|
||||||
|
|
||||||
client.write_response(
|
// client.write_response(
|
||||||
id,
|
// id,
|
||||||
json!({
|
// json!({
|
||||||
"enable": true
|
// "enable": true
|
||||||
}),
|
// }),
|
||||||
)?;
|
// )?;
|
||||||
|
|
||||||
let (method, _): (String, Option<Value>) = client.read_notification()?;
|
let (method, _): (String, Option<Value>) = client.read_notification()?;
|
||||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||||
|
@ -366,15 +369,16 @@ fn bench_startup_shutdown(deno_exe: &Path) -> Result<Duration, AnyError> {
|
||||||
}),
|
}),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let (id, method, _): (u64, String, Option<Value>) = client.read_request()?;
|
// TODO(@kitsonk) work around https://github.com/denoland/deno/issues/10603
|
||||||
assert_eq!(method, "workspace/configuration");
|
// let (id, method, _): (u64, String, Option<Value>) = client.read_request()?;
|
||||||
|
// assert_eq!(method, "workspace/configuration");
|
||||||
|
|
||||||
client.write_response(
|
// client.write_response(
|
||||||
id,
|
// id,
|
||||||
json!({
|
// json!({
|
||||||
"enable": true
|
// "enable": true
|
||||||
}),
|
// }),
|
||||||
)?;
|
// )?;
|
||||||
|
|
||||||
let (method, _): (String, Option<Value>) = client.read_notification()?;
|
let (method, _): (String, Option<Value>) = client.read_notification()?;
|
||||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||||
|
|
|
@ -148,6 +148,7 @@ pub struct Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
#[allow(unused)]
|
||||||
pub fn contains(&self, specifier: &ModuleSpecifier) -> bool {
|
pub fn contains(&self, specifier: &ModuleSpecifier) -> bool {
|
||||||
self.specifier_settings.contains_key(specifier)
|
self.specifier_settings.contains_key(specifier)
|
||||||
}
|
}
|
||||||
|
|
|
@ -594,25 +594,26 @@ impl Inner {
|
||||||
let specifier = self.url_map.normalize_url(¶ms.text_document.uri);
|
let specifier = self.url_map.normalize_url(¶ms.text_document.uri);
|
||||||
|
|
||||||
// we only query the individual resource file if the client supports it
|
// we only query the individual resource file if the client supports it
|
||||||
if self.config.client_capabilities.workspace_configuration
|
// TODO(@kitsonk) workaround https://github.com/denoland/deno/issues/10603
|
||||||
&& !self.config.contains(&specifier)
|
// if self.config.client_capabilities.workspace_configuration
|
||||||
{
|
// && !self.config.contains(&specifier)
|
||||||
if let Ok(value) = self
|
// {
|
||||||
.client
|
// if let Ok(value) = self
|
||||||
.configuration(vec![ConfigurationItem {
|
// .client
|
||||||
scope_uri: Some(params.text_document.uri.clone()),
|
// .configuration(vec![ConfigurationItem {
|
||||||
section: Some(SETTINGS_SECTION.to_string()),
|
// scope_uri: Some(params.text_document.uri.clone()),
|
||||||
}])
|
// section: Some(SETTINGS_SECTION.to_string()),
|
||||||
.await
|
// }])
|
||||||
{
|
// .await
|
||||||
if let Err(err) = self
|
// {
|
||||||
.config
|
// if let Err(err) = self
|
||||||
.update_specifier(specifier.clone(), value[0].clone())
|
// .config
|
||||||
{
|
// .update_specifier(specifier.clone(), value[0].clone())
|
||||||
warn!("Error updating specifier configuration: {}", err);
|
// {
|
||||||
}
|
// warn!("Error updating specifier configuration: {}", err);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if params.text_document.uri.scheme() == "deno" {
|
if params.text_document.uri.scheme() == "deno" {
|
||||||
// we can ignore virtual text documents opening, as they don't need to
|
// we can ignore virtual text documents opening, as they don't need to
|
||||||
|
|
Loading…
Reference in a new issue