mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix(lsp): disable experimentalDecorators by default (#22101)
Follow up to https://github.com/denoland/deno/pull/22040. By mistake I forgot to disable "experimental decorators" in the LSP.
This commit is contained in:
parent
414320d46b
commit
2fd26de396
2 changed files with 104 additions and 1 deletions
|
@ -1128,7 +1128,7 @@ impl Inner {
|
||||||
let mut tsconfig = TsConfig::new(json!({
|
let mut tsconfig = TsConfig::new(json!({
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": false,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"lib": ["deno.ns", "deno.window", "deno.unstable"],
|
"lib": ["deno.ns", "deno.window", "deno.unstable"],
|
||||||
|
|
|
@ -11045,3 +11045,106 @@ fn sloppy_imports_not_enabled() {
|
||||||
);
|
);
|
||||||
client.shutdown();
|
client.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn decorators_tc39() {
|
||||||
|
let context = TestContextBuilder::new().use_temp_cwd().build();
|
||||||
|
let temp_dir = context.temp_dir();
|
||||||
|
temp_dir.write("deno.json", r#"{}"#);
|
||||||
|
|
||||||
|
let mut client = context.new_lsp_command().build();
|
||||||
|
client.initialize_default();
|
||||||
|
|
||||||
|
let uri = Url::from_file_path(temp_dir.path().join("main.ts")).unwrap();
|
||||||
|
|
||||||
|
let diagnostics = client
|
||||||
|
.did_open(json!({
|
||||||
|
"textDocument": {
|
||||||
|
"uri": uri,
|
||||||
|
"languageId": "typescript",
|
||||||
|
"version": 1,
|
||||||
|
"text": r#"// deno-lint-ignore no-explicit-any
|
||||||
|
function logged(value: any, { kind, name }: { kind: string; name: string }) {
|
||||||
|
if (kind === "method") {
|
||||||
|
return function (...args: unknown[]) {
|
||||||
|
console.log(`starting ${name} with arguments ${args.join(", ")}`);
|
||||||
|
// @ts-ignore this has implicit any type
|
||||||
|
const ret = value.call(this, ...args);
|
||||||
|
console.log(`ending ${name}`);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class C {
|
||||||
|
@logged
|
||||||
|
m(arg: number) {
|
||||||
|
console.log("C.m", arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new C().m(1);
|
||||||
|
"#
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.all();
|
||||||
|
|
||||||
|
assert_eq!(diagnostics.len(), 0);
|
||||||
|
|
||||||
|
client.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn decorators_ts() {
|
||||||
|
let context = TestContextBuilder::new().use_temp_cwd().build();
|
||||||
|
let temp_dir = context.temp_dir();
|
||||||
|
temp_dir.write(
|
||||||
|
"deno.json",
|
||||||
|
r#"{ "compilerOptions": { "experimentalDecorators": true } }"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut client = context.new_lsp_command().build();
|
||||||
|
client.initialize_default();
|
||||||
|
|
||||||
|
let uri = Url::from_file_path(temp_dir.path().join("main.ts")).unwrap();
|
||||||
|
|
||||||
|
let diagnostics = client
|
||||||
|
.did_open(json!({
|
||||||
|
"textDocument": {
|
||||||
|
"uri": uri,
|
||||||
|
"languageId": "typescript",
|
||||||
|
"version": 1,
|
||||||
|
"text": r#"// deno-lint-ignore-file
|
||||||
|
function a() {
|
||||||
|
console.log("@A evaluated");
|
||||||
|
return function (
|
||||||
|
_target: any,
|
||||||
|
_propertyKey: string,
|
||||||
|
descriptor: PropertyDescriptor,
|
||||||
|
) {
|
||||||
|
console.log("@A called");
|
||||||
|
const fn = descriptor.value;
|
||||||
|
descriptor.value = function () {
|
||||||
|
console.log("fn() called from @A");
|
||||||
|
fn();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class C {
|
||||||
|
@a()
|
||||||
|
static test() {
|
||||||
|
console.log("C.test() called");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.test();
|
||||||
|
"#
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.all();
|
||||||
|
|
||||||
|
assert_eq!(diagnostics.len(), 0);
|
||||||
|
|
||||||
|
client.shutdown();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue