Created
July 5, 2023 16:42
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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