дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
test(typescript): wait for import style changes to reach vtsls in the smoke
`typescript_import_style` failed on slower CI runners: the specifier exclude case kept offering `alphaHelper` for 120 s. Changing a setting reconfigures the servers in the background, so the first completion in `third.ts` could run under the old preferences. tsserver then caches that file's module specifiers under a key without `autoImportSpecifierExcludeRegexes`, and a per-file `configure` doesn't clear it, so every retry got the old answer. Each setting change in the test now awaits the reconfiguration before the next completion.
Цей коміт міститься в:
1 джерело
77342b8e71
коміт
1cd3bf24e7
1 file changed
+15
-10
@@ -742,38 +742,43 @@ async fn typescript_import_style() {
|
||||
..TYPESCRIPT
|
||||
};
|
||||
let smoke = Smoke::start("typescript", &checks).await;
|
||||
let set = |key: &str, value: &str| {
|
||||
let lsp = smoke.host.project(WINDOW).unwrap().lsp.clone();
|
||||
// Returns once vtsls has the change. A completion that runs before it fills tsserver's
|
||||
// module specifier cache for that file under the old preferences, and that cache is keyed
|
||||
// without `autoImportSpecifierExcludeRegexes`, so the file keeps the old answer.
|
||||
let set = async |key: &str, value: &str| {
|
||||
let scope = ide_workspace::settings::SettingsScope::Project;
|
||||
let key = format!("editor.codeStyle.languages.typescript.{key}");
|
||||
ops::project::settings_set(&smoke.host, WINDOW, scope, key, value.into()).unwrap();
|
||||
lsp.reconfigure().await;
|
||||
};
|
||||
let alpha = typed("src/app/main.ts", "export const ready", "alphaH");
|
||||
let beta = typed("src/app/main.ts", "export const ready", "betaW");
|
||||
let import = |typed, label, result| AutoImport { typed, label, result };
|
||||
|
||||
set("importModuleSpecifier", r#""relative""#);
|
||||
set("importModuleSpecifier", r#""relative""#).await;
|
||||
smoke.auto_import(import(alpha, "alphaHelper", r#"from "../lib/alpha""#)).await;
|
||||
set("importModuleSpecifier", r#""non-relative""#);
|
||||
set("importModuleSpecifier", r#""non-relative""#).await;
|
||||
smoke.auto_import(import(alpha, "alphaHelper", r#"from "@/lib/alpha""#)).await;
|
||||
|
||||
set("importModuleSpecifier", r#""relative""#);
|
||||
set("importModuleSpecifierEnding", r#""index""#);
|
||||
set("importModuleSpecifier", r#""relative""#).await;
|
||||
set("importModuleSpecifierEnding", r#""index""#).await;
|
||||
smoke.auto_import(import(beta, "betaWidget", r#"from "./components/index""#)).await;
|
||||
set("importModuleSpecifierEnding", r#""minimal""#);
|
||||
set("importModuleSpecifierEnding", r#""minimal""#).await;
|
||||
smoke.auto_import(import(beta, "betaWidget", r#"from "./components""#)).await;
|
||||
|
||||
// tsserver keeps the auto-import candidates of the file it last completed in until the
|
||||
// program changes; other files see an exclusion at once.
|
||||
set("autoImportFileExcludePatterns", r#"["**/index.ts"]"#);
|
||||
set("autoImportFileExcludePatterns", r#"["**/index.ts"]"#).await;
|
||||
smoke.not_offered(typed("src/app/other.ts", "export const other", "betaW"), "betaWidget", "betaWord").await;
|
||||
set("autoImportSpecifierExcludeRegexes", r#"["lib/alpha$"]"#);
|
||||
set("autoImportSpecifierExcludeRegexes", r#"["lib/alpha$"]"#).await;
|
||||
smoke.not_offered(typed("src/app/third.ts", "export const third", "alphaH"), "alphaHelper", "alphaHint").await;
|
||||
|
||||
// Emptied lists reach the server too: the symbols are offered again.
|
||||
set("autoImportFileExcludePatterns", "[]");
|
||||
set("autoImportFileExcludePatterns", "[]").await;
|
||||
let beta = typed("src/app/fourth.ts", "export const fourth", "betaW");
|
||||
smoke.auto_import(import(beta, "betaWidget", r#"from "./components""#)).await;
|
||||
set("autoImportSpecifierExcludeRegexes", "[]");
|
||||
set("autoImportSpecifierExcludeRegexes", "[]").await;
|
||||
let alpha = typed("src/app/fifth.ts", "export const fifth", "alphaH");
|
||||
smoke.auto_import(import(alpha, "alphaHelper", r#"from "../lib/alpha""#)).await;
|
||||
}
|
||||
|
||||
Reference in new issue
Заблокувати користувача