summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-12-01 03:54:59 +0100
committerGitHub <noreply@github.com>2023-12-01 03:54:59 +0100
commitfe90ba650d926fb006948499a96c9dabb149eed9 (patch)
tree65c155c8859a0764c187ec7dd17bc7bb1c4e5be8 /cli/lsp/tsc.rs
parent5f6181df4a914c0d05ea3d2b63190b9ee2d764ca (diff)
refactor(lsp): log names (#21413)
This commit changes LSP log names by prefixing them, we now have these prefixes: - `lsp.*` - requests coming from the client - `tsc.request.*` - requests coming from clients that are routed to TSC - `tsc.op.*` - ops called by the TS host - `tsc.host.*` - requests that call JavaScript runtime that runs TypeScript compiler host Additionall `Performance::mark` was split into `Performance::mark` and `Performance::mark_with_args` to reduce verbosity of code and logs.
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index a907292e0..a834faea8 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -953,9 +953,7 @@ impl TsServer {
where
R: de::DeserializeOwned,
{
- let mark = self
- .performance
- .mark(format!("tsc {}", req.method), None::<()>);
+ let mark = self.performance.mark(format!("tsc.request.{}", req.method));
let r = self
.request_with_cancellation(snapshot, req, Default::default())
.await;
@@ -3876,7 +3874,7 @@ fn op_load(
#[serde] args: SpecifierArgs,
) -> Result<Option<LoadResponse>, AnyError> {
let state = state.borrow_mut::<State>();
- let mark = state.performance.mark("op_load", Some(&args));
+ let mark = state.performance.mark_with_args("tsc.op.op_load", &args);
let specifier = state.specifier_map.normalize(args.specifier)?;
if specifier.as_str() == "internal:///missing_dependency.d.ts" {
return Ok(Some(LoadResponse {
@@ -3901,7 +3899,7 @@ fn op_resolve(
#[serde] args: ResolveArgs,
) -> Result<Vec<Option<(String, String)>>, AnyError> {
let state = state.borrow_mut::<State>();
- let mark = state.performance.mark("op_resolve", Some(&args));
+ let mark = state.performance.mark_with_args("tsc.op.op_resolve", &args);
let referrer = state.specifier_map.normalize(&args.base)?;
let result = match state.get_asset_or_document(&referrer) {
Some(referrer_doc) => {
@@ -4429,8 +4427,10 @@ fn request(
let id = state.last_id;
(state.performance.clone(), id)
};
- let mark =
- performance.mark("request", Some((request.method, request.args.clone())));
+ let mark = performance.mark_with_args(
+ format!("tsc.host.{}", request.method),
+ request.args.clone(),
+ );
assert!(
request.args.is_array(),
"Internal error: expected args to be array"