diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-12-11 16:59:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 16:59:09 +0100 |
commit | 7bf267c197fc6a5cbafa0e72992b1cc7629ff989 (patch) | |
tree | c43e68c3ff0760fe36d573f87101dc4784fd9ef8 /cli/tsc/mod.rs | |
parent | 6bdf2388da617f9b82010c3df5aa094efc37e4ea (diff) |
perf(lsp): simplify some of the startup code (#21538)
Remove some dead code in "99_main_compiler.js". Eagerly start the LSP
TSC host, it was adding some not needed complexity around the TSC thread code.
Diffstat (limited to 'cli/tsc/mod.rs')
-rw-r--r-- | cli/tsc/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 2a820a6ee..6a239c1e9 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -326,6 +326,8 @@ pub struct Response { pub stats: Stats, } +// TODO(bartlomieju): we have similar struct in `tsc.rs` - maybe at least change +// the name of the struct to avoid confusion? #[derive(Debug)] struct State { hash_data: u64, @@ -764,6 +766,8 @@ struct RespondArgs { pub stats: Stats, } +// TODO(bartlomieju): this mechanism is questionable. +// Can't we use something more efficient here? #[op2] fn op_respond(state: &mut OpState, #[serde] args: RespondArgs) { let state = state.borrow_mut::<State>(); @@ -822,7 +826,6 @@ pub fn exec(request: Request) -> Result<Response, AnyError> { }, ); - let startup_source = ascii_str!("globalThis.startup({ legacyFlag: false })"); let request_value = json!({ "config": request.config, "debug": request.debug, @@ -841,9 +844,6 @@ pub fn exec(request: Request) -> Result<Response, AnyError> { ..Default::default() }); - runtime - .execute_script(located_script_name!(), startup_source) - .context("Could not properly start the compiler runtime.")?; runtime.execute_script(located_script_name!(), exec_source)?; let op_state = runtime.op_state(); @@ -1007,7 +1007,7 @@ mod tests { .execute_script_static( "<anon>", r#" - if (!(startup)) { + if (!(globalThis.exec)) { throw Error("bad"); } console.log(`ts version: ${ts.version}`); |