summaryrefslogtreecommitdiff
path: root/test_util/src/lsp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test_util/src/lsp.rs')
-rw-r--r--test_util/src/lsp.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/test_util/src/lsp.rs b/test_util/src/lsp.rs
index 7578aedf3..786a2dee5 100644
--- a/test_util/src/lsp.rs
+++ b/test_util/src/lsp.rs
@@ -148,6 +148,11 @@ impl LspStdoutReader {
self.pending_messages.0.lock().len()
}
+ pub fn output_pending_messages(&self) {
+ let messages = self.pending_messages.0.lock();
+ eprintln!("{:?}", messages);
+ }
+
pub fn had_message(&self, is_match: impl Fn(&LspMessage) -> bool) -> bool {
self.read_messages.iter().any(&is_match)
|| self.pending_messages.0.lock().iter().any(&is_match)
@@ -453,6 +458,9 @@ impl LspClientBuilder {
self
}
+ // not deprecated, this is just here so you don't accidentally
+ // commit code with this enabled
+ #[deprecated]
pub fn print_stderr(&mut self) -> &mut Self {
self.print_stderr = true;
self
@@ -541,6 +549,7 @@ impl LspClient {
}
pub fn queue_len(&self) -> usize {
+ self.reader.output_pending_messages();
self.reader.pending_len()
}
@@ -552,11 +561,25 @@ impl LspClient {
&mut self,
do_build: impl Fn(&mut InitializeParamsBuilder),
) {
+ self.initialize_with_config(
+ do_build,
+ json!([{
+ "enable": true
+ }]),
+ )
+ }
+
+ pub fn initialize_with_config(
+ &mut self,
+ do_build: impl Fn(&mut InitializeParamsBuilder),
+ config: Value,
+ ) {
let mut builder = InitializeParamsBuilder::new();
builder.set_root_uri(self.context.deno_dir().uri());
do_build(&mut builder);
self.write_request("initialize", builder.build());
self.write_notification("initialized", json!({}));
+ self.handle_configuration_request(config);
}
pub fn did_open(&mut self, params: Value) -> CollectedDiagnostics {