summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/lsp/tsc.rs14
-rw-r--r--cli/tests/integration/lsp_tests.rs4
2 files changed, 15 insertions, 3 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index e664c1b0e..b67b634e1 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -208,6 +208,7 @@ fn normalize_diagnostic(
#[derive(Clone, Debug)]
pub struct TsServer {
+ performance: Arc<Performance>,
sender: mpsc::UnboundedSender<Request>,
specifier_map: Arc<TscSpecifierMap>,
}
@@ -217,8 +218,9 @@ impl TsServer {
let specifier_map = Arc::new(TscSpecifierMap::new());
let specifier_map_ = specifier_map.clone();
let (tx, mut rx) = mpsc::unbounded_channel::<Request>();
+ let perf = performance.clone();
let _join_handle = thread::spawn(move || {
- let mut ts_runtime = js_runtime(performance, cache, specifier_map_);
+ let mut ts_runtime = js_runtime(perf, cache, specifier_map_);
let runtime = create_basic_runtime();
runtime.block_on(async {
@@ -238,6 +240,7 @@ impl TsServer {
});
Self {
+ performance,
sender: tx,
specifier_map,
}
@@ -946,9 +949,14 @@ impl TsServer {
where
R: de::DeserializeOwned,
{
- self
+ let mark = self
+ .performance
+ .mark(format!("tsc {}", req.method), None::<()>);
+ let r = self
.request_with_cancellation(snapshot, req, Default::default())
- .await
+ .await;
+ self.performance.measure(mark);
+ r
}
async fn request_with_cancellation<R>(
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index be3c3c0ad..49b8bb495 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -8309,6 +8309,10 @@ fn lsp_performance() {
"op_load",
"request",
"testing_update",
+ "tsc $configure",
+ "tsc $getAssets",
+ "tsc $getSupportedCodeFixes",
+ "tsc getQuickInfoAtPosition",
"update_cache",
"update_diagnostics_deps",
"update_diagnostics_lint",