From 89166403a1682fb3123d3fa96368a5ca346fc319 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Mon, 12 Aug 2019 08:25:00 -0700 Subject: [PATCH] Fix #1383 --- CHANGELOG.md | 4 ++++ client/commands/openUserScaffoldSnippetFolderCommand.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a06db16694..a074e0bdde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.22.1 + +- Fix command "Open user scaffold snippet folder" failure when the global snippet dir doens't exist yet. #1383. + ### 0.22.0 | 2019-08-09 | [VSIX](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/octref/vsextensions/vetur/0.22.0/vspackage) - New Scaffold Snippets system that allows system / workspace level customizable snippets. See details in [snippet docs](https://vuejs.github.io/vetur/snippet.html). #1151. diff --git a/client/commands/openUserScaffoldSnippetFolderCommand.ts b/client/commands/openUserScaffoldSnippetFolderCommand.ts index 911d83f1d7..ab88245449 100644 --- a/client/commands/openUserScaffoldSnippetFolderCommand.ts +++ b/client/commands/openUserScaffoldSnippetFolderCommand.ts @@ -1,8 +1,14 @@ import * as vscode from 'vscode'; +import * as fs from 'fs'; export function generateOpenUserScaffoldSnippetFolderCommand(globalSnippetDir: string) { return async () => { const uri = vscode.Uri.file(globalSnippetDir); + + if (!fs.existsSync(uri.fsPath)) { + fs.mkdirSync(uri.fsPath); + } + vscode.commands.executeCommand('vscode.openFolder', uri, true); }; }