Skip to content

Commit 9461acf

Browse files
committed
fix: only update test explorer items if file is a valid robot suite
1 parent bce484b commit 9461acf

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

vscode-client/languageclientsmanger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function toVsCodeRange(range: Range): vscode.Range {
3636
}
3737

3838
export const SUPPORTED_LANGUAGES = ["robotframework"];
39+
export const SUPPORTED_SUITE_FILE_EXTENSIONS = [".robot"];
3940

4041
export interface EvaluatableExpression {
4142
range: Range;

vscode-client/testcontrollermanager.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import { red, yellow } from "ansi-colors";
55
import * as vscode from "vscode";
66
import { DebugManager } from "./debugmanager";
77

8-
import { ClientState, LanguageClientsManager, toVsCodeRange, SUPPORTED_LANGUAGES } from "./languageclientsmanger";
8+
import {
9+
ClientState,
10+
LanguageClientsManager,
11+
toVsCodeRange,
12+
SUPPORTED_LANGUAGES,
13+
SUPPORTED_SUITE_FILE_EXTENSIONS,
14+
} from "./languageclientsmanger";
915
import { filterAsync, Mutex, sleep, WeakValueMap } from "./utils";
1016
import { CONFIG_SECTION } from "./config";
1117
import { Range, Diagnostic, DiagnosticSeverity } from "vscode-languageclient/node";
@@ -220,11 +226,8 @@ export class TestControllerManager {
220226
}),
221227
vscode.workspace.onDidCloseTextDocument((document) => this.refreshDocument(document)),
222228
vscode.workspace.onDidSaveTextDocument((document) => this.refreshDocument(document)),
223-
vscode.workspace.onDidOpenTextDocument(async (document) => {
224-
if (!SUPPORTED_LANGUAGES.includes(document.languageId)) return;
229+
vscode.workspace.onDidOpenTextDocument((document) => this.refreshDocument(document)),
225230

226-
await this.refresh(this.findTestItemForDocument(document));
227-
}),
228231
vscode.workspace.onDidChangeTextDocument((event) => {
229232
this.refreshDocument(event.document);
230233
}),
@@ -436,6 +439,7 @@ export class TestControllerManager {
436439

437440
public refreshDocument(document: vscode.TextDocument): void {
438441
if (!SUPPORTED_LANGUAGES.includes(document.languageId)) return;
442+
if (!SUPPORTED_SUITE_FILE_EXTENSIONS.some((ext) => document.uri.path.endsWith(ext))) return;
439443

440444
const uri_str = document.uri.toString();
441445
if (this.didChangedTimer.has(uri_str)) {

0 commit comments

Comments
 (0)