Improve the error message on code snippet and user defined template (#83)
This commit is contained in:
Родитель
f2bc7918b4
Коммит
2c52c1b276
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vscode-dtdl",
|
||||
"version": "0.2.0",
|
||||
"version": "1.0.0-rc2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -2466,9 +2466,9 @@
|
|||
}
|
||||
},
|
||||
"dtdl-language-server": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/dtdl-language-server/-/dtdl-language-server-0.4.2.tgz",
|
||||
"integrity": "sha512-7taXkWOLYwl6aOsL+OiMw4CZtp3o4L5BnKN/wEu0M1Huezk1EIL4jaMB2KPBQB3RKbO4ip9kubT68SdAJ3593g==",
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/dtdl-language-server/-/dtdl-language-server-0.4.3.tgz",
|
||||
"integrity": "sha512-FoXxrG3VhXRGjruRxx83LzV0unIpPt2B2f4/gICKVm5E6MSpNSglJxEG13pXB7zb4CO7kndDNeqXS2X5iDIyfA==",
|
||||
"requires": {
|
||||
"commander": "^5.0.0",
|
||||
"jsonc-parser": "^2.2.1",
|
||||
|
@ -4764,9 +4764,9 @@
|
|||
}
|
||||
},
|
||||
"jsonc-parser": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.0.tgz",
|
||||
"integrity": "sha512-b0EBt8SWFNnixVdvoR2ZtEGa9ZqLhbJnOjezn+WP+8kspFm+PFYDN8Z4Bc7pRlDjvuVcADSUkroIuTWWn/YiIA=="
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz",
|
||||
"integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg=="
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "4.0.0",
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
"name": "vscode-dtdl",
|
||||
"displayName": "DTDL",
|
||||
"description": "This extension provides syntax highlighting to read and edit JSON documents using the Digital Twins Definition Language",
|
||||
"version": "0.2.0",
|
||||
"version": "1.0.0-rc3",
|
||||
"publisher": "vsciot-vscode",
|
||||
"preview": true,
|
||||
"aiKey": "[AIKEY PLACEHOLDER]",
|
||||
"icon": "logo.png",
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
|
@ -95,7 +94,7 @@
|
|||
"copy-webpack-plugin": "^6.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"dtdl-language-server": "^0.4.2",
|
||||
"dtdl-language-server": "^0.4.3",
|
||||
"fs-extra": "^7.0.1",
|
||||
"vscode-extension-telemetry": "^0.1.6",
|
||||
"vscode-languageclient": "^6.1.3"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"Add DTDL Command" : {
|
||||
"prefix": "dtc",
|
||||
"body" : [
|
||||
"{\n\t\"@type\": \"Command\",\n\t\"name\": \"$1\",\n\t\"schema\": $2\n}"
|
||||
"{\n\t\"@type\": \"Command\",\n\t\"name\": \"$1\"\n}"
|
||||
],
|
||||
"description": "Adds a DTDL Command"
|
||||
}
|
||||
|
|
|
@ -85,6 +85,10 @@ export class UI {
|
|||
*/
|
||||
public static async selectTemplateFile(label: string, folder: string): Promise<string> {
|
||||
const files: string[] = Utility.listFile(folder, Constants.TEMPLATE_FILE_GLOB);
|
||||
if (!files.length) {
|
||||
const message = `${UIConstants.TEMPLATES_NOT_FOUND_MSG} ${folder}`;
|
||||
throw new Error(message);
|
||||
}
|
||||
if (files.length === 1) {
|
||||
return files[0];
|
||||
}
|
||||
|
|
|
@ -9,4 +9,5 @@ export class UIConstants {
|
|||
public static readonly SELECT_TEMPLATE_FILE_LABEL = "Select template file";
|
||||
public static readonly INPUT_MODEL_NAME_LABEL = "Input device model name";
|
||||
public static readonly BROWSE_LABEL = "Browse...";
|
||||
public static readonly TEMPLATES_NOT_FOUND_MSG = "No template is found in folder";
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче