Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
feat: add import map file jso validator
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Feb 26, 2020
1 parent 89b7d4c commit 2ccfa02
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 2 deletions.
8 changes: 7 additions & 1 deletion client/src/extension.ts
Expand Up @@ -87,6 +87,8 @@ async function getTypescriptAPI(): Promise<TypescriptAPI> {
}

class Extension {
// the name of this extension
private id = "axetroy.vscode-deno";
// extension context
private context!: ExtensionContext;
// typescript API
Expand Down Expand Up @@ -556,7 +558,11 @@ Executable ${this.denoInfo.executablePath}`;
this.StartDenoLanguageServer.bind(this)
);

console.log(`Congratulations, your extension "vscode-deno" is now active!`);
const extension = extensions.getExtension(this.id);

console.log(
`Congratulations, your extension "${this.id} ${extension?.packageJSON["version"]}" is now active!`
);
}
// deactivate function for vscode
public async deactivate(context: ExtensionContext) {
Expand Down
44 changes: 43 additions & 1 deletion package.json
Expand Up @@ -85,7 +85,49 @@
]
}
}
}
},
"jsonValidation": [
{
"fileMatch": "import_map.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "import_maps.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "importmap.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "importmaps.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "import-map.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "import-maps.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "importMap.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "importMaps.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "ImportMap.json",
"url": "./schemas/import_map.schema.json"
},
{
"fileMatch": "ImportMaps.json",
"url": "./schemas/import_map.schema.json"
}
]
},
"scripts": {
"vscode:prepublish": "yarn compile",
Expand Down
23 changes: 23 additions & 0 deletions schemas/import_map.schema.json
@@ -0,0 +1,23 @@
{
"title": "JSON schema for Import Maps files",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"imports": {
"default": {},
"description": "The Imports field",
"type": "object",
"additionalProperties": { "type": "string" }
},
"scopes": {
"default": {},
"description": "The Scopes field",
"type": "object",
"properties": {},
"additionalProperties": {
"type": "object",
"additionalProperties": { "type": "string" }
}
}
}
}

0 comments on commit 2ccfa02

Please sign in to comment.