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

Commands are filetype specific, and it's sometimes annoying #1451

Open
Akuli opened this issue Mar 15, 2024 · 2 comments
Open

Commands are filetype specific, and it's sometimes annoying #1451

Akuli opened this issue Mar 15, 2024 · 2 comments

Comments

@Akuli
Copy link
Owner

Akuli commented Mar 15, 2024

I often do this:

  1. Open a Python file
  2. Use Shift+F8 to run tests with something like python3 -m pytest
  3. Open a JSON file that caused tests to fail
  4. Fix the JSON
  5. Press F8 to run pytest again. This doesn't work because I am currently in a JSON file.
  6. Switch back to any tab that has any Python file opened and then press F8. Now it works.

On the other hand, many other Porcupine users expect F5 to just run the file, no matter what file type it is.

I'm not sure what's the best solution. Maybe Porcupine should consider commands to be project-specific (not filetype-specific) when they don't use the {file_name} or {file_path} substitution?

@Moosems
Copy link
Contributor

Moosems commented Mar 15, 2024

Maybe one command is file specific and the other is directory specific?

@Akuli
Copy link
Owner Author

Akuli commented Mar 30, 2024

The more I think about this, the more I want to make the commands project-specific. I think:

  • If a command does not use the file name in substitutions, it should be specific to the project. For example, if I run git grep -n some_function_name, I'm probably refactoring all usages of a function in a single project. I want to run that git grep from any file that happens to mention the function within that project, regardless of filetype. I don't want Porcupine to run that specific git grep in other projects.
  • If a command uses the file name in substitutions, it should be specific to the filetype and the project. For example, I have a project where a Python script creates .pdf files from .txt files. I want to say python3 make-pdf.py {file_name} and have it only affect .txt files.
  • When typing a command into the "Run command" dialog, Porcupine should offer autocompletions from other projects, even though just pressing F5 wouldn't run commands that were set for other projects. For example, the git grep -n ... pattern could be useful in any project, and I want Porcupine to autocomplete that everywhere. But I don't want it to blindly run git grep -n some_function_name in a totally unrelated project like it does now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants