Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for VS Code debug console: view opens sdfg in VS Code and not in browser #1419

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

kotsaloscv
Copy link
Collaborator

Test system Mac OS

This small modification makes sure that in both modes (interactive & debug) the sdfg.view() will open the graph in the VS Code env (if present) and not in the available browser.

The VSCODE_IPC_HOOK_CLI env var is present in an interactive session from the VS Code termninal, but it is not present in the debug console. In the debugging mode, it is the VSCODE_IPC_HOOK env var which is present.

@kotsaloscv kotsaloscv requested a review from phschaad November 1, 2023 09:14
@phschaad
Copy link
Collaborator

phschaad commented Nov 1, 2023

Thank you for the PR - weird, this seems to work fine on Windows, but in that case Mac OS VSCode seems to handle the environment variables differently. Is VSCODE_IPC_HOOK present in both environments then, terminal and debug console?

dace/cli/sdfv.py Outdated
@@ -36,7 +36,7 @@ def view(sdfg: dace.SDFG, filename: Optional[Union[str, int]] = None):
"""
# If vscode is open, try to open it inside vscode
if filename is None:
if 'VSCODE_IPC_HOOK_CLI' in os.environ or 'VSCODE_GIT_IPC_HANDLE' in os.environ:
if 'VSCODE_IPC_HOOK' in os.environ or 'VSCODE_GIT_IPC_HANDLE' in os.environ:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked - in my environment (Ubuntu20), VSCode does not set the VSCODE_IPC_HOOK variable in the terminal, nor the debug console, weirdly enough. In that case I would request that we test for both VSCODE_IPC_HOOK and VSCODE_IPC_HOOK_CLI.

Copy link
Collaborator

@phschaad phschaad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@phschaad phschaad enabled auto-merge (squash) November 1, 2023 15:16
@phschaad phschaad merged commit 9ff33a7 into master Nov 1, 2023
@kotsaloscv kotsaloscv deleted the fix-vscode-debug-console-sdfg-view branch November 2, 2023 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants