Author |
Topic |
|
jschultz
Junior Member
24 Posts |
Posted - Feb 26 2014 : 8:00:12 PM
|
I'm currently running build 1925 on VS2010, writing C++ code. The surrounding code on which I'm working mentions a local variable called "pChn" on almost literally every line, but whenever I type "pc", the first suggestion by Visual Assist is a macro "PC" that is defined in some header that isn't even included in the particular file I'm working on, and our code doesn't use this macro anywhere. When I type "pch", it is auto-completed to the PCH typedef from WinNT.h instead, which our code also never uses.
Have there been any improvements on the autocompletion code with regards to this issue since the build I'm running, or are there options to improve this bheaviour? It's really annoying and slowing me down quite a bit since I expect VAX to make some remotely sensible suggestions based on the context. In this case, the most sensible solution is the one that's suggested last.
|
Edited by - jschultz on Feb 26 2014 8:09:42 PM |
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Feb 26 2014 : 9:53:01 PM
|
Do you have:
VA Options -> Advanced -> Suggestions -> Include bits of code from surrounding lines
turned On or Off, and does changing this setting make any difference? Normally VA should be paying attention to the symbols you have used recently, and what is used in your local scope, so I am not sure why this is happening here. |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Feb 27 2014 : 06:42:27 AM
|
Interestingly, changing this option didn't seem to help. However, I also noticed that this didn't happen with another instance of the same project in another folder, so I used the rebuild symbol table option, and the problem was gone... for a moment:
After rebuilding the table, I went to that code snippet again, and when typing "pc", VAX only suggested "pChn". To see what would happen, I typed in "PCH" and removed it again. When typing "pc" again, it wouldn't be suggested again at this point. However, after pressing F12 to go to the definition of "PCH", it will permanently stay as the top suggestion. Same would happen when using F12 on that PC macro.
However, after trying to reproduce this behaviour twice, the second time after rebuilding the symbol table, I would instantly get the PC and PCH suggestions again for some reason.
In case you want to try and reproduce this behaviour, the code can be checked out via SVN from http://svn.code.sf.net/p/modplug/code/trunk/OpenMPT/ - solution file is in mptrack/mptrack_10.sln. The header file that includes the PC macro isn't included due to the licensing of the SDK from which this header file originates, but the PCH define from WinNT.h should probably be enough to reproduce the problem. The troublesome code snippet where autocomplete fails is located in soundlib/snd_fx.cpp, around line 250. |
Edited by - jschultz on Feb 27 2014 06:45:01 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Feb 27 2014 : 11:04:23 PM
|
I have downloaded this project via SVN, and using Windows 7, 64bit, VS2010 and VA 2029 I have loaded the project and the file "Snd_fx.cpp".
Going to line 258 I have added the code:
PCH;
pChn;
pc after adding "PCH" I placed the caret into this and pressed F12, and then Ctrl-Tab to return to my editing. This screen shot shows what is happening for me:
VA is working correctly for me. Can you please try upgrading to VA 2029 and see if this makes any difference?
http://www.wholetomato.com/downloads/default.asp |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Feb 28 2014 : 08:20:21 AM
|
The latest version seems to fix the problem indeed. Guess it's time to renew my license then... |
|
|
jschultz
Junior Member
24 Posts |
Posted - Feb 28 2014 : 4:17:52 PM
|
After working a bit more with the latest version, the problem is occuring again for me with the same code. This is really strange... |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Mar 03 2014 : 1:19:07 PM
|
Are you currently able to reproduce this on demand? Is this a consistent problem, or is it somewhat random?
The fact that changing builds of VA, which triggered a symbol database rebuild, fixed this for a little while is interesting. It suggests the rebuild may have been the key factor, not the change of version.
Next time this is happening, can you please stay in the cpp file where you are seeing the problem, then trigger the command:
VAssistX -> Tools -> Reparse Current File
you should not need to reparse the current file like this, but its an interesting test.
Another thing to try is to place the caret into "PCH" and press Alt-G, what options do you get? If you get an entry in your current solution this might offer clues as to what is happening. |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Mar 03 2014 : 1:28:26 PM
|
I think something is going very wrong here. At the moment, it only suggests PC and not PCH, so I typed "pc" and pressed Alt+G. Alt+G points at two lines from sqlite3: Both lines declare an "int pc;" inside a struct. That is obviously not where the PC define comes from. Reparsing the current file sadly doesn't seem to help. After another symbol database cleanup, the problem is gone again, at least temporarily I guess. As soon as this problem appears, it persists for me. It just seems the first occurence of the problem is somewhat random at the moment. As said, at first it didn't appear with the new VAX version, but shortly after I could reproduce the problem again. |
Edited by - jschultz on Mar 03 2014 1:30:01 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Mar 03 2014 : 9:48:34 PM
|
When PC is being suggested, can you please accept it and then place the caret into "PC" and look at the context and definition fields. Also press Alt-g and see what happens.
Did you mean "pc" in lower case? Since C++ is a case sensitive language so "pc" is a different symbol to "PC". |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Mar 04 2014 : 07:03:57 AM
|
Where do I find context and definition fields? Alt+G on PC shows the #defines from iasiosys.h, the original file where it belongs from (Steinberg ASIO SDK). And yes, I did indeed mean pc in lowercase. I pressed Alt+G before accepting, so at that point in time it was still in all lower-case. I guess is was actually intentional to show the "int pc" definition from sqlite3 then. |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Mar 04 2014 : 4:04:42 PM
|
The VA context and definition fields are at the top of the editor window, the context field is where the Alt-M list opens. This should show you the #define that Alt-g is taking you to.
The fact that PC references the Steinbert ASIO SDK is interesting. Is this a 3rd party library you are using? This might be a factor, but it still does not explain why a commonly used local variable is not the default suggestion when typing. |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Mar 04 2014 : 5:01:06 PM
|
Yes, the context/definition fields coincide with Alt+G, i.e. the definition from the ASIO SDK. It's indeed a 3rd party library, but while the SDK is free, redistribution is not permitted, hence it's not included in the SVN. The ASIO SDK is in the include path and it's included from one or two files in our project in total, but certainly not in anything that gets included from Snd_fx.cpp, which makes me wonder why VAX constantly comes up with this suggestion. At least with the PCH define, you can explain that WinNT.h gets included through all the Windows headers, but even there it should indeed not be preferred over a local symbol. |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Mar 04 2014 : 5:15:33 PM
|
To be honest I have no idea why this is going wrong for you. Since the problem appears soon after rebuilding the symbol database this suggests that something VA is parsing, perhaps in your solution, is triggering the problem.
Does this seem to be a file specific problem? If this only happens in a few files, then there may be something further up the file that is confusing our parser. If you show VA Outline, does the outline for the files where you have this problem look correct? How about the Alt-M list, the list of methods in the file?
If something is confusing our parser in the files then one or both of these might be giving the wrong information, with the problems starting at the problem point. |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Mar 04 2014 : 5:26:13 PM
|
The outline looks okay to me, and the problem also arises in other files. Interestingly, in some specific place in another file, "PPC" (also a define from the ASIO SDK) was also among the suggestions, but at least it was the last one in the list. Either way, the problem also seems to happen on another, clear version of the solution, so it's relatively reproduceable for me. I have to accept "PC" or "PCH" a few times for the bug to become effective, but after that, I can accept "pChn" as often as I want, it won't become the default suggestion. |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Mar 05 2014 : 8:49:05 PM
|
Its time to think about log files. Something is going on here, but I have no idea what or why, and nothing we are doing seems to be pinning it down.
Can you please turn on VA logging, then type and accept "pChn" several times in one of your files. This is to make sure that VA has had plenty of time to realise that this should be the default suggestion.
Please then close the IDE, to stop the log files getting any larger. If you can include a couple of screen shots of what you are seeing this would be helpful, to make sure everything is clear.
This FAQ entry explains generating the log files:
https://wholetomato.fogbugz.com/default.asp?W305
Please submit the files via the form:
http://www.wholetomato.com/support/contact.asp
including this thread ID or URL in the description, so we can match it up. |
zen is the art of being at one with the two'ness |
|
|
jschultz
Junior Member
24 Posts |
Posted - Mar 06 2014 : 09:02:37 AM
|
Okay, I sent the logs + screenshot. |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Mar 07 2014 : 12:40:18 PM
|
I have the log files, thank you for these, hopefully they will offer some clues:
case=80757 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|