File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 172172 "command" : " vscode-cnb.open-post-in-blog-admin" ,
173173 "title" : " 在博客后台中编辑" ,
174174 "category" : " Cnblogs"
175+ },
176+ {
177+ "command" : " vscode-cnb.open-workspace" ,
178+ "title" : " 打开工作空间" ,
179+ "category" : " Cnblogs"
175180 }
176181 ],
177182 "configuration" : {
200205 "name" : " 登录/授权" ,
201206 "when" : " !vscode-cnb.isAuthorized"
202207 },
208+ {
209+ "id" : " vscode-cnb-workspace" ,
210+ "name" : " 工作空间" ,
211+ "when" : " vscode-cnb.isAuthorized"
212+ },
203213 {
204214 "id" : " cnblogs-post-categories-list" ,
205215 "name" : " 分类列表" ,
495505 {
496506 "view" : " cnblogs-navigation" ,
497507 "contents" : " [首页](https://www.cnblogs.com)\n [新闻](https://news.cnblogs.com/)\n [博问](https://q.cnblogs.com/)\n [闪存](https://ing.cnblogs.com/)\n [小组](https://group.cnblogs.com/)"
508+ },
509+ {
510+ "view" : " vscode-cnb-workspace" ,
511+ "contents" : " [打开工作空间](command:vscode-cnb.open-workspace)" ,
512+ "when" : " !vscode-cnb.isTargetWorkspace"
513+ },
514+ {
515+ "view" : " vscode-cnb-workspace" ,
516+ "contents" : " [设置工作空间](command:vscode-cnb.set-workspace)"
498517 }
499518 ]
500519 },
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { openPostInVscode } from './posts-list/open-post-in-vscode';
2929import { deletePostToLocalFileMap } from './posts-list/delete-post-to-local-file-map' ;
3030import { renamePost } from './posts-list/rename-post' ;
3131import { openPostInBlogAdmin } from './open-post-in-blog-admin' ;
32+ import { openWorkspace } from './open-workspace' ;
3233
3334export const registerCommands = ( ) => {
3435 const context = globalState . extensionContext ;
@@ -67,6 +68,7 @@ export const registerCommands = () => {
6768 vscode . commands . registerCommand ( `${ appName } .delete-post-to-local-file-map` , deletePostToLocalFileMap ) ,
6869 vscode . commands . registerCommand ( `${ appName } .rename-post` , renamePost ) ,
6970 vscode . commands . registerCommand ( `${ appName } .open-post-in-blog-admin` , openPostInBlogAdmin ) ,
71+ vscode . commands . registerCommand ( `${ appName } .open-workspace` , openWorkspace ) ,
7072 ] ;
7173 context ?. subscriptions . push ( ...disposables ) ;
7274} ;
Original file line number Diff line number Diff line change 1+ import { commands , MessageOptions , window } from 'vscode' ;
2+ import { Settings } from '../services/settings.service' ;
3+
4+ export const openWorkspace = async ( ) => {
5+ const uri = Settings . workspaceUri ;
6+ const { fsPath } = uri ;
7+ const options = [ '在当前窗口中打开' , '在新窗口中打开' ] ;
8+ const input = await window . showInformationMessage (
9+ `即将打开 ${ fsPath } ` ,
10+ { modal : true } as MessageOptions ,
11+ ...options
12+ ) ;
13+ const newWindow = input === options [ 1 ] ;
14+
15+ await commands . executeCommand ( 'vscode.openFolder' , uri , newWindow ) ;
16+ } ;
You can’t perform that action at this time.
0 commit comments