Author |
Topic |
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 05 2012 : 3:48:40 PM
|
Suppose I'm adding a new function:
int foo(int x)
{
x = new_function(var1, var2);
}
new_function doesn't yet exist, so it's highlighted in an error state. Now, suppose I move the caret down to:
int foo(int x)
{
x = new_function(var1, var2);
}
|
And I start typing "int ne" for "new_function". Since the unknown token above was already identified as being unknown, how about providing it in the auto-complete list when I begin typing "n" in "ne" after the whitespace? Also, if there are are prototypes that could be parsed, such as knowing var1 and var2 are both known (such as ints), then provide an option with "new_function()" and another with "new_function(int var1, int var2)".
Best regards, Rick C. Hodgin
|
Edited by - foxmuldr on Jun 05 2012 4:03:22 PM |
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 06 2012 : 10:23:03 AM
|
The Create From Usage refactoring is designed to help here:
http://www.wholetomato.com/products/features/createFromUsage.asp
given the code sample, we have no way of knowing if this is a new valid function that you are going to create soon, or a typing mistake. If we add every unknown / partial symbol you type to the list of known symbols, then we risk filling the list up with parts of function names, and invalid versions of known functions.
Personally I sometimes insert a function call like this, since I know the parameters, before looking up the correct name for the function. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 08 2012 : 2:17:30 PM
|
It should only contain a list of recently added unknown items (such as those with a lifespan of some programmable value (default 45 seconds) or less since their initial find). Anything older than that is not included. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 08 2012 : 9:18:26 PM
|
What are you trying to achieve here? In your first post you are talking about suggesting both the function with two parameters, but also other possible overloads. We are going to have to make this a known unknown function, if that makes sense, to start tying to work out possible overloads.
Given the caret position it looks like you might be about to type the declaration or implementation of the new function, but this is what Create From Usage is designed to do, including working out the types of any parameters. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 11 2012 : 1:33:29 PM
|
Only thing I'm after is auto-population of a recently typed token that wasn't found, one recent in editing.
If the token has parameters then I wouldn't mind it just pulling those through as they are (inserting "new_function(var1, var2)" into the auto-population list as a separate option above/below "new_function" by itself, but if they are known (by backing the var1 to its root variable type), then pulling it through properly expanded in that way).
Some reasoning: 1) I may already have some code in the clipboard I don't want to overwrite by copying the new function's name. Might even be the code I'm going to stick in that function. 2) It saves me from having to remember exactly what I typed with case sensitivity and all. 3) It's a speedup, the whole reason we use VAX, right? :-)
The recently typed unfound token can appear in all auto-populate lists. The location of the caret above is an arbitrary location I chose, but would prefer an option somewhere to include recently unfound tokens (yes/no) and a lifespan to remember unfound tokens (number of seconds, default to 45, maybe 60).
In this way, all unfound tokens appear available for 45 to 60 seconds from the last time they were referenced in code, because maybe I'm typing:
if (myNewFunction(x)) else if (myNewFunction(y)) else if (myNewFunction(z))
And before I get around to writing myNewFunction(), I need to reference it in code those three times. The first one's not found, but the second and third could be auto-populated from a list.
Just a thought. I believe it would be useful. Cheers. |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 11 2012 : 1:41:25 PM
|
BTW, I think VAX is awesome. I keep buying renewals and use it daily because of it. We had discussed some years back adding a VAX API where we (3rd party DLLs) can write code that accesses certain bits of data VAX has parsed.
I don't know if it ever came about, but if it did I'd be happy to code this myself. And if not, maybe you could reconsider adding that DLL extension? I'd be happy to discuss how it could work, show you a sample framework I have in mind, etc. All for free. :-)
Take care, feline. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 12 2012 : 12:05:08 PM
|
Your if, else if code sample finally explains what you are trying to achieve here, thank you for that. I am wary of this, since we can have enough fun keeping track of the actual symbols in the solution, since we already have to forget symbols when you delete or rename them during normal editing. Adding a new class of temporary symbols might work, but might also just cause confusion.
You mention wanting to keep the clipboard content, are you aware of VA's clipboard history menu? This is designed to help in exactly this sort of situation:
http://www.wholetomato.com/products/features/clipboards.asp
You can add several more items to the clipboard without loosing the current content. A feature I tend to use a lot, and rely on quite heavily |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 12 2012 : 4:31:29 PM
|
Nope, was not aware of VAX's clipboard feature. Thanks! I bet I'm only using 10% of VAX. :-( Do you have a YouTube tutorial video on what's available and a brief example of how to use each feature? "Hi, I'm here today to show you some of the many features of Visual Assist X, the multi-faceted tool designed to improve your Visual Studio development experience and make you more productive..."
PS - I'd still like to have the temporary symbol ability. When writing new code I run into this situation at least 30 times a day, and every time I do I think to myself, "Ugh! Why isn't this feature available?" :-) And then my mind goes off on a small tangent about how I'd write it were I to ever do so. LOL! Ah, the joys of being a developer. :-) |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 12 2012 : 4:40:39 PM
|
Wow. That clipboard feature is really nice. Could've used it a million times. Thanks for the pointer!
I used to use The SemWare Editor for all my editing and it had named scratch buffers you could save to, such as Ctrl+B,s,"foo" and then you could reference that buffer at any point during editing with Ctrl+B,l,"foo". Usually I would use one-letter names for speed. This Ctrl+Shift+V is very similar, except that they're not fixed.
I see they are persistent across launched instances, but remain separate to each running instance. Interesting. If you added a "sticky" feature with a name, I'd have my old fashioned scratch buffers. :-) |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 12 2012 : 4:49:37 PM
|
How helpful do you think the clipboard menu will be here? You make an interesting case for this new feature, but I am wary of some of the problems it is likely to introduce.
As for learning more about VA, the features page on our website might help, along with browsing the documentation:
http://www.wholetomato.com/products/default.asp
A couple of "small" but really useful features to mention in passing, are you aware of the Alt-M list, and than you can type "foo bar -cat" to filter it, the same as complex filtering works in the Open File and Find Symbol dialogs?
Also Alt-Up Arrow and Alt-Down Arrow for moving one function at a time up and down the current file. |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 12 2012 : 4:52:06 PM
|
For sticky buffers, you are effectively describing VA Snippets, especially since if you select some text and then press the VA toolbar button for VA Snippets, you get the option to create a snippet from the current selection.
http://www.wholetomato.com/products/features/vasnippets.asp |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 12 2012 : 5:16:32 PM
|
The clipboard menu would be helpful, and it would remove the issue I'm having. It would be a workable fix.
Still, in my mind, it's not the correct solution. The ability to have the machine automatically gather and assemble bits of data that may be useful to me, the person, and to offer it to me in a list as it does today, with it being my servant, seems only natural. Were I required to continually step in and do this or that, it kind of defeats the purpose of having an auto-gathering tool, in my opinion. And that is just my opinion. I doubt I'd find many people that agree with me. In my experience, most developers don't consider what's possible as being something of need or desire, but rather just a "Oh, on my wish list, wouldn't that be nice." I take a different view in most everything I do and make it go this way: If it's possible, and it's useful, even if only being so to a small number of people, but for those few it is really useful, why not do it. It's why I've gotten upset on various GNU-related projects before. It's like the tools they offer are a draft or two away from being really, really useful to people. And if they've gone this far (to the trouble of writing it, debugging it, documenting it, etc.), why not go the rest of the way and introduce the really nice features that make people go "Oooh... awwwe..."
I realize it might require some complex additional programming, and of being a non-trivial addition, possible new bugs. If you don't want to do it that's fine. I would use the clipboard solution. If, however, you desire to dive into the deep pool of "what's possible is right" and swim there for a while, I would be most grateful. And I'm sure several others would be as well, just probably not most people. :-)
Hope this makes sense. |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 13 2012 : 09:33:13 AM
|
I came across another similar need today, also common. In the case above, it's a new token not found because it's never been seen before. The issue I had today is on a prototype definition like this:
int foo(int a, int b) and I change it to:
void foo(int a, int b) Or make some other change which alters its definition.
Typically, what I'll do next is right-click on "foo" and "Go to definition," but because that prototype definition doesn't match the function body any longer, VS can't find it and I have to manually navigate to the function.
It would be nice if VAX could intercept that request and (for a limited time, 45 to 60 seconds) remember those functions which recently went out-of-scope due to some change on a line (ones which still point to valid things in the app). A list of possible alternatives could be popped up when a definition-or-declaration-not-found condition is encountered.
My current work-around is to not save the change in the prototype file. I type my change, then right-click on the function name, go to definition, make the change there as well, and then come back and save. That way intellisense / VAX aren't updated yet and the tracing still works even though the definition's technically been altered in source code.
VAX could compensate for this routine shortcoming by remembering whatever that line was last (assuming it points to something valid) for the brief period of time, offering it as a possible go to location if the right-click, goto declaration/definition item isn't found.
Make sense?
I'm trying to figure out ways VAX could assist in cases with new / changed data items developers encounter every day while coding / refactoring. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 15 2012 : 12:27:45 PM
|
Suggesting unknown symbols, it turns out this has come up once before. I have put a note on this feature request, covering some of the points discussed here:
case=46359
Your more general point about what VA can and cannot do, in an ideal world, with infinite resorces, there are lots of features that it would be nice to see VA support. Unfortunately we don't have infinite resorces, so have to make decisions about where to focus. We just hope we add enough value and usefulness to make Visual Assist X worth while.
Changing the prototype, the declaration, if this is an existing and known function, then this is exactly what the Change Signature refactoring is designed to help you with:
http://www.wholetomato.com/products/features/changeSignature.asp
run Change Signature, update the return type, and VA will update both the declaration and the implementation for you. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 15 2012 : 10:33:08 PM
|
Why don't you open up a 3rd party DLL API and let us help you improve your product? Perhaps we won't do it perfectly, but I bet we could take a lot of the debugging-the-logic-or-steps-involved out of it for you, so that the implementation of whatever our versions are will be almost trivial for you to convert.
FWIW, free/libre open source software really does work. |
Edited by - foxmuldr on Jun 15 2012 10:34:21 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 18 2012 : 10:22:48 AM
|
If we tried to do this, we would then have to either keep the API fixed, or risk breaking any tools that were created when VA had to change. VA's internal symbol database can change with each new build, as we fix bugs, try to improve things, and prepare for new features. Which means that keeping the API fixed could cause us some significant problems.
VA has to work around behind the IDE, and often has much less information in hand than people assume. It is easy to watch VA in action and conclude that we have "complete" understanding of the source code, but sadly this is not the case. It would be nice if it was.
The IDE already has a macro feature, for expanding the IDE and adding new commands, this is something I make use of myself, and suggest now and then when people ask for features that are not part of VA. The suggestion that you could use a macro nearly always meets with total silence, which sadly suggests that any such API would get very little, if any use.
What sort of things would you want to try and use some API for? Adding temporary, unknown tokens to listboxes would be a hard thing to enable via an API, since this is a tricky task. You cannot simply look for the new unknown tokens in VA's symbol database, since they are not in the database, thats what makes them unknown. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 18 2012 : 1:33:59 PM
|
---VA has to work around behind the IDE, and often has much less information in hand than people assume. You mentioned that back a few years ago. You described it as "running around behind the IDE".
---What sort of things would you want to try and use some API for?
Two leap to mind: #1 - A call from VAX to plugin asking it to augment list items for the suggestion box. Should include a "should_be_first" and "should_be_last" flag. #2 - The ability to hook well-defined tracked activities in VAX, such as add token, change token, delete tokens, examine list, navigate to file, to line, to column.
Some addition abilities would make VAX completely robust: #3 - Editing options #3.1 - Tell VAX to open a file #3.2 - Go to a line in a file #3.3 - Go to a column in a file #3.4 - Select text #3.5 - Copy text to clipboard #3.6 - Paste text from clipboard #3.7 - Close a file
#4 - Results options #4.1 - Get a list of results from the last "find results" window (passing searched phrase / expression, pathname, line and possibly column for each item in the result set) #4.2 - When refactoring, get a list of all changes that will be made (passing original token, pathname, line and column of change, along with a single callback indicating what it was changed to)
#5 - General dump abilities #5.1 - Ability to dump all known information from VAX to the plugin, so that additional mining can be done, which would then allow for additional abilities to be requested through the API. Such as for each class, what source file(s) are the header and body code defined in, what are all the members of every class, what variable types, which ones are referenced in code, etc.
----- These abilities would allow plugins to augment VAX in any way that would be deemed possible by their third-party abilities. And all you'd have to do is maintain the API and make sure the hooks work, and that the data is provided. You could even "clean it up" so as to hide any internal data structure secrets about how you process things internally. All we (external plugins) are looking for is a way to augment lists, track activity, keystrokes, text, tokens, locations in files, etc.
PM me if you'd like my private email or phone number to discuss any of this.
Best regards, Rick C. Hodgin |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 18 2012 : 3:31:07 PM
|
Just looking at the two things you want to do, for ease, since this is clearly a lot of work to consider adding.
Suggestion listboxes, by their very nature, are context and typing history sensitive. Do you have any sense of what you might want to add to a suggestion listbox? If you are after adding local symbols, then VA should already be trying to add these.
Point 2, I am not sure what you mean by "add token" and "change token". Are you talking about specific refactoring commands, or any and every possible edit that is done in the IDE? Remember, the IDE has all sorts of ways of editing files.
The line and column in a file can be less meaningful than they sometimes look. Speaking from experience, since I have had to support some of the edge cases that come up, tab spacing, word wrapping, virtual space and code folding can all confuse the meaning of line and column, and this is before you realise the file in the editor can be quite different to the file on the hard drive. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 18 2012 : 4:17:14 PM
|
---Do you have any sense of what you might want to add to a suggestion listbox?
Some things I want to do: #1 - Symbols recently found that aren't yet known. #2 - Symbols recently deleted that might be being refactored.
Some things that would be possible with this ability: #3 - Custom things to which my app might be aware of contextually (based on whatever file is currently open, for example).
Suppose I'm editing a list of generated source files, and they come from various processes. My external tool, which loads them into Visual Studio programmatically, might know things about where they came from, and then be able to tag in comments, or provide items in the list which VAX would never know anything about, and do so without creating our own VAX-like utility.
People would still buy VAX. But now they'd have this ability to customize it a little for their own needs, those which cannot be described in advance because this ability doesn't yet exist and people haven't given much thought as to when they might be able to use it (myself included, apart from desiring to populate the listbox with recently unfound tokens, etc.).
---I am not sure what you mean by "add token" and "change token" VAX is highlighting unknown tokens in source code. That information is coming from somewhere (I assume VAX is internally keeping track of it). It's also highlighting local symbols in bold if checked, etc. From my point of view, VAX knows things about the known things in an application (class names, structures, enums, variables, constants, defines, functions, members, etc.). Each of those is given by a name, and I'm referring to it as a token.
I don't know, maybe it's all coming only from IntelliSense and VAX is just hooking into IntelliSense to update the screen when IntelliSense says there's something here, there, or the other place. I've been under the impression VAX does its own parsing and storage. If that's a correct assumption, the ability to hook every update to that internal storage could prove useful.
---Remember, the IDE has all sorts of ways of editing files. VAX must trap some of them to be useful as it is today. You catch "." and change to "->" while editing, for example. So, you're monitoring things as they go along. When things are updated / changed, VAX updates its local storage for such things, right? So how about a hooks on everything that's updated by VAX internally?
Bear in mind that this might seem like a lot, but it's a single function to call with the appropriate action for all of the places in your code where you're already doing something. Whatever VAX is doing internally (add, change (rename), delete, re-scope (I assume, if I change int foo(int) to void foo(int)), etc.), create a hook for it and call that hook if a plugin is (or plugins are) loaded.
As part of the plugin communication protocol, the plugin will either do something with that data, or ignore it. Most of the time it will ignore it. But for some operations, the plugin could then keep track of its own use for it to provide additional hints to suggestion boxes as they are created during typing. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jun 19 2012 : 4:51:25 PM
|
Point 1, for the things you want to do, there is a feature request to have VA suggest unknown tokens. If my understanding is correct, you may not be able to do that with an API like this, since unknown tokens, by definition, are unknown, they are not going to be in VA's symbol database, and VA is not automatically going to tell you about them. So you are also going to need VA to tell you about every "unknown" token that is discovered and underlined, else you won't know about them.
Just adding this feature directly to VA is going to be a lot easier than trying to enable it via an API.
VA has a symbol database, so telling you about symbols that are added and removed from this symbol database should be possible, and will bypass having to track all types of editing activity in the editor. This answers my question about tracking activity in the editor, and the various ways you can edit in the editor.
Point 2, recently deleted symbols you are refactoring, I am not sure I follow. If you are deleting a symbol because you are renaming it, then the Rename refactoring should update all references, so referencing the old name makes no sense. Normally you don't want VA to suggest symbols that have been deleted, since they are no longer valid.
Point 3, this sounds a lot like working without a solution, at which point VA is going to be a lot less useful, since there is no solution for VA to understand. In this sort of situation you are going to have to duplicate a lot of VA yourself to work out what is going on, or am I misunderstanding?
Creating such an API is possible, but if this is just being done for one or two specific situations, it is going to be much more effective to just solve those specific situations directly. Simply creating it because it might be useful is something we don't currently have the resorces to undertake unfortunately. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
416 Posts |
Posted - Jun 19 2012 : 9:16:21 PM
|
Well, we got a lot further with the discussion this time around than we did in 2006/7. Maybe in five more years we'll actually get it. :-) |
|
|
|
Topic |
|
|
|