Source of problem

In the vue3 usage scenario, you want to wrap the request into separate hooks, input parameter modifications, output formatting modifications so that the code is decoupled and concise. However, if it is too tiring to copy every API request manually, it is better to use the VSC plug-in to generate the changes directly.

Results show

Analysis the main points

Menu adds item

Menu position can adjust the group type to take effect.

Generate the file

The main thing here is to call the VSC method to get the selected content, and then you can take care of it.

Template replacement, streaming write.

release

  1. NPM install -g vsce
  2. The project packages vsCE package
  3. Project publish vsCE publish

To optimize a

  • Set write file path to configuration file to improve availability
  • Combined with Vueuse’s Usefetch for encapsulation, only the generated file is needed to process the input parameter and output. Generic requests are mostly covered by the hooks of usefecth.

Plugin name: vscode-plugin-returns-generate

The last

If the author has what wrong can leave a message, creation is not easy to praise bai 👍