@@ -21,10 +21,10 @@ interface MenuOption {
21
21
}
22
22
23
23
/**
24
- * Currently contains all known developer tools.
24
+ * Defines AWS Toolkit developer tools.
25
25
*
26
26
* Options are displayed as quick-pick items. The {@link MenuOption.executor} callback is ran
27
- * if the user selects an option . There is no support for name-spacing. Just add the relevant
27
+ * on selection . There is no support for name-spacing. Just add the relevant
28
28
* feature/module as a description so it can be moved around easier.
29
29
*/
30
30
const menuOptions : Record < string , MenuOption > = {
@@ -34,6 +34,22 @@ const menuOptions: Record<string, MenuOption> = {
34
34
detail : 'Edit a key in global/secret storage as a JSON document' ,
35
35
executor : openStorageFromInput ,
36
36
} ,
37
+ showGlobalState : {
38
+ label : 'Show Global State' ,
39
+ description : 'AWS Toolkit' ,
40
+ detail : 'Shows various state (including environment variables)' ,
41
+ executor : showGlobalState ,
42
+ } ,
43
+ }
44
+
45
+ export class GlobalStateDocumentProvider implements vscode . TextDocumentContentProvider {
46
+ provideTextDocumentContent ( uri : vscode . Uri ) : string {
47
+ let s = 'Environment variables known to AWS Toolkit:\n'
48
+ for ( const [ k , v ] of Object . entries ( process . env ) ) {
49
+ s += `${ k } =${ v } \n`
50
+ }
51
+ return s
52
+ }
37
53
}
38
54
39
55
/**
@@ -53,7 +69,8 @@ export function activate(ctx: ExtContext): void {
53
69
54
70
ctx . extensionContext . subscriptions . push (
55
71
devSettings . onDidChangeActiveSettings ( updateMode ) ,
56
- vscode . commands . registerCommand ( 'aws.dev.openMenu' , ( ) => openMenu ( ctx , menuOptions ) )
72
+ vscode . commands . registerCommand ( 'aws.dev.openMenu' , ( ) => openMenu ( ctx , menuOptions ) ) ,
73
+ vscode . workspace . registerTextDocumentContentProvider ( 'aws-dev2' , new GlobalStateDocumentProvider ( ) )
57
74
)
58
75
59
76
updateMode ( )
@@ -228,4 +245,10 @@ async function openStorageFromInput() {
228
245
}
229
246
}
230
247
248
+ async function showGlobalState ( ) {
249
+ const uri = vscode . Uri . parse ( 'aws-dev2:global-state' )
250
+ const doc = await vscode . workspace . openTextDocument ( uri )
251
+ await vscode . window . showTextDocument ( doc , { preview : false } )
252
+ }
253
+
231
254
export const openStorageCommand = Commands . from ( ObjectEditor ) . declareOpenStorage ( '_aws.dev.openStorage' )
0 commit comments