From 32c9f662cf3da29cf38400be0752ab338bf02ff7 Mon Sep 17 00:00:00 2001 From: NomarCub Date: Tue, 5 Oct 2021 22:37:51 +0200 Subject: [PATCH] error logging - see https://github.com/NomarCub/obsidian-open-vscode/issues/3#issuecomment-934724825 --- README.md | 2 ++ main.ts | 6 +++++- manifest.json | 2 +- package.json | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 886922b..d4ba8e2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This plugin for [Obsidian](https://obsidian.md/) makes a ribbon button and a command to open your vault as a Visual Studio Code workspace. +It's functionality is probably made redundant now using the [Shell commands](https://github.com/Taitava/obsidian-shellcommands) and [Customizable Sidebar](https://github.com/phibr0/obsidian-customizable-sidebar) (or [Buttons](https://github.com/shabegom/buttons)) plugins, but it'll be maintained for the foreseeable future. + You can use VSCode for various purposes with your vault, such as for git version control, markdown formatting with [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), linting with [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint), [mass formatting files](https://marketplace.visualstudio.com/items?itemName=jbockle.jbockle-format-files) and more. ![video showcase](https://user-images.githubusercontent.com/5298006/125867690-c11f4396-e31b-4232-9ea5-822bf729df9a.gif) diff --git a/main.ts b/main.ts index f80f510..151ac55 100644 --- a/main.ts +++ b/main.ts @@ -41,7 +41,11 @@ export default class OpenVSCode extends Plugin { const { exec } = require("child_process"); const template = this.settings.executeTemplate.trim() === "" ? DEFAULT_SETTINGS.executeTemplate : this.settings.executeTemplate; const command = template.replace("{{vaultpath}}", path); - exec(command); + exec(command, (error: any, stdout: any, stderr: any) => { + if (error) { + console.error(`exec error: ${error}`); + } + }); } } diff --git a/manifest.json b/manifest.json index 481eb2a..aac52d3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "open-vscode", "name": "Open vault in VSCode", - "version": "1.1.1", + "version": "1.1.2", "minAppVersion": "0.11.13", "description": "Ribbon button and command to open vault as a Visual Studio Code workspace", "author": "NomarCub", diff --git a/package.json b/package.json index 6551820..95ed78b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-vscode", - "version": "1.1.1", + "version": "1.1.2", "description": "Open vault in Visual Studio Code ribbon button and command for Obsidian (https://obsidian.md)", "main": "main.js", "scripts": {