nativescript-community / nativescript-vscode-extension

A Visual Studio Code Extension for NativeScript
https://www.nativescript.org/visual-studio-code
Apache License 2.0
82 stars 32 forks source link

Allow locally installed tns to be used by plugin #273

Closed Logikgate closed 3 years ago

Logikgate commented 4 years ago

If you are working in multiple nativescript projects all with different versions of nativescript installed it is currently not possible to use this plugin because it uses the globally installed nativescript cli.

It is possible to specify the tnsPath using the workspace setting nativescript.tnsPath but currently that path must be absolute so it is not possible to share that setting amongst a team.

This pull request modifies the plugin to allow the vscode workspace nativescript.tnsPath setting to be a relative path so that the setting can be shared amongst team members.

Logikgate commented 4 years ago

@rosen-vladimirov Thanks for the review! Did you set the nativescript.tnsPath in the project you tested?

This pull request doesn't automatically detect if a local Nativescript is installed it just adds the ability for a user to specify a path that is relative to the project root. So something like:

{ 
    "nativescript.tnsPath": "./node_modules/.bin/tns"
}

That being said, I do think that it would be good for it to automatically use the local cli if a tnsPath isn't specified in the workspace settings. So the order of precedence will be:

1) tnsPath specified in workspace settings 2) if no tnsPath, use locally installed cli if it exists 3) if no locally installed cli, use globally installed cli

Let me know if you agree and I will make the change 😄

NathanWalker commented 4 years ago

@Logikgate We were looking at getting this merged finally - curious if you had a moment for a brief zoom call? If so could you shoot email to support@nativescript.org - just want to make sure the changes don't have side effects.