Compare commits
	
		
			2 commits
		
	
	
		
			main
			...
			alex/creat
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							 | 
						e91980d001 | ||
| 
							 | 
						1ef66cdd7c | 
					 4 changed files with 3 additions and 83 deletions
				
			
		
							
								
								
									
										48
									
								
								.github/ISSUE_TEMPLATE/bug.yaml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										48
									
								
								.github/ISSUE_TEMPLATE/bug.yaml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1,48 +0,0 @@
 | 
				
			||||||
name: Bug Report
 | 
					 | 
				
			||||||
description: File a bug report
 | 
					 | 
				
			||||||
title: "[Bug] "
 | 
					 | 
				
			||||||
labels: [bug]
 | 
					 | 
				
			||||||
body:
 | 
					 | 
				
			||||||
  - type: markdown
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      value: |
 | 
					 | 
				
			||||||
        Thanks for taking the time to fill out this bug report!
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    id: repro
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Reproduction steps
 | 
					 | 
				
			||||||
      description: "How do you trigger this bug? Please walk us through it step by step."
 | 
					 | 
				
			||||||
      value: |
 | 
					 | 
				
			||||||
        1.
 | 
					 | 
				
			||||||
        2.
 | 
					 | 
				
			||||||
        3.
 | 
					 | 
				
			||||||
        ...
 | 
					 | 
				
			||||||
      render: bash
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
  - type: dropdown
 | 
					 | 
				
			||||||
    id: version
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Version
 | 
					 | 
				
			||||||
      description: What version of VS Code are you using?
 | 
					 | 
				
			||||||
      options:
 | 
					 | 
				
			||||||
        - Stable (Default)
 | 
					 | 
				
			||||||
        - Insiders
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
  - type: dropdown
 | 
					 | 
				
			||||||
    id: os
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: What operating system are you seeing the problem on?
 | 
					 | 
				
			||||||
      multiple: true
 | 
					 | 
				
			||||||
      options:
 | 
					 | 
				
			||||||
        - All
 | 
					 | 
				
			||||||
        - Windows
 | 
					 | 
				
			||||||
        - macOS
 | 
					 | 
				
			||||||
        - Linux
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    id: logs
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Relevant log output
 | 
					 | 
				
			||||||
      description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
 | 
					 | 
				
			||||||
      render: shell
 | 
					 | 
				
			||||||
| 
						 | 
					@ -6,13 +6,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [Unreleased]
 | 
					## [Unreleased]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [0.1.3] - 2021-6-17
 | 
					 | 
				
			||||||
## Added
 | 
					## Added
 | 
				
			||||||
- New feature! JSON strings inside documents will now be automatically formatted as JSON when viewing documents. You can turn this feature off via the `appwrite.formatJsonStrings` setting.
 | 
					Ability to set the `list`, `default` and `array` properties when creating a new collection. | [Issue #20](https://github.com/streamlux/vscode-appwrite/issues/20) | [PR #21](https://github.com/streamlux/vscode-appwrite/pull/21) | Thanks [@Maatteogekko](https://github.com/Maatteogekko)!
 | 
				
			||||||
 | 
					 | 
				
			||||||
## [0.1.2] - 2021-6-03
 | 
					 | 
				
			||||||
## Added
 | 
					 | 
				
			||||||
- Ability to set the `list`, `default` and `array` properties when creating a new collection. | [Issue #20](https://github.com/streamlux/vscode-appwrite/issues/20) | [PR #21](https://github.com/streamlux/vscode-appwrite/pull/21) | Thanks [@Maatteogekko](https://github.com/Maatteogekko)!
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [0.1.1] - 2021-5-31
 | 
					## [0.1.1] - 2021-5-31
 | 
				
			||||||
## Added
 | 
					## Added
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
    "name": "vscode-appwrite",
 | 
					    "name": "vscode-appwrite",
 | 
				
			||||||
    "displayName": "Appwrite",
 | 
					    "displayName": "Appwrite",
 | 
				
			||||||
    "description": "Manage your Appwrite resources right from VS Code!",
 | 
					    "description": "Manage your Appwrite resources right from VS Code!",
 | 
				
			||||||
    "version": "0.1.3",
 | 
					    "version": "0.1.2",
 | 
				
			||||||
    "engines": {
 | 
					    "engines": {
 | 
				
			||||||
        "vscode": "^1.55.0"
 | 
					        "vscode": "^1.55.0"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
| 
						 | 
					@ -726,11 +726,6 @@
 | 
				
			||||||
                    "type": "string",
 | 
					                    "type": "string",
 | 
				
			||||||
                    "default": "",
 | 
					                    "default": "",
 | 
				
			||||||
                    "markdownDescription": "Project id of the active project, see [docs](https://github.com/streamlux/vscode-appwrite/) for more information."
 | 
					                    "markdownDescription": "Project id of the active project, see [docs](https://github.com/streamlux/vscode-appwrite/) for more information."
 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                "appwrite.formatJsonStrings": {
 | 
					 | 
				
			||||||
                    "type": "boolean",
 | 
					 | 
				
			||||||
                    "default": true,
 | 
					 | 
				
			||||||
                    "markdownDescription": "Format JSON strings when viewing documents"
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,30 +1,8 @@
 | 
				
			||||||
import { workspace } from "vscode";
 | 
					 | 
				
			||||||
import { DocumentTreeItem } from "../../tree/database/DocumentTreeItem";
 | 
					import { DocumentTreeItem } from "../../tree/database/DocumentTreeItem";
 | 
				
			||||||
import { openReadOnlyJson } from "../../ui/openReadonlyContent";
 | 
					import { openReadOnlyJson } from "../../ui/openReadonlyContent";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function parseJSONString(str: string): { valid: boolean; value: any } {
 | 
					 | 
				
			||||||
    try {
 | 
					 | 
				
			||||||
        return { value: JSON.parse(str), valid: true };
 | 
					 | 
				
			||||||
    } catch (e) {
 | 
					 | 
				
			||||||
        return { value: str, valid: false };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export async function viewDocumentAsJson(documentTreeItem: DocumentTreeItem): Promise<void> {
 | 
					export async function viewDocumentAsJson(documentTreeItem: DocumentTreeItem): Promise<void> {
 | 
				
			||||||
    const document = documentTreeItem.document;
 | 
					    const documentId = documentTreeItem.document["$id"];
 | 
				
			||||||
    const documentId = document["$id"];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const formatJsonStrings = workspace.getConfiguration("appwrite").get<Boolean>("formatJsonStrings");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (formatJsonStrings) {
 | 
					 | 
				
			||||||
        Object.entries(document).forEach(([key, value]) => {
 | 
					 | 
				
			||||||
            if (typeof value === "string") {
 | 
					 | 
				
			||||||
                const result = parseJSONString(value);
 | 
					 | 
				
			||||||
                document[key] = result.value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await openReadOnlyJson(
 | 
					    await openReadOnlyJson(
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            label: documentId,
 | 
					            label: documentId,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue