T O P I C R E V I E W |
MikMik |
Posted - Nov 16 2021 : 06:24:22 AM Hi, I've found today that "Create File" either doesn't show (for example, if the cursor is inside a function definition) or it shows and does nothing.
Any ideas how to solve this? Thanks |
16 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Nov 24 2021 : 11:18:44 AM Spam filters strike again. We all need them, but sometimes they do hide important things.
Just so you know I have just replied via email with some more thoughts and information. |
MikMik |
Posted - Nov 24 2021 : 02:51:38 AM I already sent an email with the logs. Did you get a chance to take a look at them? Were they helpful at all?
(Just after sending this message I've seen your reply went to the spam folder. Sorry) |
feline |
Posted - Nov 19 2021 : 07:09:49 AM As for Create File in the Alt-Shift-Q menu, it isn't always offered for me, but this makes sense since the idea of this menu is to offer the most relevant commands based on the caret position in the file, and if you are inside a function, especially if the caret is inside a symbol, this seems a less immediately relevant command. |
feline |
Posted - Nov 19 2021 : 07:06:27 AM Would it be possible to get a copy of just the VCXPROJ files that seem to be the trigger, without any of your code?
I appreciate getting files is often not possible, but since it seems like code files are not actually required to try and reproduce this, I thought it was worth asking on the off chance. If this is possible please send me the files via email:
[email protected]
including this thread ID or URL in the description, so we can match it up.
Another thing to try is VA logging. Once you have triggered this, in a relatively simple situation, can you please enable VA logging, reproduce the problem a couple of times, and then closing the IDE, to stop the log files from getting any larger. This page explains turning on logging and where the generated log files go:
https://docs.wholetomato.com/default.asp?W305 |
MikMik |
Posted - Nov 18 2021 : 12:28:18 PM I've done some further tests, by opening the whole solution and unloading projects. I've seen some interesting things, but I haven't been able to tell if any one project is the culprit. For example, with two or three projects loaded (projects that don't depend on any of the unloaded ones), at one point Create File has stopped working in just one of the projects, but not the others (those where it worked depend on the one where it didn't). Then I've loaded another project and all its dependencies (5 or 6 projects more) and after a build or a rebuild, Create File has stopped working in all the projects of the solution, including the ones from the first test where it worked...
So it seems like we have something in our projects that is confusing VA...
|
MikMik |
Posted - Nov 18 2021 : 11:26:52 AM My projects are .VCXPROJ files, most of them updated throughout the years to newer versions of Visual Studio.
I've done a quick check of loading only one project, by renaming the solution file. It seems to be working correctly. I haven't had the option to do a long test, but it seems to work (Create from usage too, BTW).
(Side question: should Create File be shown when pressing Shift+Alt+Q inside the body of a function? It is not showing... But otherwise, it works) |
feline |
Posted - Nov 18 2021 : 07:36:17 AM The project type, dll vs exe should not matter, but the fact that this seems to be project specific is very interesting.
Can you please try identifying the project in question? First a simple sanity check, what file extension does the project file use? Normal C++ project files are .VCXPROJ files, but other project extensions / types do exist. So if you are using a different project type this might help to explain things.
Simply opening the project on its own opens the full solution for me, so I assume you will see the same thing.
To open only the project without the full solution I need to copy the project directory tree to a new location. The projects in my main test solution are in different directories, making this fairly easy to do.
Can you try the same thing please, and see if you still see the problem? I am trying to separate out the project from the rest of the solution, to try and locate the source of the problem.
As for the directories, apologies for not explaining better.
Assume you have a solution placed in:
C:\my_solution which contains:
C:\my_solution\project_one
C:\my_solution\project_two
C:\my_solution\boost
if you go into VA options and set one of the stable include directories to be:
C:\my_solution\boost
then you have overlap between the location of the stable include directories, which should not change much, and the solution, which is being edited. This can cause some confusion for VA. It is rare this happens, but worth asking since you are seeing odd behaviour.
It doesn't sound like this is happening for you though, which is something. |
MikMik |
Posted - Nov 18 2021 : 03:00:58 AM quote:
Just trying this specific file for now, since it looks like a useful test case, if you go to the very top of the file and make sure you are sitting on a blank line, can you trigger the command there?
No, I cannot. It shows the option in Shift+Alt+Q, but it does nothing... Also, I've tried several files in the same project and it does not work in any of them. I've tried other projects in the solution, and it works in some but not in most. From what I've seen, it is only working in the executable projects, not the dlls. Could it have something to do with some props file or something?
quote:
Is your solution sitting on a local hard drive? A network share?
Are you using junction points in the Windows file system? These should not matter, but I am trying to think of anything that might make some of your files "odd" and this upset create file.
My solution is in the hard drive and I'm not using junctions, as far as I know.
quote:
If you check your stable include directories in:
VA Options -> C/C++ Directories
do your solution files live in or under the stable include directories? VA does not expect your solution and your stable include directories to overlap, so this is a possible factor.
I'm not sure I understand the question. If I open the C/C++ directories tab in VA Options I see a list. With "Project Defined" and "System include files" selected I get first all the Microsoft and Windows directories and then mine. If I change to "source files" I only get Microsoft and Windows directories. And if I select "Custom" for "Platform" the list is empty |
feline |
Posted - Nov 17 2021 : 12:06:26 PM Just trying this specific file for now, since it looks like a useful test case, if you go to the very top of the file and make sure you are sitting on a blank line, can you trigger the command there?
Is your solution sitting on a local hard drive? A network share?
Are you using junction points in the Windows file system? These should not matter, but I am trying to think of anything that might make some of your files "odd" and this upset create file.
If you check your stable include directories in:
VA Options -> C/C++ Directories
do your solution files live in or under the stable include directories? VA does not expect your solution and your stable include directories to overlap, so this is a possible factor. |
MikMik |
Posted - Nov 17 2021 : 07:34:51 AM When I say sometimes, is with some files... But it is in my own files, so with all the dependencies and everything I haven't been able to find the problem... For example, I have two lines of code. In the first one, Shift+Ctrl+Q shows Create File (but it doesn't do anything), but in the second, it doesn't even show it:
In both of them, it is greyed out if I open the Visual Studio context menu and select "Quick actions and refactoring (VA)" or in the IDE menu.
In this particular file, it doesn't seem to work at all. Shift+Ctrl+Q shows it sometimes, but it doesn't open the dialog, and in the IDE menu it is greyed out. I've tried in the first line, the last, several points in the middle... |
feline |
Posted - Nov 17 2021 : 06:34:01 AM When you say sometimes, when it is not being offered, if you wait a couple of seconds without moving the keyboard cursor, and try again, is it then offered?
What about moving the keyboard caret in the file and then trying, without changing the current file?
What about changing file and then changing back again?
I am trying to get a sense of what might be going on here. If the problem is caret position in file dependent then this is rather different to timing dependent.
Do you have any situations where the problem is reliably reproducible? Or does it always seem to be random in nature? |
MikMik |
Posted - Nov 17 2021 : 01:54:49 AM It's good news that you could replicate the bug! In that simple case I'm seeing the same. Create File is offered in the IDE menu. But in my "real" files, sometimes it doesn't... Also, at times the option is shown via Shift+Ctrl+Q, but when clicked it doesn't do anything. Unfortunately, I haven't been able yet to create a simple example that reproduces this problem. |
feline |
Posted - Nov 16 2021 : 11:54:44 AM I am seeing the same effect here. For me this only effects the refactoring context menu, accessed via Alt-Shift-Q. Create File is being offered in the IDE VAssistX menu for me in this case.
It turns out even a single space or tab is enough to "fix" this problem. It is unusual to see a bug that appears or disappears with a single white space character! I have put in a bug report for this:
case=146422 |
MikMik |
Posted - Nov 16 2021 : 10:46:46 AM I think I've found a minimal example that shows the error. I've created a new *.h file with the following contents:
// START OF FILE ------------------------------- #pragma once
typedef int myint1, myint2;
// END OF FILE---------------------------
Above the typedef CreateFile is shown correctly. Below it, I only get "Modify Expression" when pressing Shift+Alt+Q.
Also, if the typedef only has one new type ("typedef int myint1;"), it works correctly.
And, funnily enough, I've tried converting the typedef to using clauses. There it fails after the first "using". But any comments "reset" the correct behaviour:
//--------- #pragma once
using myint1 = int;
// Between the first "using" and this line, it doesn't work. After the comment, it works (up to the next "using")
using myint2 = int;
// END OF FILE -------------
|
MikMik |
Posted - Nov 16 2021 : 10:30:16 AM I'm using Visual Studio 2019 Enterprise (16.11.6) and the last version of Visual Assist (VA_X.dll file version 10.9.2435.0 built 2021.10.28).
With "inside a function definition" I meant in the function body, sorry...
I've now managed to make it work, in some cases. I've deleted the cache and rebuilt the symbol database. However, it doesn't show always. I've tried with the caret at several points in a file and it works at some but not all of them.
I'm not sure if it should work when the caret is on a symbol, on a typedef declaration, inside an enum between two values, etc.
But I've found a funny behaviour:
At this point, it doesn't show the option:
If I insert a new line, for a split second, it does show the option (press Enter and immediately press Shift+Ctrl+Q). But if I wait just a second, it does not show it:
It seems like the moment it parses the change, it gets lost.
|
feline |
Posted - Nov 16 2021 : 08:23:27 AM Which IDE and version of VA are you using?
When you say "inside a function definition" what do you mean? I have tried this in C++, in both a header and cpp file, with the keyboard caret in white space at the top of the file, inside a function name on an implementation, inside the implementation (function body) with the caret in white space, inside a comment, and inside another function call.
I have tried the same basic positions inside a header file, and again Create File is always being offered.
If you add a blank line at the top of the file and place the caret here, does this make any difference? I am asking this since it makes sure that nothing, including any #include statements further up the file will be confusing VA and stopping us offering Create File in this test. |
|
|