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

POC: monaco editor-based data visualization #905

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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: 2 additions & 0 deletions poc-mongo-json-visualizer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
out
9 changes: 9 additions & 0 deletions poc-mongo-json-visualizer/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
18 changes: 18 additions & 0 deletions poc-mongo-json-visualizer/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: compile"
}
]
}
3 changes: 3 additions & 0 deletions poc-mongo-json-visualizer/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.insertSpaces": false
}
20 changes: 20 additions & 0 deletions poc-mongo-json-visualizer/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
25 changes: 25 additions & 0 deletions poc-mongo-json-visualizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Cat Customs - Custom Editor API Samples

![Paw draw editor ](documentation/example.png)

Demonstrates VS Code's [custom editor API](https://code.visualstudio.com/api/extension-guides/custom-editors) using two custom editors:

- Mongo JSON — Uses the finalized custom text editor api to provide a custom editor for `.mongodb.json` files (which are just json files)
- Paw Draw - Uses the binary custom editor api to provide a custom editor for `.pawdraw` files (which are just png files with a different file extension).

## VS Code API

### `vscode` module

- [`window.registerCustomEditorProvider`](https://code.visualstudio.com/api/references/vscode-api#window.registerCustomEditorProvider)
- [`CustomTextEditor`](https://code.visualstudio.com/api/references/vscode-api#CustomTextEditor)
- [`CustomEditor`](https://code.visualstudio.com/api/references/vscode-api#CustomEditor)

## Running the example

- Open this example in VS Code 1.46+
- `npm install`
- `npm run watch` or `npm run compile`
- `F5` to start debugging

Open the example files from the `exampleFiles` directory.
36 changes: 36 additions & 0 deletions poc-mongo-json-visualizer/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* ESLint configuration for the project.
*
* See https://eslint.style and https://typescript-eslint.io for additional linting options.
*/
// @ts-check
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';

export default tseslint.config(
{
ignores: ['out', 'media'],
},
js.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
plugins: {
'@stylistic': stylistic,
},
rules: {
curly: 'warn',
'@stylistic/semi': ['warn', 'always'],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
},
}
);
135 changes: 135 additions & 0 deletions poc-mongo-json-visualizer/examples/small-example.mongodb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
[
{
"_id": "6744698295384c46e1b91d1a",
"item": "abc",
"price": 10,
"folding": {
"folding": {
"folding": {
"folding": {}
}
}
},
"quantity": 3,
"date": "2014-03-01T08:00:00.000Z"
},
{
"_id": "6744698295384c46e1b91d1b",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "6744698295384c46e1b91d1c",
"item": "xyz",
"price": 5,
"quantity": 10,
"date": "2014-03-15T09:00:00.000Z"
},
{
"_id": "6744698295384c46e1b91d1d",
"item": "xyz",
"price": 5,
"quantity": 20,
"date": "2014-04-04T11:21:39.736Z"
},
{
"_id": "6744698295384c46e1b91d1e",
"item": "abc",
"price": 10,
"quantity": 10,
"date": "2014-04-04T21:23:13.331Z"
},
{
"_id": "6744698295384c46e1b91d1f",
"item": "def",
"price": 7.5,
"quantity": 5,
"date": "2015-06-04T05:08:13.000Z"
},
{
"_id": "6744698295384c46e1b91d20",
"item": "def",
"price": 7.5,
"quantity": 10,
"date": "2015-09-10T08:43:00.000Z"
},
{
"_id": "6744698295384c46e1b91d21",
"item": "abc",
"price": 10,
"quantity": 5,
"date": "2016-02-06T20:20:13.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a7",
"item": "abc",
"price": 10,
"quantity": 2,
"date": "2014-03-01T08:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
},
{
"_id": "674469c2d096d8e63c3b58a8",
"item": "jkl",
"price": 20,
"quantity": 1,
"date": "2014-03-01T09:00:00.000Z"
}
]
Loading
Loading