VSCode Debugging with Mocha and ESM Breaking in ESM "compiled" File Instead of Original - visual-studio-code

I've been using the ESM module with VSCode and my Mocha unit tests for a long time now, a couple of years at least. Recently when I launch an individual test file in VSCode and set a breakpoint in the test file, it no longer breaks in the original file, but rather breaks in the "ESM compiled" file. I don't really know how ESM works enough to talk about it very well, but the file is compiled/transpiled/transformed in some way with all the imports converted to non-ESModule code. I'm able to step through, and it continues to step through other files as well, but each new file opened is this newly "ESM compiled" version instead of the original file, like it used to be. I only just noticed this recently. So I decided to install and older version of VSCode and see if it still happened, and it turns out it doesn't. With version 1.45.x it works as usual, but with anything newer, I get all these "ESM compiled" files opening up when I step through code.
Does anyone know why this is happening? Is there any new setting I can set in the newer VSCode versions that would cause this to not happen? It's really more of an annoyance than anything. I can still get my work done, but it's not as streamlined as it used to be. I will probably end up just downgrading permanently until I can find a way to make it not occur in the new version.
So, if anyone has experienced this, or knows of something new in VSCode that would cause this, I'd really appreciate some help. Thanks.

Related

Unity3D 2020 - VSCode - What happened to intellisense?

Overnight, any help I had for Unity3D in VSCode, i.e. intellisense, disappeared. And I get the sense, no pun intended, that I'm not the only one who's afflicted.
I've tried updating and reinstalling what I assumed VSCode needed to make Unity3D intellisense work. And have checked and re-checked settings, reinstalled VSCode package, in Unity3D.
I've worked through a few tutorials that claimed to address the issue.
What else does VSCode depend on to make this relationship work?
Thanks! Here's to hoping you've fixed this and your life has gotten easier!
Try going to Edit > Preferences > External Tools > Regenerate Project Files (This is because of a bug where the VS Code extension doesn't generate the project files correctly the first time, you can check it out here).
You'll need to be using the VS Code Editor Extension 1.2.0 (you can check which version you're using in the package manager) or later for that option to appear. Also if for whatever reason there are 2 .sln files in your project folder (I've had that happen before, though it's less likely), that also causes problems.
Ok. First, thanks to Lightning_A and Charleh!
The resolution to my specific circumstance was to install the VSCode extension "Unity Snippets Modified" https://github.com/with-heart/vscode-unity-snippets
I had been using https://github.com/kleber-swf/vscode-unity-code-snippets.
Perhaps it's just a matter of Kleber's extension, which is/was great, was broken upon updating Unity to 2020? I dunno and don't have the time to look into it, unfortunately.
Hopefully, my question, the answers I received, and my subsequent resolution saves others from the rabbit-hole I went down.
Again, thanks everyone!

Save code after every successful modification in WebStorm

I have been writing some code in WebStorm for a practice project. But the problem is, I have written some code today and the application seems to work fine, then tomorrow when I am writing some more code and the application is catching a bug which I am not able to debug, then I have to start all over again, which is pretty painful.
I would therefore like to save the code while it is working so that if required I can revert back to the last working version. I believe this is called version control and most people use GitHub for this, is it ?
I couldn't find a similar question. Maybe I am not using the correct keywords while searching.

Xcode is marking all symbols as 'undeclared type' yet they are visible and the project compiles fine

Just to get some context here is a screenshot, though you probably gathered this from the title:
Xcode is marking all symbols as undeclared, usually this would be because it doesn't exist or isn't imported, but in this case it was working fine 20 minutes ago and weirdly the project compiles and runs with no problems.
When I compile the errors go away but there is no syntax highlighting, as soon as I start to edit the file the errors all come back. I can work if I remember the exact signatures for anything that I need to use but with the lack of code completion and errors this is very hard.
Notably this is only a problem in a few source files, its not even the whole project. Nothing has changed that I am aware of that could cause this.
Before anyone suggests it, I have tried cleaning, deleting derived data/build folder, restarting Xcode etc...
My colleague is seeing the exact same issue on his machine.
So I managed to fix the offending source files, I just compared their attributes to those of a working source file and it turns out that the problem files included the tests project in their target membership and the working file did not. I'm not sure why this is causing the issue as other projects use automated testing without a problem. Nonetheless this solved it for me, at least until I start writing test cases...

Groovy debugger out of sync

I am having a difficulty while attempting to debug some code in grails. It is difficult to put into text, so I have posted a screencast showing exactly what the problem is here. In short, while I am debugging the debugger starts jumping from place to place and not following the program logic I have in place. The only other similar question I have found is a year old, had no solution, and can be found here.
The best guess I have so far is that the debugger is displaying the text I have typed in, but is actually executing an older version of the class file which it has cached somewhere. Therefore, I tried:
cleaning the project
manually deleting all of the class files from the target folder and from the target-eclipse folder
Searching my entire hdd for additional files with similar names
removing my project from the workspace and re-adding it
closing and reopening the IDE
grails refresh-dependencies
Importing the project into a new IDE (I was using GGTS, I switched to IntelliJ)
None of those solutions had any effect. I realized that the issue was in a .groovy file, and I was writing almost pure Java, so I deleted the .groovy file, and re-created the class in a .java file. That solved my problem. Unfortunately I am having the problem again, and this time it is in a controller that heavily relies on the grails framework, so that solution is not an option. Other than also being in a .groovy file, another similarity is that the code breaks on an if statement.
My next steps:
Verify that the application is not executing the code I see by using print functions to monitor actual execution flow.
comment out the entire function and re-add functionality one line at a time to see if I can see what breaks it.
Delete the .groovy file, and re-create it as another .groovy file.
Any help is appreciated, and since I can't find any answers online I will continue to update this question as I learn more.
See my comment on the jira issue that you raised. You have found a problem with the groovy compiler and how it calculates line numbers. This is not a problem with executing the wrong class files or using a broken debugger. The debugger is doing exactly what it is expected to do. It is the compiler that is providing erroneous line number information.
The next step, as described in the issue, is to provide a simple project that recreates the bug. I tried to do so myself, but could not. So, please supply something that we can work with. Then we can notify the groovy compiler team.

NetBeans PHP code completion for own code

Recently I started using NetBeans 6.7 beta for PHP development instead of Textmate and MacGDBp. I am rather amazed with it's feature set and most everything worked out of the box, or was easily configured to my liking.
I am having an issue with the code completion features though; they work for built-in functions, SPL and some of my code, but not all of my code, specifically, it never works for any methods in my classes, regardless of PHPDoc comments.
I can't seem to find any decent questions, let alone answers about this specific subject anywhere. It looks like everybody else who has problems with the code completion just hasn't enabled the auto-popup feature.
So the big question is:
Is there any way to influence the code completion cache, or something I have to add to my code to make it work? I'd really like to have code completion for the methods I write.
PS: I have tried several older versions of netbeans, they all exhibit the same problem.
edit: I've put a .zip up of my current test project. get it here. It's a very young project, think a day and a half.
edit2: Below is a screenshot of what i'm looking at. As you can see, it fails to complete pretty much anything, nor does it see the PHPDoc documentation.
I've tried opening your project, and the completion seems to be working just fine for me.
The only thing I can think of is to try to delete your entire NB cache, which should be located in $HOME/.netbeans/$VERSION/var/cache/. This is a wild guess
Create a backup first, I didn't try this!
If that fails, maybe you should try creating a new project, maybe that will kick NB in the butt.
Note that in NB 7.2 beta, the cache has moved to $HOME/.cache/netbeans/$VERSION.
What worked for me was deleting the old nbproject folder (that was created in windows) and recreating the PHP project from existing sources. This is on NB 7.0.1 Mac OS X. Clearing the cache did not work for me.
Be aware of #property something syntax. If object something does not exists in your code anymore, NetBeans might have problems with proper code completion. Consider example:
/** in main file: **/
use ABC as _ ;
/** in file ABC: **/
/**
* #property \Something $something
*/
If you do not use $something anymore, NetBeans will most likely generate an exception, thus failing to complete the code.
What worked for me was clearing the cache, then explicitly including some key subdirectories in the Global include path. Appears that for some reason NB 6.7 wasn't recursing the directories.
Including at project level also worked
Project->Properties->Include Path
Netbeans 7.01 + Windows 7
If, for instance, you open a php file with netbeans without being part of a project, code completion doesn't work at all. What you need to do is to create a project having that file in it.
Tested this on NetBeans 7.0.1