Skip to content

Commit 70d38b0

Browse files
committed
Tooltip fixes
Prevent outputting malformed tooltips when executable arch or version is undefined
1 parent baba8f2 commit 70d38b0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/executables/executable.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export class RExecutable {
3939
}
4040

4141
public get tooltip(): string {
42-
return `R ${this.rVersion} ${this.rArch}`;
42+
const versionString = this.rVersion ? ` ${this.rVersion}` : '';
43+
const archString = this.rArch ? ` ${this.rArch}` : '';
44+
return `R${versionString}${archString}`;
4345
}
4446
}
4547

@@ -54,7 +56,7 @@ export class VirtualRExecutable extends RExecutable {
5456
}
5557

5658
public get tooltip(): string {
57-
return `${this.name} (R ${this.rVersion} ${this.rArch})`;
59+
return `${this.name} (${super.tooltip})`;
5860
}
5961

6062
// todo, hardcoded

src/executables/ui/status.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export class ExecutableStatusItem implements vscode.Disposable {
3434
this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Information;
3535
this.languageStatusItem.detail = execState.rBin;
3636
if (execState instanceof VirtualRExecutable) {
37-
this.languageStatusItem.text = `${execState.name} (${execState.rVersion})`;
37+
const versionString = execState.rVersion ? ` (${execState.rVersion})` : '';
38+
this.languageStatusItem.text = `${execState.name}${versionString}`;
3839
} else {
3940
this.languageStatusItem.text = execState.rVersion;
4041
}

0 commit comments

Comments
 (0)