Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import VS Code extension from glideapps/quicktype-vscode #2559

Merged
merged 3 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.0
v18.18.0
36 changes: 0 additions & 36 deletions PACKAGES.md

This file was deleted.

8,694 changes: 7,803 additions & 891 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
"build": "npm run build --workspaces --if-present && tsc",
"test": "script/test",
"start": "script/watch",
"clean": "rm -rf dist node_modules *~ packages/*/{dist,node_modules}",
"clean": "rm -rf dist node_modules *~ packages/*/{dist,node_modules,out}",
"debug": "node --inspect-brk --max-old-space-size=4096 ./dist/index.js"
},
"workspaces": [
"./packages/quicktype-core",
"./packages/quicktype-graphql-input",
"./packages/quicktype-typescript-input"
"./packages/quicktype-typescript-input",
"./packages/quicktype-vscode"
],
"dependencies": {
"@glideapps/ts-necessities": "^2.1.3",
Expand Down
1 change: 1 addition & 0 deletions packages/quicktype-vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
32 changes: 32 additions & 0 deletions packages/quicktype-vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**Supports** `C (cJSON)`, `C#`, `C++`, `Crystal`, `Dart`, `Elm`, `Flow`, `Go`, `Haskell`, `JSON Schema`, `Java`, `JavaScript`, `JavaScript PropTypes`, `Kotlin`, `Objective-C`, `PHP`, `Pike`, `Python`, `Ruby`, `Rust`, `Scala3`, `Smithy`, `Swift`, `TypeScript`, `TypeScript Effect Schema` and `TypeScript Zod`

- Interactively generate types and (de-)serialization code from JSON, JSON Schema, and TypeScript
- Paste JSON/JSON Schema/TypeScript as code

![](https://raw.githubusercontent.com/quicktype/quicktype-vscode/master/media/demo-interactive.gif)

`quicktype` infers types from sample JSON data, then outputs strongly typed models and serializers for working with that data in your desired programming language. For more explanation, read [A first look at quicktype](http://blog.quicktype.io/first-look/).

In any JSON file, use the command "Open quicktype for JSON" to summon quicktype, which will generate types from the JSON. Invoke "Change quicktype's target language" to pick a different language. There are similar "Open quicktype" commands for JSON Schema and TypeScript.

Another way to use quicktype is to copy JSON into the clipboard and invoke "Paste JSON as code/types":

![](https://raw.githubusercontent.com/quicktype/quicktype-vscode/master/media/demo.gif)

For a more powerful experience, including custom options and the ability to generate code from multiple JSON samples, try [quicktype.io](https://app.quicktype.io).

## Installing

This extension is available for free in the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items/quicktype.quicktype)

## Customization

- `quicktype.justTypes`: Generate only types, or also produce (de)serialization code when using "Open quicktype". When using "Paste", you can pick between the commands for "types" and "code", without having to set this option.

- `quicktype.inferMaps`, `quicktype.inferEnums`, `quicktype.inferDateTimes`, `quicktype.inferUuids`, `quicktype.inferBoolStrings`, `quicktype.inferIntegerStrings`: Tell quicktype whether it should try to infer those types from the input JSON. This is not a precise science, so sometimes the guess will be wrong, which is why you can turn them off through these options. Also, quicktype doesn't support dates, UUIDs and stringified integers/booleans in all target languages yet.

## Contribute!

quicktype is an open source project, and we're always happy about contributors. If you can think of a way to improve [this extension](https://github.com/quicktype/quicktype-vscode), or [quicktype](https://github.com/quicktype/quicktype), please consider contributing, especially if you know TypeScript. Code is only one way to contribute, though: we're particularly short on documentation. We'd also love to hear your feedback - come [talk to us on Slack](http://slack.quicktype.io)!

If you find a bug, please [report it on GitHub](https://github.com/quicktype/quicktype-vscode/issues).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/quicktype-vscode/media/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/quicktype-vscode/media/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 169 additions & 0 deletions packages/quicktype-vscode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"name": "quicktype",
"displayName": "Paste JSON as Code",
"description": "Copy JSON, paste as Go, TypeScript, C#, C++ and more.",
"version": "23.0.105",
"publisher": "quicktype",
"icon": "media/icon.png",
"galleryBanner": {
"color": "#00212b",
"theme": "dark"
},
"homepage": "https://quicktype.io",
"author": {
"name": "quicktype.io",
"email": "hello@quicktype.io"
},
"bugs": {
"url": "https://github.com/quicktype-vscode/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/glideapps/quicktype-vscode"
},
"engines": {
"vscode": "^1.87.0"
},
"categories": [
"Other"
],
"keywords": [
"json",
"converter"
],
"markdown": "github",
"activationEvents": [
"onCommand:quicktype.pasteJSONAsTypes",
"onCommand:quicktype.pasteJSONAsTypesAndSerialization",
"onCommand:quicktype.pasteJSONSchemaAsTypes",
"onCommand:quicktype.pasteJSONSchemaAsTypesAndSerialization",
"onCommand:quicktype.pasteTypeScriptAsTypesAndSerialization",
"onCommand:quicktype.openForJSON",
"onCommand:quicktype.openForJSONSchema",
"onCommand:quicktype.openForTypeScript"
],
"main": "./out/src/extension",
"contributes": {
"configuration": {
"type": "object",
"title": "quicktype",
"properties": {
"quicktype.justTypes": {
"type": "boolean",
"default": true,
"description": "Produce only types; no (de-)serialization code"
},
"quicktype.inferMaps": {
"type": "boolean",
"default": true,
"description": "Infer maps when object keys look like map keys."
},
"quicktype.inferEnums": {
"type": "boolean",
"default": true,
"description": "Infer enums when there aren't many different string values."
},
"quicktype.inferDateTimes": {
"type": "boolean",
"default": true,
"description": "Use date-time types for strings that look like date-times."
},
"quicktype.inferUuids": {
"type": "boolean",
"default": true,
"description": "Use UUID types for strings that look like UUIDs."
},
"quicktype.inferIntegerStrings": {
"type": "boolean",
"default": true,
"description": "Convert stringified integers into integers, and back."
},
"quicktype.inferBooleanStrings": {
"type": "boolean",
"default": true,
"description": "Convert stringified booleans into booleans, and back."
}
}
},
"commands": [
{
"command": "quicktype.pasteJSONAsTypes",
"title": "Paste JSON as Types"
},
{
"command": "quicktype.pasteJSONAsTypesAndSerialization",
"title": "Paste JSON as Code"
},
{
"command": "quicktype.pasteJSONSchemaAsTypes",
"title": "Paste JSON Schema as Types"
},
{
"command": "quicktype.pasteJSONSchemaAsTypesAndSerialization",
"title": "Paste JSON Schema as Code"
},
{
"command": "quicktype.pasteTypeScriptAsTypesAndSerialization",
"title": "Paste TypeScript as Code"
},
{
"command": "quicktype.openForJSON",
"title": "Open quicktype for JSON"
},
{
"command": "quicktype.openForJSONSchema",
"title": "Open quicktype for JSON Schema"
},
{
"command": "quicktype.openForTypeScript",
"title": "Open quicktype for TypeScript"
},
{
"command": "quicktype.changeTargetLanguage",
"title": "Set quicktype target language"
}
],
"keybindings": [
{
"command": "quicktype.pasteJSONAsTypesAndSerialization",
"key": "ctrl+shift+V",
"mac": "cmd+shift+V",
"when": "editorTextFocus && editorLangId != 'markdown'"
},
{
"command": "quicktype.pasteJSONAsTypes",
"key": "ctrl+shift+alt+V",
"mac": "cmd+shift+alt+V",
"when": "editorTextFocus"
}
]
},
"scripts": {
"publish": "vsce publish -p $VSCE_TOKEN",
"package": "vsce package",
"vscode:prepublish": "npm run build",
"build": "tsc -p ./",
"watch": "tsc -watch -p ./",
"test": "npm run compile && node ./node_modules/vscode/bin/test"
},
"devDependencies": {
"@types/mocha": "^10.0.6",
"@types/node": "18.x",
"@types/node-persist": "^3.1.8",
"@types/readable-stream": "^4.0.10",
"@types/vscode": "^1.87.0",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vscode/test-cli": "^0.0.6",
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^2.25.0",
"eslint": "^8.56.0",
"typescript": "^5.3.3"
},
"dependencies": {
"node-persist": "^4.0.1",
"quicktype-core": "file:../quicktype-core",
"quicktype-typescript-input": "file:../quicktype-typescript-input",
"unicode-properties": "github:quicktype/unicode-properties#dist"
}
}
Loading
Loading