Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
debugger;

async function returnsPromise() {
return "value";
}

returnsPromise().then(() => {});
19 changes: 16 additions & 3 deletions crates/oxc_language_server/src/linter/server_linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,12 @@ impl ServerLinter {
(ServerLinterRun::OnType, Run::OnType) => (true, false),
// it does not match, run nothing
(ServerLinterRun::OnType, Run::OnSave) => (false, false),
// run only tsglint on save, even if the user wants it with type
// tsgolint only supports the OS file system.
(ServerLinterRun::OnSave, Run::OnType) => (false, true),
// In onType mode, only TypeScript type checking runs on save
// If type_aware is disabled (tsgo_linter is None), skip everything to preserve diagnostics
(ServerLinterRun::OnSave, Run::OnType) => {
let should_run_tsgo = self.tsgo_linter.as_ref().is_some();
(false, should_run_tsgo)
}
};

// return `None` when both tools do not want to be used
Expand Down Expand Up @@ -483,6 +486,16 @@ mod test {
.test_and_snapshot_single_file_with_run_type("on-save.ts", Run::OnSave);
}

#[test]
#[cfg(not(target_endian = "big"))]
fn test_lint_on_run_on_type_on_save_without_type_aware() {
Tester::new(
"fixtures/linter/lint_on_run/on_type",
Some(Options { type_aware: false, run: Run::OnType, ..Default::default() }),
)
.test_and_snapshot_single_file_with_run_type("on-save-no-type-aware.ts", Run::OnSave);
}

#[test]
fn test_no_errors() {
Tester::new("fixtures/linter/no_errors", None)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/oxc_language_server/src/tester.rs
input_file: crates/oxc_language_server/fixtures/linter/lint_on_run/on_type/on-save-no-type-aware.ts
---
File is ignored
Loading