Skip to content

Commit 5e83537

Browse files
committed
feat(cli): disable console links for RF7.1 if running in VSCode terminal
1 parent cbe9fb2 commit 5e83537

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

packages/runner/src/robotcode/runner/cli/rebot.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from robotcode.robot.config.loader import load_robot_config_from_path
1212
from robotcode.robot.config.model import RebotProfile
1313
from robotcode.robot.config.utils import get_config_files
14+
from robotcode.robot.utils import get_robot_version
1415

1516
from ..__version__ import __version__
1617

@@ -96,9 +97,20 @@ def rebot(app: Application, robot_options_and_args: Tuple[str, ...]) -> None:
9697
+ " ".join(f'"{o}"' for o in (options + list(robot_options_and_args)))
9798
)
9899

100+
console_links_args = []
101+
if get_robot_version() >= (7, 1) and os.getenv("ROBOTCODE_DISABLE_ANSI_LINKS", "").lower() in [
102+
"on",
103+
"1",
104+
"yes",
105+
"true",
106+
]:
107+
console_links_args = ["--consolelinks", "off"]
108+
99109
app.exit(
100110
cast(
101111
int,
102-
RebotEx(app.config.dry, root_folder).execute_cli((*options, *robot_options_and_args), exit=False),
112+
RebotEx(app.config.dry, root_folder).execute_cli(
113+
(*options, *console_links_args, *robot_options_and_args), exit=False
114+
),
103115
)
104116
)

packages/runner/src/robotcode/runner/cli/robot.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,15 @@ def robot(
311311

312312
root_folder, profile, cmd_options = handle_robot_options(app, robot_options_and_args)
313313

314+
console_links_args = []
315+
if get_robot_version() >= (7, 1) and os.getenv("ROBOTCODE_DISABLE_ANSI_LINKS", "").lower() in [
316+
"on",
317+
"1",
318+
"yes",
319+
"true",
320+
]:
321+
console_links_args = ["--consolelinks", "off"]
322+
314323
app.exit(
315324
cast(
316325
int,
@@ -325,6 +334,6 @@ def robot(
325334
root_folder,
326335
by_longname,
327336
exclude_by_longname,
328-
).execute_cli((*cmd_options, *robot_options_and_args), exit=False),
337+
).execute_cli((*cmd_options, *console_links_args, *robot_options_and_args), exit=False),
329338
)
330339
)

vscode-client/extension.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
117117
new KeywordsTreeViewProvider(context, languageClientManger, outputChannel),
118118
);
119119

120+
context.environmentVariableCollection.clear();
121+
context.environmentVariableCollection.description = new vscode.MarkdownString(
122+
"Disable ANSI links in `robot`'s terminal output.",
123+
);
124+
context.environmentVariableCollection.replace("ROBOTCODE_DISABLE_ANSI_LINKS", "1");
125+
120126
await languageClientManger.refresh();
121127

122128
context.subscriptions.push(

0 commit comments

Comments
 (0)