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

Run command on save feature #212029

Open
trymeouteh opened this issue May 4, 2024 · 3 comments
Open

Run command on save feature #212029

trymeouteh opened this issue May 4, 2024 · 3 comments
Labels
feature-request Request for new features or functionality workbench-editors Managing of editor widgets in workbench window

Comments

@trymeouteh
Copy link

trymeouteh commented May 4, 2024

The ability to run custom commands when you save specific file extensions in VSCode. Can be used to act as a "watch" feature when working with code to run bundlers when the user saves their code.

These commands that can be executed when a file is saved, can be done in the .vscode/settings.json file or in the global settings.json file. An indicator will be in the bottom tool bar which will indicate when a command is being executed and when the command has finished executing for builds that may take a few seconds.

EDIT:
I would recommend making this a standard is possible, by allowing global options in the global settings.json file and instead of having local setting in the .vscode/settings.json file to have local settings in a file named executeonsave.json or something like that which other IDEs can integrate the standard of looking for a executeonsave.json file and using it to know what commands to execute on save.

@bpasero bpasero added feature-request Request for new features or functionality workbench-editors Managing of editor widgets in workbench window labels May 5, 2024
@bpasero bpasero removed their assignment May 5, 2024
@VSCodeTriageBot VSCodeTriageBot added this to the Backlog Candidates milestone May 5, 2024
@VSCodeTriageBot
Copy link
Collaborator

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@moritz-t-w
Copy link

moritz-t-w commented May 15, 2024

This is in fact surprisingly difficult to do yourself.

{
	"filewatcher.commands": [
		{
			"match": "\\.ts*",
			"isAsync": true,
			"cmd": "echo '${file} file content Changed'",
			"event": "onFileChange"
		}		
	]
}
inotifywait -e close_write,moved_to,create -m . |
while read -r directory events filename; do
  if [ "$filename" = "myfile.py" ]; then
    ./myfile.py
  fi
done

@trymeouteh
Copy link
Author

I would recommend making this a standard is possible, by allowing global options in the global settings.json file and instead of having local setting in the .vscode/settings.json file to have local settings in a file named executeonsave.json or something like that which other IDEs can integrate the standard of looking for a executeonsave.json file and using it to know what commands to execute on save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests

4 participants