I try to add a function has feature: When save file (ctrl+s) , the package “W3CValidators: Validate HTML5” will run. How can I do that?
Currently, I just ctrl+shift+P and then find W3CValidators: https://gyazo.com/a0db31460ba7f1e37a65949fc95dad02
You will have to write a small plugin for it. The main idea being running the command that is responsible for
W3CValidators: Validate HTML5 after saving the file (look at the boilerplate below)
import sublime import sublime_plugin class ExampleListener(sublime_plugin.EventListener): def on_post_save_async(self, view): # Run the command that is responsible for "W3CValidators: Validate HTML5" # after the view is saved. pass
If you are unsure what the command is, just run
sublime.log_commands(True) in ST’s console, run that (
W3CValidators: Validate HTML5) once from the command palette and it should log the command for it.
Thank you for your answer. Let me try it.