File tree Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,34 @@ function registerCustomCommands(context: ExtensionContext) {
4747 }
4848 }
4949 } ) )
50+
51+ context . subscriptions . push ( Commands . registerCommand ( 'lua.exportDocument' , async ( ) => {
52+ if ( ! defaultClient ) {
53+ return ;
54+ } ;
55+ let outputs = await vscode . window . showOpenDialog ( {
56+ defaultUri : vscode . Uri . joinPath (
57+ context . extensionUri ,
58+ 'server' ,
59+ 'log' ,
60+ ) ,
61+ openLabel : "Export documents to this folder" ,
62+ canSelectFiles : false ,
63+ canSelectFolders : true ,
64+ canSelectMany : false ,
65+ } ) ;
66+ let output = outputs ?. [ 0 ] ;
67+ if ( ! output ) {
68+ return ;
69+ } ;
70+ defaultClient . client . sendRequest ( ExecuteCommandRequest . type , {
71+ command : 'lua.exportDocument' ,
72+ arguments : [ output . toString ( ) ] ,
73+ } )
74+ } ) )
5075}
5176
5277class LuaClient {
53-
5478 public client : LanguageClient ;
5579 private disposables = new Array < Disposable > ( ) ;
5680 constructor ( private context : ExtensionContext ,
Original file line number Diff line number Diff line change 2525 {
2626 "command" : " lua.psi.view" ,
2727 "title" : " Lua Psi Viewer"
28+ "command" : " lua.exportDocument" ,
2829 }
2930 ],
3031 "configuration" : {
29132914 "menus" : {
29142915 "editor/context" : [
29152916 {
2916- "command" : " lua.psi.view " ,
2917+ "command" : " lua.exportDocument " ,
29172918 "group" : " z_commands" ,
29182919 "when" : " resourceLangId == lua"
29192920 }
Original file line number Diff line number Diff line change @@ -37,13 +37,17 @@ return {
3737 {
3838 command = " lua.psi.view" ,
3939 title = " Lua Psi Viewer"
40- }
40+ },
41+ {
42+ command = " lua.exportDocument" ,
43+ title = " Export Document" ,
44+ },
4145 },
4246 menus = {
4347 [" editor/context" ] = {
4448 {
4549 when = " resourceLangId == lua" ,
46- command = " lua.psi.view " ,
50+ command = " lua.exportDocument " ,
4751 group = " z_commands"
4852 }
4953 }
You can’t perform that action at this time.
0 commit comments