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

Bug fix vscode debugger when using Angular based NativeScript projects. #279

Closed rob4226 closed 3 years ago

rob4226 commented 3 years ago

I believe this addresses #278 and #8930. I have never been able to properly debug an Angular based NativeScript project in vscode using this "nativescript-vscode-extension" because vscode always says "Breakpoint ignored because generated code not found (source map problem?)". Regular plain JavaScript projects work as expected but not with Angular. After combing through the debug console and logging output from the extension, I found the problem to be that the path of the source files have app/app in it when it should be src/app. For example, with a fresh NativeScript Angular HelloWorld project ns create ns-angular-project --ng the vscode debugger says the path is: e:/my-projects/ns-angular-project/app/app/item/item-detail.component.ts when it should be: e:/my-projects/ns-angular-project/src/app/item/item-detail.component.ts

So what I did in this PR is added a check for an "angular.json" file in the base of the project in order to determine if it is an Angular based project or not. If it is, then the appDirPath is changed to src from app. For other projects the behavior will remain the same, leaving it as "app" because plain JavaScript projects were working fine already.

All tests are passing. I also tried it out on both brand new NativeScript Angular projects and NativeScript plain JavaScript projects, and they both work great now!

I also added a second unrelated commit that fixes the extension publisher to NativeScript from Telerik and the extension name from Telerik.nativescript to nativescript.nativescript so that it matches what is currently in the vscode extension marketplace so it won't look like a different extension when you install it.

Please let me know if you have any questions!

cla-bot[bot] commented 3 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign the CLA at https://www.nativescript.org/cla. CLA has not been signed by users: @Rob4226. After signing the CLA, you can ask me to recheck this PR by posting @cla-bot check as a comment to the PR.

rob4226 commented 3 years ago

@cla-bot check

cla-bot[bot] commented 3 years ago

The cla-bot has been summoned, and re-checked this pull request!

NathanWalker commented 3 years ago

Thank you @Rob4226 !

NathanWalker commented 3 years ago

We'll get this published early next week as we need to double check a few devops settings on the extension.

rob4226 commented 3 years ago

Sounds good, thanks!

benco8186 commented 3 years ago

Hello, what I have to do to update and fix this problem ?

rob4226 commented 3 years ago

Hello, what I have to do to update and fix this problem ?

@benco8186 In the meantime, I posted a build of the extension with this update on the bottom of this comment https://github.com/NativeScript/nativescript-vscode-extension/issues/278#issuecomment-751164788 Just download the vsix file and then install it in vscode.

benco8186 commented 3 years ago

Hello, what I have to do to update and fix this problem ?

@benco8186 In the meantime, I posted a build of the extension with this update on the bottom of this comment #278 (comment) Just download the vsix file and then install it in vscode.

Thank you @Rob4226, I will try that soon

NathanWalker commented 3 years ago

There’s been some permissions issues around the publishing account that we’ve been sorting through with Azure team. We hope it will be resolved this week and can get an update published here. Sorry for the delay and frustration here.