Inconsistent behaviors with custom scopes.

已回答

I am not sure to understand how scopes work. Sorry if my question is already addressed somewhere, in this case I did not find it.

The application I am building uses Qt. Thus, several source files are generated by the qt5_wrap_* macros in the build directory, that CLion is aware of.

When running inspection (Code > Inspect Code...) I get reports for those files. Since they are generated I do not want the inspection to process these files. Also, I use Qt UI files, so I don't want inspection to process these files as well.

Therefore, I added a custom scope (Settings > Appearance & Behavior > Scopes), where I excluded the files from the build directory. In my case, the pattern is: !file:cmake-build-debug//*||!file:ui//*

Now to the problems.

This worked well for inspection (the UI and MOC files were not processed by inspection), however this resulted in the editor reporting errors regarding files from the build tree that I include in my project. My guess at that time was that the scope was also used for the code editor. So... Is it? If that is so, how can I indicate to CLion to keep the default scope for the editor and have a separate scope for inspection?

Because the editor was reporting these errors, I decided to Invalidate and Restart CLion. Since then, my editor does not report any error, however, it now seems to refuse to use my custom scope. It always runs with Project Default profile, therefore processing files I want excluded.

Is there something I am missing? Thanks!

 

0

Hi!

Sorry for the late response. Instead of using scopes you can 1) right-click on the folder in the Project View tool window, select Mark Directory as option and select Excluded option or 2) use  'File | Settings | File Types | Ignore files and folders'.

0

请先登录再写评论。