Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Nested libraries/classes & intellisense (Read 2638 times)
Red Baron
Member
***
Offline


Posts: 112
Location: Germany
Joined: Jul 29th, 2015
Nested libraries/classes & intellisense
Aug 30th, 2018 at 1:35pm
Print Post  
Hi,

im using Microsoft Visual Studio Community 2017 Version 15.8.2 and VM 1808.30.4.

First, you should delete all the incorrect version stuff from Tools->Options->Visual Micro. If you cann't do this, you should add a hint to the comment of these proeprties, where to find the correct version. The "about" dialog shows "Arduino for Visual Studio - 1.0". Angry

Intellisense is the main reason why I use VM. It makes program development much easier. But there is a problem if you use classes that are derived from library classes. VM (or VS?) does not scan the library if the header file of the library that is included to the local class header only.
 
libclass .h
Code (C++)
Select All
class libclass {
} 



localclass.h
Code (C++)
Select All
#include <libclass.h>
class localclass : public libclass {
} 



test.ino
Code (C++)
Select All
#include <localclass.h>
// libclass is unknown at this point 


The included project ZIP shows the problem.

You have to include the header file to the ".ino" file too.  But this violates the concepts of encapsulation and hiding. "Toggle Hidden Files" does sove the problem. It only shows libraries that are mentioned in the ".ino" file. The big problem occurs, when you use libraries that depend on other libraries!

When compiling the project there must be something like a deep library scan by VM or VS. The problem disappears. It seems that there are some informations stored in the "temp" folder. For if you clear the folder an reopen the project, the problem reappears.

If there is a bug in one of your files you cannot successfully compile the project and intellisense does not work for this project. You have to debug without support of intellisense. This e.g. may happen when there is a new but incompatible version of a library.

My wish is: do a deep scan every time a project is opened. Scan all the libraries an those they are depending on. If you can't do this add this functionality to "Rescan Toolchain and Libraries".

Kind regards
Red baron


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Nested libraries/classes & intellisense
Reply #1 - Aug 30th, 2018 at 1:49pm
Print Post  
Hi,

I think I have explained before that microsoft introduced a new versioning and installer system common for all visual studio extensions. The management panel is available via tools>extensions and updates. This is where visual micro is installed/uninstalled and incremental updates can be viewed not just for visual micro but all extensions. 

The internal help>about system for visual studio has it;s own, different way to establish a version. You should direct any complaint about the help>about to microsoft thanks.

Since your last complaint about the version i changed the info message for the Major and Minor tools>options versions to clearly state the version can be ignored in this location and that you should use tools>extensions and updates.

I also explained to you that many users don't see the "updates available flag" at the top of the ide so visual micro uses another mechanism to notify major updates every few months via a dialog. This is why we still have tools options.

I am short of time and I would appreciate if we can avoid discussing the version number location again in the future. It also confuses the real purpose of your post which is slightly confusing.

Maybe an option for a full scan when a project opens could be added but it would cause complaints from our many pedantic users so would be an option Smiley

It's also possible that by exploring the shared library project system you can configure VS intellisense to be happier. We try to walk the best line between real arduino compile and vs c++ intellisense. It's a fine balance and the compiler has to be the thing that is right. 

You have stated that "Tools>Toggle Hidden Files" allows intellisense to be happier. That's one of its purposes.

Yes the build fortifies intellisense where it can because vs doesn't know about disconnected non-standard ardyuino magic include paths.

I think you have said that the build cache ensures intellisense remains corrected even after ide restart or re-open project. That, after a build,  intellisense only breaks if you clean the temp build folder or radically change library structure? Is this correct?

In what you have said is there anything you consider was working in previous build that is not now working?

« Last Edit: Aug 30th, 2018 at 1:50pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Red Baron
Member
***
Offline


Posts: 112
Location: Germany
Joined: Jul 29th, 2015
Re: Nested libraries/classes & intellisense
Reply #2 - Aug 31st, 2018 at 1:52pm
Print Post  
Hi Tim,

thanks for your detailed answer. In deed, you changed the comment on the option. I'm sorry, I was somewhat blind.

"You have stated that "Tools>Toggle Hidden Files" allows intellisense to be happier. That's one of its purposes." It may be that I have expressed myself wrong, but "Tools>Toggle Hidden Files" (I think you are speaking about "vMicro>Toggle Hidden Files") has the same problem: nested libraries are not detected.

I did some further tests with the reduced project I added to my further post. The picture shows the problem: "MyIntellisenseTest.foo" is unknown. 
When compiling the project, the waved red lines disappear. If you delete aths.txt" the problem reappears.

You can delete all temp files except "...\.vm_sys\arduino_version.txt" and "...\.vmpreproc\includes_paths.txt". If you leave this files untouched everthing is fine.

If "...\.vm_sys\arduino_version.txt" is absend at project start, all temp files are deleted and you get the error message: 
"Build validation failed for sketch 'VS_Intellisense': Der Zugriff auf den Pfad "D:\Caches\Temp\VMBuilds\VS_Intellisense\esp8266_d1_mini\Release" wurde verweigert. Ide=Visual Micro (No IDE)" (in English: Access to the path "D:\Caches\Temp\VMBuilds\VS_Intellisense\esp8266_d1_mini\Release" was denied").

If you delete folder "..\temp\VMBuilds" it is rebuild at project start and file "...\.vm_sys\arduino_version.txt" is created. At this point, you should create "...\.vmpreproc\includes_paths.txt" too.


Edit: 
There is another fact: (Just a test with the minimized project.)
If you compile a project with a program, that has a syntax error, the waved lines still remain after compiling. If you now press "Rescan Toolchain and Libraries", the waved lines disappear.

If you compile a project with a program, that has an syntax error, the waved lines still remain after compiling. If you now close the project and reopen it again, the waved lines disappear too.

"...\.vmpreproc\includes_paths.txt" is created with the correct content even if there is a compilation error.
« Last Edit: Aug 31st, 2018 at 2:54pm by Red Baron »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Nested libraries/classes & intellisense
Reply #3 - Aug 31st, 2018 at 8:03pm
Print Post  
Hi,

Generally it is correct that after a build intellisense is more accurate. This means that if you add a library that requires deep search to discover includes you MUST either build or #include the required <header> in the .ino.

There should be an automatic routine running that detects changes to .ino code and ensures intellisense is correct based on .ino #includes. This is a simple lightweight routine that does not cause slowness when editing files. Automatically performing deep search would be too slow (but maybe can be a future option for users to enable if they want it).

Your tests of deleting files in the temp folder are not practical and have no meaning. If you want a clean build then click Solution>Clean. If you want to preserve intellisense from the last build then do not use Build>Clean and do not mess with the temp folder.

Quote:
If you compile a project with a program, that has a syntax error, the waved lines still remain after compiling. If you now press "Rescan Toolchain and Libraries", the waved lines disappear.


I will look at this, I suspect that the wavy lines would disappear eventually but vs 2017 is not perfect yet.

Quote:
If you compile a project with a program, that has an syntax error, the waved lines still remain after compiling. If you now close the project and reopen it again, the waved lines disappear too.


Same as previous point. More likely to be a vs refresh issue but I will try it over the next couple of weeks
  
Back to top
IP Logged
 
Red Baron
Member
***
Offline


Posts: 112
Location: Germany
Joined: Jul 29th, 2015
Re: Nested libraries/classes & intellisense
Reply #4 - Sep 2nd, 2018 at 8:35pm
Print Post  
Hi,

it is sometimes necessary to delete the temp folder because a lot of crap accumulates there over time.

I'm fine now for I know an easy workaround: Compile an "Rescan ...".

Thank you for your patience
Red Baron
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Nested libraries/classes & intellisense
Reply #5 - Sep 3rd, 2018 at 11:08am
Print Post  
Great thanks

Build>Clean is best way to delete the temp then Build.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint