File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Nodejs/Product/ProjectWizard Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 22
33using System . Collections . Generic ;
44using System . Diagnostics ;
5+ using System . IO ;
56using Microsoft . VisualStudio . TemplateWizard ;
67
78namespace Microsoft . NodejsTools . ProjectWizard
@@ -23,6 +24,14 @@ public void ProjectFinishedGenerating(EnvDTE.Project project)
2324 Debug . Assert ( project != null && project . Object != null ) ;
2425 Debug . Assert ( project . Object is INodePackageModulesCommands ) ;
2526
27+ // Create the "node_modules/@types" folder before opening any files (which creates the
28+ // context for the project). This allows tsserver to start watching for type definitions
29+ // before any are installed (which is needed as "npm install" runs async, so the modules
30+ // usually aren't installed before the project context is loaded).
31+ var fullname = project . FullName ;
32+ var projectFolder = Path . GetDirectoryName ( fullname ) ;
33+ Directory . CreateDirectory ( Path . Combine ( projectFolder , @"node_modules\@types" ) ) ;
34+
2635 ( ( INodePackageModulesCommands ) project . Object ) . InstallMissingModulesAsync ( ) ;
2736 }
2837
You can’t perform that action at this time.
0 commit comments