-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow running .npm commands in Repl Window from any proj types. #808
Conversation
We currently only support running `.npm` commands in node projects for the Repl window. This change allows us to run repl window commands in other project types as well. Since these projects may not have a `package.json` file for npm to use, also added a command to create it.
@@ -137,7 +111,20 @@ class NpmReplCommand : IReplCommand { | |||
} | |||
|
|||
var npmReplRedirector = new NpmReplRedirector(window); | |||
|
|||
|
|||
if (!isGlobalCommand && !File.Exists(Path.Combine(projectDirectoryPath, "package.json"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I think I'll revert this part of the change. We could try checking and only doing this for npm commands that actually need the package.json
, but i think it is better to let the user handle this themselves using npm init
.
@@ -59,7 +59,7 @@ class NpmReplCommand : IReplCommand { | |||
npmArguments = string.Format(" {0} ", npmArguments); | |||
|
|||
var solution = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution; | |||
IEnumerable<IVsProject> loadedProjects = solution.EnumerateLoadedProjects(onlyNodeProjects: true); | |||
var loadedProjects = solution.EnumerateLoadedProjects(onlyNodeProjects: false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to avoid var unless it's clear what the return type is.
added comments. lmk if you have any Qs! |
👍 |
Defect
We currently only support running
.npm
commands in node projects for the Repl window. #480Fix
This change allows us to run repl window commands in other project types as well, including having a mix of node and other projects in a single solution. This change does not fix the case where you have multiple Node projects in a single solution.
Since these projects may not have a
package.json
file for npm to use, also added a command to create it.closes #156, closes #480