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

dance.run does not have context of currently open file #362

Open
JJK96 opened this issue Mar 3, 2025 · 2 comments
Open

dance.run does not have context of currently open file #362

JJK96 opened this issue Mar 3, 2025 · 2 comments

Comments

@JJK96
Copy link
Contributor

JJK96 commented Mar 3, 2025

When executing the dance.run command, Dance does this in a context without active editor. This prevents me from obtaining the file path of the currently open file in order to run a system command on it.

Is there a specific reason for this? A workaround to still get the file path? I tried using the vscode api, but did not get the file path.

@71
Copy link
Owner

71 commented Mar 19, 2025

Hey there, and thanks for the report. Can you explain where you're running dance.run? I managed to get the current path with all the following:

  • ! Context.current.document.uri.fsPath
  • Dance: Run > insert(insert.End, () => Context.current.document.uri.fsPath)
  • A keybinding:
    {
       "key": "tab",
       "command": "dance.run",
       "args": {
         "input": [
           "await insert(insert.End, () => Context.current.document.uri.fsPath)",
         ],
       },
       "when": "editorTextFocus && dance.mode == 'normal'",
    }

@JJK96
Copy link
Contributor Author

JJK96 commented Mar 19, 2025

I also ran it from a keybinding 🤔 I'll send a proof of concept

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

No branches or pull requests

2 participants