Skip to content
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

Merged
merged 9 commits into from
May 19, 2016

Conversation

mjbvz
Copy link
Contributor

@mjbvz mjbvz commented Mar 31, 2016

Defect
We currently only support running .npm commands in node projects for the Repl window. #480

Fix
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

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"))) {
Copy link
Contributor Author

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);
Copy link
Contributor

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.

@mousetraps
Copy link
Contributor

added comments. lmk if you have any Qs!

@mousetraps
Copy link
Contributor

👍

@mjbvz mjbvz merged commit 2d06b7a into microsoft:master May 19, 2016
@mousetraps mousetraps mentioned this pull request Jun 8, 2016
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants