File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555 "languageId" : " ggsql"
5656 }
5757 ],
58+ "commands" : [
59+ {
60+ "command" : " ggsql.sourceCurrentFile" ,
61+ "category" : " ggsql" ,
62+ "title" : " Source Current File" ,
63+ "icon" : " $(play)"
64+ }
65+ ],
66+ "menus" : {
67+ "editor/title/run" : [
68+ {
69+ "command" : " ggsql.sourceCurrentFile" ,
70+ "group" : " navigation@0" ,
71+ "when" : " resourceLangId == ggsql && !isInDiffEditor"
72+ },
73+ {
74+ "command" : " workbench.action.positronConsole.executeCode" ,
75+ "when" : " resourceLangId == ggsql && !isInDiffEditor"
76+ }
77+ ]
78+ },
5879 "configuration" : {
5980 "type" : " object" ,
6081 "title" : " ggsql" ,
Original file line number Diff line number Diff line change @@ -52,6 +52,21 @@ export function activate(context: vscode.ExtensionContext): void {
5252 }
5353
5454 log ( `Registered ${ drivers . length } connection drivers` ) ;
55+
56+ // Register "Source Current File" command for the editor run button
57+ context . subscriptions . push (
58+ vscode . commands . registerCommand ( 'ggsql.sourceCurrentFile' , async ( ) => {
59+ const editor = vscode . window . activeTextEditor ;
60+ if ( ! editor || editor . document . languageId !== 'ggsql' ) {
61+ return ;
62+ }
63+ const code = editor . document . getText ( ) ;
64+ if ( code . trim ( ) . length === 0 ) {
65+ return ;
66+ }
67+ positronApi . runtime . executeCode ( 'ggsql' , code , true ) ;
68+ } )
69+ ) ;
5570}
5671
5772/**
You can’t perform that action at this time.
0 commit comments