The question says it all.
I have bugs in my server-side rendered javascript. I am debugging by going line by line, removing it and see if it compiles. Due to the compile time and evaluation of Nashorn, this is very time consuming. Is it possible to get visibility as to where my code is breaking ?
All I see is:
java.lang.ArrayIndexOutOfBoundsException at /my-page
10
The Nashorn exceptions should have the JavaScript trace. See https://docs.oracle.com/javase/8/docs/jdk/api/nashorn/jdk/nashorn/api/scripting/NashornException.html#getScriptStackString-java.lang.Throwable-
Related
When writing code in cshtml files, sometimes intellisense goes haywire and starts writing text several lines above where I am actually typing. At the moment it seems to be limited to when I hit the tab key to let it finish a property name which isn't too bad because I can just not do that. However, it also seems to happen at other times like just when I type #Model and then press a period it might write the word Model in some other part of the code file.
Anyone know how to correct this?
This would probably fit better as a VS Feedback item, but since this is the only place I have found someone referencing the same issue, I thought I would add some confirmation. I do not have a solution, only more examples to add. This issue has been annoying me for months! It seems to happen most often when typing razor code inside of JavaScript, especially inside of a quoted string.
Here is an example from a test project, where I am attempting to put a reference to a model field into a JavaScript string. Notice that I click tab a couple times and it doesn't actually insert the intellisense result at the point I am typing. But when I scroll down you can see it inserted it randomly in another spot pretty far away!
I did also try to remove the hidden .vs folder, bin/, and obj/ and could still reliably reproduce the issue after restarting Visual Studio. Currently on 1 before the latest (16.9.4). I did notice that if I re-open this cshtml file, wait until the file seems to be fully loaded (all the red errors go away), I also reliably get an ArgumentException that occurs as I begin typing. Then when I scroll down I already see that Model has been randomly inserted in another spot in the code.
I'm going to try updating to latest (16.9.5), and starting in Safe Mode to skip loading all 3rd-party libraries, and see if the issue is still reproducible, in case it is caused by one of the handful of extensions I am currently using.
Edit: Well same issue with 16.9.5. Trying to use Safe Mode is a no go, it makes the intellisense and syntax coloring completely disabled for .cshtml files.
I'm trying to adjust the code formatter in PhpStorm and I can't find what rule is causing a certain re-formatting to happen. In general, if there's some way to know which rules/settings caused a certain change to happen, that would be great for debugging my setup.
The specific issue I'm trying to address is that the formatter is forcing a line break after an in-line comment.
For example, the following code:
array_search($needle, $haystack, /*strict=*/true);
Is being turned into:
array_search($needle, $haystack, /*strict=*/
true);
And I can't find the setting that controls this. Anyone know which setting controls this, or more generally, how to see a log of which rules are being applied so I can debug behaviors like this?
(I'm running PhpStorm 2018.3.5)
As Olga Strizhenko commented, I've confirmed this issue is fixed in version 2019.1.
I've been having a lot of issues with chrome debugger. Sometimes I can't enable breakpoints at certain positions, other issues include random pauses at lines without breakpoints, can't evaluate variables that are absolutely defined.
The most weird thing I've seen, and am eager to work around, is the following:
I reached here from an event listener breakpoint, as one can see in the right pane. At first I put a breakpoint at line 4121 where I want to see what elem is. It can't be evaluated, saying it's undefined.
Now I commented out everything. It still hits the code. Notice the highlighted region. It's not my selection. It's the code that's yet to be executed. The highlight does not make any sense.
What can I do to get better debugging experience?
EDIT: I just tried with Firefox, to my surprise it behaviors almost the same with Chrome (i.e. hit the commented out code). There might be some rational explanations to this.
The information in the Call Stack and Scope panel doesn't match what is in the code where it is paused. Your app is running with a minified version of jQuery, but the uncompressed version is shown in Sources.
You should see the following in those panels if you are running the uncompressed version on it's own. If you use the minified version, you should see what you already have, but the Sources view will show the minified version, unless you have the Source Map configured. Since it appears you commented out the code in the uncompressed version, you're probably not using Source Maps.
Side note: If you do use Source Maps and edit the minified version, you would have to regenerate the map, otherwise the mappings will be all wrong.
That makes me think it's more likely to be an issue caused by having multiple references to jQuery. Make sure you only have one reference to jQuery in your solution, otherwise you can't guarantee which version is loaded at a given time.
If you have made edits to the Javascript in Dev Tools you will need to ctr+s (Save) the edits before you can enable breakpoints.
Is it possible to detect parse errors in an HTML submitted to a WebView, using -loadHTMLString:baseURL:?
Is there a method that can be called when parsing errors occur?
The only possible delegate callback might be this, but I don't think it will give you what you're looking for (it's almost certainly network errors). A quick perusal through the list of possible NSError codes (near the bottom), don't have anything that might relate to your error. It seems you're out of luck here.
If you need to deal with parsing, then you're going to be using a different HTML renderer, such as WebKit or Blink. There are a few frameworks for building native apps that use the WebKit or Blink renderer. One of the most active is called Node-Webkit. While I can't say for absolute certainty that it will expose the parsing that you're looking for, the odds are much higher.
Some others that are similar are appJS and CEF. I like Node-Webkit because it's very simple to set up while also being fairly mature and in rapid development. If it doesn't give you what you're looking for, one of those others might.
Is there any way to achieve that in Aptana (v3.0)? I'm posting this because solution for eclipse does not work in Aptana.
It's annoying that Aptana(Eclipse) returns html errors on partial html code. It's obvious that today noone has full page in one file.
It seems that it's know bug and it's going to be fixed in 3.0.5. Is there anything I can do to turn off those annoying warining before 3.0.5 will be released?
You could add custom error message filters or turn off validation for the specific language all together.