Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Cdaprod/289a8efdeb98d11e8db823011b41ca8a to your computer and use it in GitHub Desktop.
Save Cdaprod/289a8efdeb98d11e8db823011b41ca8a to your computer and use it in GitHub Desktop.
This is for using shellfish iOS snippets on VS code using the user snippets.json file.
#!/usr/bin/env python3
import json
# Load shellfish-snippets.json
with open("shellfish-snippets.json", "r") as shellfish_file:
shellfish_snippets = json.load(shellfish_file)
# Convert to vscode-snippets.json format
vscode_snippets = {}
for key, snippet in shellfish_snippets.items():
vscode_snippets[snippet["description"]] = {
"prefix": snippet["description"],
"body": snippet["body"] if isinstance(snippet["body"], list) else [snippet["body"]],
"description": snippet.get("description", ""),
}
# Write vscode-snippets.json
with open("vscode-snippets.json", "w") as vscode_file:
json.dump(vscode_snippets, vscode_file, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment