Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Refactoring suggestions to error messages

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
drzoom Posted - Nov 07 2006 : 08:41:35 AM
Preface: Stupid typos resulting in stupid error messages from the compiler (C++). Sometimes the compiler is somewhat of exact, I start to think like: "If you know the problem already, stupid *#@* compiler, then fix it and don't complain about it..."

Topic: There should be a menu with suggestions how to solve simple problems, reported in the error messages of the compiler. A click to a solution in the menu, is fixing the problem.

Your objections:
  • We had to parse the error messages of the compiler and extract the relevant informations from it.

  • ..but - what about the localized versions of VS. We can't parse all the different languages of error messages.

Some easy error messages:
  • error C2039: 'SetxProg' : is not a member of 'fitting::Holder' Search for similar method names. E.g. setProg

  • error C2143: syntax error : missing ';' before '}' Add a ; behind statement

  • error C2027: use of undefined type 'foo::Bar' Add missing #include

11   L A T E S T    R E P L I E S    (Newest First)
support Posted - Jan 27 2009 : 10:37:31 PM
case=226 is implemented in build 1715
Hover over an unrecognized symbol and choose "Add include xxxx" from the refactoring context menu.

feline Posted - Nov 10 2006 : 08:52:30 AM
There are some issues trying to combine the IDE's macro recorder with VA. The basic problem is that any time VA does something helpful, like inserting a character, this will confuse the macro when it is re-run.

You are right, this "chaining together" is how VA's refactoring is designed, so it makes sense to offer some method of automating this. The real question is how.

I have spent a lot of time in VIM over the years, often writing fairly complex macro's in the process. Based on this experience I can see one of the basic problems with macro's and refactoring. Let us take a very simple example, you want to run Create Implementation followed by Document Method - in the cpp file, on a series of functions.

Taking the simple test function:

void felineComment::setSize(int n);

and sitting on its declaration in the header file, I trigger Create Implementation. So far so good, but now to trigger Document Method I need to move the caret from the body of the new function (where $end$ left it) onto the function name, so that I can trigger Document Method.

Now in VIM this would be relatively easy. Assuming you end up with:

void felineComment::setSize( int n )
{
|
}


You need to issue:
* move up one line
* move up one line
* move to column 1
* move forwards to the first colon on the line
* move right 3 steps
* trigger Document Method

I have chosen to move to the colon since that should be a reliable marker. You cannot rely on a known number of spaces, or brackets, due to complex return types, parameter types, etc.

The IDE does not easily offer "move forward to the first colon on the line" as an operation, not for recording a keyboard macro. At the same time there is no exposed interface to control VA from the IDE's macro programming language.

Perhaps VA can be run by sending the keyboard commands to open and select the correct menu item, from within an IDE macro?

Simply asking for VA to offer a way of chaining together its own refactoring operations is the "easy" way out, until you stop and try to work out how this might work.

I have just about reached the conclusion that we really need a new plugin for "enhanced macro's", just for these sort of operations I did once look into a VI emulating plugin for the IDE, but the mental double talk of years of IDE experience clashing with years of VIM experience just made my brain hurt, so I gave up on that.

Any brilliant ideas would be welcome
sl@sh Posted - Nov 10 2006 : 04:01:28 AM
Apparently I was somehow blinded by the assumption bookmarks were meant to be used for this sort of functionality and didn't realize find in files works much better for my purpose...

With respect to this topic's original intent I agree with Tobias that it would be nice to get assistance with just about all kinds of refactoring. I realize however that any advanced refactoring method would be increasingly prone to errors caused by edge cases.

You keep pointing out that VAX aims at performing the basic steps of editing/refactoring with minimal interaction from the user, and that to get the results people like Tobias are aiming at we should combine some of those steps. Maybe all we'd need would be some kind of macro - a user-defined sequence of VAX invocations. Would that be feasible? (I've got to admit that I'm not very familiar with the VS builtin macro recorder, maybe it already can be used to that end?)
feline Posted - Nov 09 2006 : 11:44:50 AM
I think voids is a little harsh but it does help to explain why something that is a little more interactive, as you type, is a good idea. We already do some things like this.

To find your TODO comments you can always use the IDE's find in files feature. I like the concept of the task list in the IDE, but I don't much like how it works, it tends to be very picky over the formatting of my comments, and sometimes refuses to list my TODO lines, so I often resort to a list of function names in a separate todo list, or just putting bug reports into the bug tracking system and assigning them straight to me.

Having said that, I am not sure that this is within the realm of VA, and I am not quite sure what I would want a program to do which would help me.
sl@sh Posted - Nov 09 2006 : 04:04:08 AM
feline: thanks for the suggestion, but unfortunately I am using VS2003 and it does not provide this feature.

Joe: thanks, that's something I haven't considered. It's certainly better than forcing warnings, but it still leaves me with the problem that I have to recompile the project I am working on to see my 'TODO list'. (This of course also voids my argument against having VAX 'fix' the code as originally suggested in this thread )
jpizzi Posted - Nov 09 2006 : 01:07:10 AM
Instead of inserting something less obvious, why not use
#pragma message("Whatever message you want")
feline Posted - Nov 08 2006 : 10:50:50 AM
quote:
Originally posted by sl@sh

(Unfortunately the VS feature to list TODO tags in comments is limited to file scope which is no help at all in a 300+ files project! Same for bookmarks )


In VS2005 the default behaviour for next and previous bookmark is to jump through the file's, rather than sticking to the current file.

Based on a quick look at the keyboard mapping dialog it looks like the enhanced bookmark handling is VS2005 specific. But I do recall VC6 having a bookmark dialog that listed the bookmarks.

It could be that VS2003 is the most limited of the three, on the bookmark front.
feline Posted - Nov 08 2006 : 10:45:26 AM
Historically we have avoided any "automatic" code editing in the background. All of the changes that VA makes are where you are typing, and are nice and clear / obvious. It is this very concern, VA making what it believes to be the correct fix introduces a subtle or hard to find bug, that lead to this decision.

Certainly we are open to and interested in new ideas, we certainly have not thought of everything

Personally I tend to keep an eye out for the sudden appearance of lots of underlining, or intellisense stopping working. Both are normally caused by a silly typo further up the function that has confused VA's parser.
drzoom Posted - Nov 08 2006 : 04:30:24 AM
The idea is not to fix the problem in the background. It's as well no feature for C++ beginners (hope they don't need or use VisualAssistX). It's more a help for experienced software developers, who want spend more time designing with UML, instead using a lot of time fixing typos in the code.

I'm developing C++ more than ten years. I'm for sure aware about false positives with this error messages. Currently I do a lot of refactoring and redesign. I move code around, renaming methods and variables, rewriting small bits of code. Without VAX, this wouldn't be possible that easy. But every copy/paste action has a risk. E.g. loosing a ;, and every quick rewrite has the risk that you produce typos in methods or variables. If you compile the code afterwards to check the syntax, you already know that's only a lost ; char. So it's safe in this situation to let it add. Still not in the background. On request of the developer.

The hardest thing to get IMO is a missing closing } of a namespace somewhere in a header file. Because most things looking OK for the compiler until the end of the unit.
sl@sh Posted - Nov 08 2006 : 03:58:11 AM
I'd rather not have any program 'fixing' the code behind my back, as IME more often than not the obvious fix is the wrong one, even though it might satisfy your compiler.

I go to lengths to analyse even level 3 warnings, because I learned a long time ago that even 'unimportant' warnings very often point out semantic errors. I even go that far to insert lines that produce warnings in my code to 'label' code fragments that I think are semantically questionable - just to make sure I get reminded there is something I still need to check out. I wouldn't want VA to remove or fix those lines either (Unfortunately the VS feature to list TODO tags in comments is limited to file scope which is no help at all in a 300+ files project! Same for bookmarks )

IMHO the "missing ';'" error is one most frequently encountered by less experienced developers. After 12+ years of C++ development in most cases I now get this error, the cause is something completely different. So having it 'fixed' in the background would likely introduce a semantic error instead - one that would be much harder to catch. The error message might be annoying (I do know it was for me ), but they are easy to locate and fix and it will teach you to type your code more carefully (or use VA Autotext ) which IMHO is a good thing in the long run.
feline Posted - Nov 07 2006 : 11:30:26 AM
I do know how you feel, I have lost track of the number of times I have said, and sometimes shouted this at the compiler

For the first two specific examples VA is actually there to help avoid the error in the first place. Not a member should be picked up and underlined as a mistyped symbol, and the missing semi-colon can be fixed by using autotext more often to insert common constructs.

Suggesting / adding a missing include is an outstanding feature request, just not one that is tied to compiler errors

case=226

Mismatching brackets can be cut down considerably, due to a combination of matching brackets being highlighted and unmatched brackets being highlighted.

Unfortunately a lot of errors are harder to pin down. Quite a few years ago I did a course that required writing a Pascal compiler. I have never looked at error messages the same way since, and I have a lot more understanding of why the compiler can produce such apparently unhelpful or random errors.

One method that I find does help is compiling only the current cpp file, rather than the entire solution. This is normally very quick and easy, and is a good way of catching "silly" errors.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000