diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-05-15 14:41:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 14:41:37 -0400 |
commit | eb5ffab1cbc010424aa1764005f71dcd67525dc1 (patch) | |
tree | 31f66727bb590a99f4e67a11e4874f72f9d3567e /cli/tsc.rs | |
parent | 8744ee883e093ecc09add4054177f8afa793ec77 (diff) |
fix(lsp): correct positions in some scenarios (#14359)
Diffstat (limited to 'cli/tsc.rs')
-rw-r--r-- | cli/tsc.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cli/tsc.rs b/cli/tsc.rs index aba289d8c..d629fb80b 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -422,7 +422,7 @@ struct LoadArgs { specifier: String, } -fn as_ts_script_kind(media_type: &MediaType) -> i32 { +pub fn as_ts_script_kind(media_type: &MediaType) -> i32 { match media_type { MediaType::JavaScript => 1, MediaType::Jsx => 2, @@ -492,7 +492,7 @@ fn op_load(state: &mut OpState, args: Value) -> Result<Value, AnyError> { }; Ok( - json!({ "data": data, "hash": hash, "scriptKind": as_ts_script_kind(&media_type) }), + json!({ "data": data, "version": hash, "scriptKind": as_ts_script_kind(&media_type) }), ) } @@ -1002,7 +1002,7 @@ mod tests { actual, json!({ "data": "console.log(\"hello deno\");\n", - "hash": "149c777056afcc973d5fcbe11421b6d5ddc57b81786765302030d7fc893bf729", + "version": "149c777056afcc973d5fcbe11421b6d5ddc57b81786765302030d7fc893bf729", "scriptKind": 3, }) ); @@ -1012,7 +1012,7 @@ mod tests { #[serde(rename_all = "camelCase")] struct LoadResponse { data: String, - hash: Option<String>, + version: Option<String>, script_kind: i64, } @@ -1033,7 +1033,7 @@ mod tests { serde_json::from_value(value).expect("failed to deserialize"); let expected = get_asset("lib.dom.d.ts").unwrap(); assert_eq!(actual.data, expected); - assert!(actual.hash.is_some()); + assert!(actual.version.is_some()); assert_eq!(actual.script_kind, 3); } @@ -1052,7 +1052,7 @@ mod tests { actual, json!({ "data": "some content", - "hash": null, + "version": null, "scriptKind": 0, }) ); @@ -1070,7 +1070,7 @@ mod tests { actual, json!({ "data": null, - "hash": null, + "version": null, "scriptKind": 0, }) ) |