Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 No autocomplete on array elements
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Zeblote
Tomato Guru

183 Posts

Posted - Jun 03 2018 :  11:09:48 AM  Show Profile  Reply with Quote
Just tried adding something here:





Without an array I see tons of stuff:


Edited by - Zeblote on Jun 12 2018 1:40:42 PM

Zeblote
Tomato Guru

183 Posts

Posted - Jun 03 2018 :  11:16:16 AM  Show Profile  Reply with Quote
I'm pretty sure autocomplete has worked properly on arrays in other places, so this is strange.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3277 Posts

Posted - Jun 04 2018 :  03:50:22 AM  Show Profile  Reply with Quote
Is there any macros that generate code before this piece of code, in the same file?
Can you please check if this still works in other places so we know if something above this code confuses our parser OR we have trouble parsing TArray now?
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jun 12 2018 :  1:34:53 PM  Show Profile  Reply with Quote
I've tested in a lot of other files and it looks like autocomplete for TArray elements has completely broken.

. to -> correction on arrays of pointers is broken aswell.

Edited by - Zeblote on Jun 12 2018 1:36:56 PM
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jun 12 2018 :  1:38:17 PM  Show Profile  Reply with Quote
This isn't limited to only TArray, I don't get autocomplete on std::vector elements either.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jun 12 2018 :  3:26:11 PM  Show Profile  Reply with Quote
Can you please add the following simple test code to a new, blank cpp file in your solution, and see what happens?

class simpleFelineTestClass
{
public:
	int m_nSize;
	 
public:
	simpleFelineTestClass() { m_nSize = 1; }
	simpleFelineTestClass(int nSizeOne, int nSizeTwo) { m_nSize = nSizeOne + nSizeTwo; }
	void simpleMethodImplementation() { }
	void simpleMethodTwo() { }
	void simpleMethodThree() { }
	void simpleMethodFour() { }
};

void simpleVectorAccess()
{
	std::vector<simpleFelineTestClass> felineVector;
	// test - type dot on the next line for a listbox of class members
	felineVector[0];
}

The reason for trying this in a new blank file is to see if the problem is related to something further up the files, or one of your include lines. If you get the same problem, can you please try making a new, default C++ project, and see what happens if you try this code there? This will tell us if the problem is solution specific or global to your machine.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jun 12 2018 :  3:47:36 PM  Show Profile  Reply with Quote
It looks like autocomplete on that vector works in a new solution, but not the one generated by unreal.
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jun 12 2018 :  6:44:54 PM  Show Profile  Reply with Quote
In case this has something to do with it, I still have intellisense off (disable database true)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jun 13 2018 :  4:30:34 PM  Show Profile  Reply with Quote
Are you using a customized version of Unreal, or are you using the standard unreal engine?

Can you please open the two solutions at once, so you can do some simple side by side comparisons? Is VA showing the same information in its Context and Definition fields as you move through this simple sample code?

What about what is shown / offered in the Alt-Shift-G menu on the type "vector"?

It is as if there is another type / definition of std::vector that is at work in your unreal solution. I have tried here in a very simple unreal project, and the test code works as expected for me. So simply having unreal involved is not enough on its own to trigger this bug.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jun 13 2018 :  7:11:50 PM  Show Profile  Reply with Quote
It's a custom build branched off 4.19.2-release, but no major changes that would affect this.

Opened the 2 solutions at once, unreal to the left:


First observation is that the color of "vector" is different in the unreal one.

Left:

Right:


Left:

Right:


Left:

Right:


Left:

Right:


Though, even if there is another definition of std::vector, how would that break autocomplete for TArray?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jun 14 2018 :  08:21:36 AM  Show Profile  Reply with Quote
Interesting, I did not test TArray at first, just std::vector, rather rashly assuming that the two would behave the same here. I am seeing the TArray problem, but not the std::vector problem. I want to run some tests on TArray, just to make sure I am not doing something silly here in my test before putting in a bug report.

What are the other declarations of vector? The fact that vector has a different colour, and more than one declaration does suggest this could be part of the problem.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jun 14 2018 :  10:08:01 AM  Show Profile  Reply with Quote
Is from one of the engine plugins, it has a dependency on boost which forward declares it for unknown reasons.


Go to Top of Page

ChrisG
Whole Tomato Software

USA
220 Posts

Posted - Jun 14 2018 :  4:16:54 PM  Show Profile  Reply with Quote
I was able to reproduce the issue and have opened case 117081.

Thank you for the report.
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jul 14 2018 :  3:46:03 PM  Show Profile  Reply with Quote
This is very strange, in my 4.20 test install the autocomplete on array members works properly. In my project on 4.19 it doesn't.

Edited by - Zeblote on Jul 14 2018 3:46:19 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jul 16 2018 :  11:02:15 AM  Show Profile  Reply with Quote
In the solution where you are having this problem, can you please create a new empty text file called "va_stdafx.h" and make sure this file is in the same directory as your .SLN file. There is no need to add this file to the solution, VA knows to look for this file, and if it is found, it is parsed before we parse anything else.

Edit the file, and add the code:

template<class ElementType, class _A>
class TArray
{
public:
    ElementType& operator[](int32 Index)
};

making sure that the file ends with a blank line. Now press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE.

This should fix the problem for you, it works here in my tests.

I am not sure why this works in one place and not the other, but it does suggest some changes to the TArray class that might be helping VA to parse it more successfully.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Jul 16 2018 :  12:11:32 PM  Show Profile  Reply with Quote
Looks like that works!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jul 16 2018 :  1:01:56 PM  Show Profile  Reply with Quote
Excellent news, thank you for the update.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 19 2018 :  07:35:28 AM  Show Profile  Reply with Quote
Btw, do you have a collection of all these hints to put in the file somewhere? I just found some for TMap in another topic by accident.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Sep 19 2018 :  07:49:22 AM  Show Profile  Reply with Quote
If you have the time can you please try deleting all Unreal Engine fixes from your current va_stdafx.h file and replacing them with the following block of fixes. This set of fixes is still a work in progress, but it is working well in my tests, and a couple of other users are seeing good results with it.

You will need to trigger a VA symbol database rebuild before these fixes will take effect,

VA Options -> Performance -> Rebuild symbol databases

I would be very interested in knowing how well this works for you, and if it breaks anything, and any other cases that you are encountering that this does not yet fix:


// va_stdafx.h Colin Unreal Engine fixes
// Version 2.2
// fixed dot converted to -> on iterator over TMap of pointer type

// helps ranged for loop iterate across TMap
template<class KeyType, class ValueType>
class TTuple
{
public:
	KeyType Key;
	ValueType Value;
};

// so that for ranged-loop works correctly when TTuple key is a pointer
// the iterator is still returning the TTuple, not the pointer key
template<typename ContainerType, typename ElementType, typename IndexType>
class TIndexedContainerIterator
{
	ElementType operator* () const;
};

template<class ElementType, class _A>
class TArray
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	typedef TIndexedContainerIterator<ElementType, ElementType> const_iterator;
	typedef TIndexedContainerIterator<ElementType, ElementType> reverse_iterator;
	typedef TIndexedContainerIterator<ElementType, ElementType> const_reverse_iterator;

	// iterator access
	iterator begin();
	iterator end();
	const_iterator cbegin() const;
	const_iterator cend() const;
	reverse_iterator rbegin();
	reverse_iterator rend();
	const_reverse_iterator crbegin() const;
	const_reverse_iterator crend() const;
  
public:
	// data access
	ElementType& operator[](int32 Index);
};

template<class ElementType, class _A>
class TArrayView
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	iterator begin();
	iterator end();
};

template<class ElementType, class _A>
class TChunkedArray
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	iterator begin();
	iterator end();
};

template <class ElementType>
class TDoubleLinkedList
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	iterator begin();
	iterator end();
};

template<typename ElementType, typename Allocator>
class TIndirectArray
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	iterator begin();
	iterator end();

public:
	// data access
	ElementType& operator[](int32 Index);
};

template<typename ElementType>
class TLinkedList
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	iterator begin();
	iterator end();
};

template<class KeyType, class ValueType, class _A, class _S>
class TMap
{
public:
	// required since the member TIterator class has a different pair API
	// uses functions not exposed members, unlike the STL style iterator below
	// BUT also overloads -> to access Key and Value as members
	template<class KeyType, class ValueType>
	class TIterator
	{
		KeyType Key();
		ValueType Value();
		TTuple<KeyType, ValueType> operator->() const;
	}
	TMap::TIterator<KeyType, ValueType> CreateIterator();
	TMap::TIterator<KeyType, ValueType> CreateConstIterator() const;
	TMap::TIterator<KeyType, ValueType> CreateKeyIterator(KeyType InKey);
	TMap::TIterator<KeyType, ValueType> CreateConstKeyIterator(KeyType InKey) const;

public:
	// STL style iterator movement - ranged for loop
	typedef TBaseIterator<TTuple<KeyType, ValueType> > iterator;
	iterator begin();
	iterator end();
};

template<typename ElementType, typename KeyFuncs, typename Allocator>
class TSet
{
public:
	// iterator movement
	typedef TIndexedContainerIterator<ElementType, ElementType> iterator;
	iterator begin();
	iterator end();
};

template<class KeyType, class ValueType, class _A, class _S>
class TSortedMap
{
public:
	// required since the member TIterator class has a different pair API
	// uses functions not exposed members, unlike the STL style iterator below
	template<class KeyType, class ValueType>
	class TIterator
	{
		KeyType Key();
		ValueType Value();
		void RemoveCurrent();
	}
	TSortedMap::TIterator<KeyType, ValueType> CreateIterator();
	TSortedMap::TIterator<KeyType, ValueType> CreateConstIterator() const;
	TSortedMap::TIterator<KeyType, ValueType> CreateKeyIterator(KeyType InKey);
	TSortedMap::TIterator<KeyType, ValueType> CreateConstKeyIterator(KeyType InKey) const;

public:
	// STL style iterator movement - ranged for loop
	typedef TIndexedContainerIterator<TTuple<KeyType, ValueType>, TTuple<KeyType, ValueType> > iterator;
	iterator begin();
	iterator end();
};

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 19 2018 :  08:43:47 AM  Show Profile  Reply with Quote
Hmm. The arrays are working perfectly, but a range for on a TMap thinks I'm still working with the map itself:

Map:


Attempting to iterate it shows autocomplete as if Entry was a TMap, but it should be a const TPair<Key, Value>&:



Edited by - Zeblote on Sep 19 2018 09:24:39 AM
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 19 2018 :  09:31:37 AM  Show Profile  Reply with Quote
Also, VA does not realize that TPair has .Value and .Key when I write it explicitly:

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Sep 19 2018 :  11:07:36 AM  Show Profile  Reply with Quote
Thank you, this is exactly the sort of testing I am looking for. I will post updated versions of the file as I work out what to do about these, but please do post any further problems you spot.

There is currently a problem with Unreal Engine using pointers to smart pointers internally, but this is something I cannot work around with va_stdafx.h, but we are working on a fix inside VA for these cases.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 23 2018 :  8:30:47 PM  Show Profile  Reply with Quote
For some reason there's no autocomplete on this array even with your new hint file.

Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 23 2018 :  11:37:18 PM  Show Profile  Reply with Quote
This seems to keep breaking itself. Autocomplete has broken on all arrays again. I didn't change the hint file since your last post...

Edited by - Zeblote on Sep 23 2018 11:52:09 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Sep 24 2018 :  06:27:07 AM  Show Profile  Reply with Quote
This is strange. Lets start with the basics. I am testing VS2017 with VA 2283.2, running under Windows 10. From the Epic Games Launcher I am currently using Unreal Engine 4.20.3.

I have downloaded the Sample RPG game from here:

https://www.unrealengine.com/marketplace/action-rpg

and I am placing my test functions into the file "RPGAssetManager.cpp". This way I have a sensible test project to work with, and I can build the solution in Visual Studio to make sure that my test samples are valid, and work correctly.

I am only loading one instance of the IDE at a time. I am testing with version 2.2 of the va_stdafx.h file, which is in the same directory as the "ActionRPG.sln" file.

To test basic arrays, I have the following test code:

// array access forum thread tests
// Feline is doing all tests with:
// VA Options -> Enhanced Listboxes -> Source of C/C++ content = Visual Assist
void forumUnrealTesting()
{
	TArray<FVertexToCreate> VerticiesToCreate;
	VerticiesToCreate.SetNum(8);
	// VA shows listbox on dot on next line
	VerticiesToCreate[0];

	// testing the type its self
	// Test - Alt-g on the type takes you to the file "EditableMeshTypes.h"
	// Test - show VA Outline, place keyboard focus into the editor
	// now hover the mouse over the type "FVertexToCreate" and the bottom section
	// of VA Outline shows the structure details, listing 4 members
	FVertexToCreate testVertext;
	// Test - type dot on the next line, listbox with 4 items appears
	testVertext;
}

Do you see any obvious differences between my test situation and your situation? The fixes in the va_stdafx.h file should not stop working, but if they are, we need to figure out why and fix this first, since until that has been fixed, there is no point in trying further changes to the va_stdafx.h file its self.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 24 2018 :  08:12:18 AM  Show Profile  Reply with Quote
Hmm. I'm using VS 15.8.5 on the latest windows 10. Differences I can think of:

- I'm using a source build of 4.20.3, the generated solution may be different from launcher builds
- I often regenerate the project files while VS is open, to add new files and stuff, then click "Reload" or "Discard" in VS to load the new sln
- I have intellisense disabled completely
- My va_stdafx.h file is in a .va folder
- I added things to the top of the hint file:

#define BRICKADIA_API
#define BRICKADIAEDITOR_API
#define BRICKADIAOPENSSL_API


I let VA reparse everything to make sure, then pasted your code snippet to the end of one of my files, the result is:
- No autocomplete on the array element
- Alt+g works
- VA outline doesn't seem to care about me hovering or clicking on the type, still shows the file overview
- Autocomplete on single struct works
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Sep 24 2018 :  08:54:27 AM  Show Profile  Reply with Quote
When you say your va_stdafx.h file is in a ".va" folder, what else is in this folder along side the va_stdafx.h file? VA only looks for the va_stdafx.h file in the same directory as the .SLN or .VCXPROJ files. So if the va_stdafx.h file is not where VA is looking for it, then it will never be found, and never be parsed. So have you ever seen the va_stdafx.h file work and help you?

Is there a problem with putting the va_stdafx.h file into the same directory as the .SLN file?

Building Unreal from source should not matter, but it may have an effect if your source tree needs different fixes to the default source tree I am testing on and developing fixes for.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Sep 24 2018 :  09:31:28 AM  Show Profile  Reply with Quote
I have now tested the other two bugs you mention, using the code from your screen shots, and so far I cannot reproduce these problems either. I am wondering if your va_stdafx.h file has ever been noticed and parsed by VA. This would explain why you are still seeing these problems.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 24 2018 :  10:48:41 AM  Show Profile  Reply with Quote
Hmmmmmmm. That's interesting. I can't remember why I thought having the file in a .va subfolder would work, and now that I'm searching for it, nothing suggests that it does. Moved it back to the root folder.

After restarting vs and reparsing all files, autocomplete on arrays worked great! It even knew about the .Key / .Value on map entries.
After restarting vs a second time, it's broken again.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Sep 24 2018 :  11:36:42 AM  Show Profile  Reply with Quote
The va_stdafx.h file should be stable. More than this, to remove or replace the entries that the file sets you have to rebuild VA's symbol database. So simply restarting the IDE, without doing a symbol database rebuild, should not remove the help this file provides...

A couple of tests. First, can you add, or find, and instance of the class name "TMap" in your code please, and press Alt-G on it. What happens? You should get a listbox showing two possible definitions of this class. One in "Map.h" and one in your "va_stdafx.h", showing the full path to this file.

This should tell us if VA is still aware of and trying to use the "va_stdafx.h" file and the help it provides.

How many instances of the IDE do you have open? Can you please look in task manager and see if there are any extra instances of "devenv.exe" running?

To make sure that different instances of the IDE cannot interfere with each other VA has a separate database for each instance. So, the following theory would explain what you are seeing.

* you trigger a VA symbol database rebuild, and close all instances of the IDE
* open instance 1 of the IDE, and va_stdafx.h is read into the symbol database for this instance
* closing the IDE does not close it
* reloading the IDE is taken to be instance 2, but due to something, perhaps project being rebuilt, the va_stdafx.h file has been removed from the hard drive.
* symbol database is build for instance 2, but since there is no va_stdafx.h, none of the fixes take effect

It's not exactly straight forward, but off the top of my head it's the only way I can think to explain what you are seeing.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Sep 24 2018 :  2:53:11 PM  Show Profile  Reply with Quote
Yes, I did click rebuild symbol database then restarted vs after changing the file (that's what I meant by reparsing all)

I can see the 2 things:


I always only use one instance of VS per project, though sometimes I might open a different project (not using unreal engine) in the background. This shouldn't affect VA, right?

Just did another test:
- autocomplete on array is currently broken
- click these buttons
- close vs
- make sure vs is really closed
- open vs (parses all files)
- autocomplete on array works
- close vs
- make sure vs is really closed
- open vs (does not parse all files)
- autocomplete on array is broken
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000