Author |
Topic |
|
bugfix
Tomato Guru
Germany
324 Posts |
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 |
http://www.mf-sd.de |
Edited by - bugfix on Jan 15 2006 03:41:42 AM |
|
support
Whole Tomato Software
5566 Posts |
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. |
|
|
bugfix
Tomato Guru
Germany
324 Posts |
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. |
http://www.mf-sd.de |
|
|
feline
Whole Tomato Software
United Kingdom
19001 Posts |
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? |
zen is the art of being at one with the two'ness |
|
|
bugfix
Tomato Guru
Germany
324 Posts |
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() |
{ |
} |
}; |
|
http://www.mf-sd.de |
|
|
support
Whole Tomato Software
5566 Posts |
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. |
|
|
ether
Tomato Guru
USA
130 Posts |
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. |
|
|
ether
Tomato Guru
USA
130 Posts |
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. |
Edited by - ether on Jan 16 2006 1:06:33 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19001 Posts |
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. |
zen is the art of being at one with the two'ness |
|
|
ether
Tomato Guru
USA
130 Posts |
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. |
|
|
bugfix
Tomato Guru
Germany
324 Posts |
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
|
http://www.mf-sd.de |
|
|
feline
Whole Tomato Software
United Kingdom
19001 Posts |
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 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|