Skip to content

Commit 3cd7256

Browse files
committed
Markdown保存用ディレクトリをextensionPath内に変更 (#9)
1 parent 31fbc55 commit 3cd7256

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ out
22
node_modules
33
.vscode-test/
44
*.vsix
5+
storage

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ src/**
77
tsconfig.json
88
vsc-extension-quickstart.md
99
tslint.json
10+
storage

src/commands/openItem.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ export function openItem (storagePath?: string) {
6060
fs.writeFileSync(fileUri.fsPath, item.body);
6161
}
6262

63-
const document = await workspace.openTextDocument(fileUri);
64-
await window.showTextDocument(document);
63+
await workspace.openTextDocument(fileUri).then((document) => {
64+
return window.showTextDocument(document, undefined, true);
65+
});
6566

6667
// 保存時にアップデートするためのイベントリスナを追加
6768
workspace.onDidSaveTextDocument(async (updatedDocument) => {

src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as path from 'path';
12
import { commands, ConfigurationChangeEvent, ExtensionContext, window, workspace } from 'vscode';
23
import * as nls from 'vscode-nls';
34
import { client } from './client';
@@ -19,7 +20,7 @@ export function activate (context: ExtensionContext) {
1920

2021
context.subscriptions.push(
2122
workspace.onDidChangeConfiguration(refreshUserState),
22-
commands.registerCommand('qiita.openItem', openItem(context.storagePath)),
23+
commands.registerCommand('qiita.openItem', openItem(path.join(context.extensionPath, 'storage'))),
2324
commands.registerCommand('qiita.editTags', editTags),
2425
commands.registerCommand('qiita.makePublic', makePublic),
2526
commands.registerCommand('qiita.compose', compose),

0 commit comments

Comments
 (0)