@@ -2,8 +2,9 @@ import { printer, prompter } from '@aws-amplify/amplify-prompts';
2
2
import execa from 'execa' ;
3
3
import * as fs from 'fs-extra' ;
4
4
import * as path from 'path' ;
5
- import { $TSContext , AmplifyError , getPackageManager , pathManager , skipHooks } from '../index' ;
5
+ import { $TSContext , AmplifyError , getPackageManager , pathManager , skipHooks , stateManager } from '../index' ;
6
6
import { JSONUtilities } from '../jsonUtilities' ;
7
+ import { merge } from 'lodash' ;
7
8
8
9
/**
9
10
* This method generates the default/template overrides file
@@ -63,6 +64,10 @@ export const buildOverrideDir = async (cwd: string, destDirPath: string): Promis
63
64
const overrideSampleTsconfigJsonPath = path . join ( __dirname , '..' , '..' , 'resources' , 'overrides-resource' , 'tsconfig.json' ) ;
64
65
fs . writeFileSync ( overrideBackendTsConfigJson , fs . readFileSync ( overrideSampleTsconfigJsonPath ) ) ;
65
66
}
67
+
68
+ // ensure awscloudformation folder is not excluded in vscode
69
+ setSettingsJsonAwscloudformationFlagFalse ( ) ;
70
+
66
71
const packageManager = await getPackageManager ( cwd ) ;
67
72
68
73
if ( packageManager === null ) {
@@ -154,3 +159,27 @@ export const generateTsConfigforProject = (srcResourceDirPath: string, destDirPa
154
159
fs . writeFileSync ( overrideFileName , fs . readFileSync ( path . join ( srcResourceDirPath , 'override.ts.sample' ) ) ) ;
155
160
fs . writeFileSync ( resourceTsConfigFileName , fs . readFileSync ( path . join ( srcResourceDirPath , 'tsconfig.resource.json' ) ) ) ;
156
161
} ;
162
+
163
+ /**
164
+ * this method sets the flag to false in vscode settings.json to show awscloudformation folder in vscode
165
+ */
166
+ const setSettingsJsonAwscloudformationFlagFalse = ( ) : void => {
167
+ if ( stateManager . getLocalEnvInfo ( ) . defaultEditor !== 'vscode' ) {
168
+ return ;
169
+ }
170
+
171
+ const workspaceSettingsPath = '.vscode/settings.json' ;
172
+ const exclusionRules = {
173
+ 'files.exclude' : {
174
+ 'amplify/backend/awscloudformation' : false ,
175
+ } ,
176
+ } ;
177
+
178
+ try {
179
+ // if settings file exists, safely add exclude settings to it
180
+ const settings = JSONUtilities . readJson ( workspaceSettingsPath ) ;
181
+ JSONUtilities . writeJson ( workspaceSettingsPath , merge ( settings , exclusionRules ) ) ;
182
+ } catch ( error ) {
183
+ // workspace settings file does not exist, noop
184
+ }
185
+ } ;
0 commit comments