T O P I C R E V I E W |
bugfix |
Posted - Jan 15 2006 : 03:37:36 AM Would it be possible to get an autotext suggestion like '///' that fills up to column indicator when defined in options? E.g. something like: "/*$repeat_char/" which would result in: /***<snip>***/| or //$repeat_char/ which would result in: ///<snip>///|
-bugfix |
11 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Jan 17 2006 : 3:22:19 PM cool
rather usefully this also works perfectly in VS2005 professional as well. having seen this idea i suspect i will find a use for it in my own code |
bugfix |
Posted - Jan 16 2006 : 4:46:51 PM Nice idea! Here is a version that works in vs2003 it even reads VAX column indicator setting from registry:)
Imports Microsoft.Win32
Sub VAXCommentAssist()
Dim HKCU As RegistryKey = Registry.CurrentUser
Dim keyValue As String = "Software\\Whole Tomato\\Visual Assist X\\VANet"
Dim regKey As RegistryKey = HKCU.OpenSubKey(keyValue, False)
Dim colIndicatorCol As Integer = 0
If (Not regKey Is Nothing) Then
colIndicatorCol = regKey.GetValue("ColumnIndicatorColumn", 0)
regKey.Close()
End If
Dim texSel As TextSelection = ActiveDocument.Selection
With texSel
Dim i As Integer
For i = .CurrentColumn To colIndicatorCol
.Text += "/"
Next
End With
texSel.NewLine()
End Sub
|
ether |
Posted - Jan 16 2006 : 2:57:28 PM Yeah, I knew there would be some issues, but since I'm at work and I don't have VS.NET here, I couldn't look at how I got my other macros to work in it. At home I have VS.NET 2003 installed and ported my VS 6 macros over to it. I remember hitting a lot of little things like that, but it can be done.
I think you have to specifically call through ActiveDocument.Selection.Text in order to do it, but again, without VS.NET in front of me, I cannot be sure. |
feline |
Posted - Jan 16 2006 : 2:43:56 PM interesting. looking into the IDE's macro language has been on my "things to do" list for years now
i tried this in VS2003 and some of the code is accepted, but the primary problem is that:
ActiveDocument.Selection
is readonly, more specifically "Selection" is readonly, so none of the assignment operations work. so this will take a bit of work to make work in VS2003, but hopefully not to much. |
ether |
Posted - Jan 16 2006 : 1:06:05 PM I decided to code what I described above to give you some ideas.
sub TestStuff()
'DESCRIPTION: This is a test macro
Dim nCol
Dim i
nCol = ActiveDocument.Selection.CurrentColumn
for i = nCol to 79
ActiveDocument.Selection = "/"
next
ActiveDocument.Selection = vbCrLf
ActiveDocument.Selection.MoveTo ActiveDocument.Selection.CurrentLine, nCol, dsMove
ActiveDocument.Selection = "//" + vbTab + InputBox("Enter Some text") + vbCrLf
ActiveDocument.Selection.MoveTo ActiveDocument.Selection.CurrentLine, nCol, dsMove
for i = nCol to 79
ActiveDocument.Selection = "/"
next
end sub
You put this in a .DSM file and load it into Visual Studio. The code above works for VS 6 and may need to be adjusted for VS.NET. |
ether |
Posted - Jan 16 2006 : 12:03:37 PM Make a Visual Studio macro and assign it a shortcut. You can easily fill a line from the current position to a specified column number in VB script. You can also make it prompt you for the text to fill in where your "some doc" is in your example. Give it a try. |
support |
Posted - Jan 16 2006 : 10:51:22 AM What you really need is something to adjust the lengths of your ///// lines as you change indent levels. |
bugfix |
Posted - Jan 16 2006 : 01:37:26 AM I follow a very strict "< 80" chars per line rule, so when I have something like code below I always have to adjust the nested comments inserted autotext.
//////////////////////////////////////|
// some doc |
//////////////////////////////////////|
struct blub |
{ |
//////////////////////////////////|
// some doc |
//////////////////////////////////|
void blubber() |
{ |
} |
}; |
|
feline |
Posted - Jan 15 2006 : 3:45:52 PM out of interest, what are you doing that leads to this need? i have seen plugins for VIM that allow you to produce a comment mode "box" around a block of text, but i have never used them myself. are you doing something like this? or something totally different? |
bugfix |
Posted - Jan 15 2006 : 10:12:18 AM I'm already using that option but it happens more than once a day that I have to adjust the inserted autotext and that that's why I've came up w/ that idea. |
support |
Posted - Jan 15 2006 : 09:32:25 AM You can make an Autotext entry that expands /// to a fixed numbers of slashes, but you cannot make an extry that expands from the current position to the column indicator.
Certainly an interesting idea. |