ds-econ

Share this post

ChatGPT for turbo VS Code snippets

dsecon.substack.com

ChatGPT for turbo VS Code snippets

Turn your code into a VS Code snippet within a minute

Finn
May 10, 2023
Share

If you're someone who works with code regularly, you know how valuable code snippets can be. They can save you time and effort by providing a quick way to insert frequently used code into your projects.

3 VS Code Snippets, to make writing in Quarto even easier! 🔨

3 VS Code Snippets, to make writing in Quarto even easier! 🔨

Finn
·
Apr 5
Read full story

With ChatGPT, you can easily turn code chunks into VS Code snippets, without having to enter them line by line in the snippets.json file yourself.

Works turbo fast in 4 steps… 🏎️


Thank you for reading ds-econ. This post is public so feel free to share it.

Share

0) Open ChatGPT

First, open ChatGPT in your browser.

1) Provide a Code Chunk

Once you're in ChatGPT, provide the code chunk you want to turn into a snippet.

In my case, it was this mermaid graph:

graph LR;
  A((Start)) --> B(Text Lowercase);
  B --> C(Remove Special Characters);
  C --> D(Remove Whitespace);
  D --> E((End));

2) Request Snippet Conversion

Next, request that ChatGPT converts your code into a VS Code snippet. You can do this by asking something like "Can you turn this code chunk into a VS Code snippet?" or "How can I create a VS Code snippet from this code?"

Work in multiple steps. First ask for the snippet itself, then ask for add-ons, such as prompting for creating the labels of the graph as a variable.

3) Open Snippet file in VS Code

Press cmd + shift + p and open the snippet file corresponding to your programming language. Paste in the snippet.

4) Make sure it works.

ChatGPT can be a helpful tool and a workhorse for small, annoying, tasks like these. However, sometimes things go wrong. Make sure your snippet works and try it out.

Thanks for reading ds-econ! Subscribe for free to receive new posts and support my work.

Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

© 2023 Finn
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing