haacked / Encourage

A bit of encouragment added to Visual Studio
75 stars 32 forks source link

Encouragements are scrambled in the JavaScript editor #16

Closed Venemo closed 10 years ago

Venemo commented 10 years ago

When editing and saving a js file, encouragements appear in the same popup thingy as the one used by IntelliSense to display information. When this happens, they are also positioned incorrectly.

Here is a screenshot: http://venemo.net/owncloud/public.php?service=files&t=b09df56aed84f5ebeeb93d1195199ec6

When that thingy pops up, you can only see the encouragement by either clicking on the arrows on it, or by hitting the up/down arrow keys.

jaredpar commented 10 years ago

I played around with this scenario a bit and was unable to reproduce it. Here are the steps that I took

  1. Created a new MVC web project
  2. Opened up jquery-1.10.2.js (a nice big JS file to play in)
  3. Made some edits, saved and noticed the encouragement popped up at the cursor

I repeated 3 a few times and kept getting the same results.

Is there a different way that you are creating the JS file? Is there a specific pattern where this happens?

Also note that the screen shot you attached is pointing out that standard signature overload help is in the wrong position. Maybe I missed it but I didn't see any encouragement popups in the screen shot.

Venemo commented 10 years ago

@jaredpar You misunderstand. The popup I'm pointing to does contain the encouragement, when I click on the arrow on it - like you found out yourself in #15 :)

jaredpar commented 10 years ago

I had some time this afternoon to look at this and this actually appears to be a bug in the Javascript portion of the Visual Studio IDE. What is basically happening here is the following

Their signature provider responds to signature help in the same way. It will take whatever is stashed in the provider and augment the displayed list with it.

The problem here is that Javascript never clears the list stored in their signature provider. Nor do they do any basic analysis like seeing if the signature session is logically close to where the signature help was calculated from. Encouragement works by starting up a signature help session and Javascript happily appends whatever they have stashed around into that list. Hence encouragement ends up displaying a helpful message and javascript signatures. Yikes.

This is also the reason why in your case the signature help popped up so far away from the the caret position. The javascript signatures reported the original location where signature help was provided. For various reasons the editor chose this location over the one Encouragement provided.

Long term here Javascript needs to fix this bug. They need to be clearing their cache on one of the standard events (like dismissal of the signature help session). I will follow up with them and get a bug filed.

Short term we're going to have to work around this problem. I have an idea that I'm going to try out that should fix it.

Venemo commented 10 years ago

Wow, nice!

jaredpar commented 10 years ago

Followed up with the Javascript team and they have filed a bug to fix this behavior. Once it's released I'll remove the relative portions of this change

Venemo commented 10 years ago

Thanks @jaredpar :)