|
Hey!
Does anyone know how to mod this to not require wordwrap?
Also, I just noticed that often the braces are deselected and no longer tracks the matching brace!
Rich
modified on Friday, March 4, 2011 8:43 AM
|
|
|
|
|
hi,
you need to comment out these part:
public void OnStartupComplete(ref Array custom)<br />
{<br />
<br />
...<br />
<br />
<br />
}
in the Connect.cs file and recompile the plugin. But it may not work without bugs.
jochen
|
|
|
|
|
Humm .. Nice add-on, but I noticed a couple of problems with it. I don't know if they are even possible to remove:
1). For files in a good source control (Perforce, VSS, etc) the files are locked by default (read only) and when you try to edit them, they either prompt or check out the files automatically (depending on your setting). This will either prompt us on every keyboard movement (in my case) or automatically check out files without knowledge, because we are actually editing the files under the covers.
2). For editable (non-read only) files, My Visual Studio File Tab shows a * sign on the file name when I am on a brace, because it has edited it just now. When I move my cursor away, it removes that because we probably undo the change without maintaining it in the undo/redo list. But that is just disturbing to eyes to see that asterisk on the file name.
|
|
|
|
|
hi,
with the addIn api this is not possible to fix. maybe with the real extension api. but no time atm.
jochen
|
|
|
|
|
I encounter the same problem as above, a fix would be welcome.
Anyway, this addin is a very good idea.
|
|
|
|
|
Hi folks.
I've got visual studio 2008 under MSDNAA license and unfortunately I'm only able to get the german version. As for installing this plugin I have the problem that I have no "Addins"-folder and nothing similar in the german equivalent to "C:\Users\Username\Documents\Visual Studio 2008". I tried around a bit, but I don't get working brace matching. Do you have any advice for me how to install this plugin?
Thanks in advance
|
|
|
|
|
hi,
which version of windows ? (the language of VS do not matter).
if Vista the folder is: User\Dokumente\Visual Studio 2008\Addins
You can only see the "Dokumente" folder with explorer.
The germany folders do not exist in real, on your harddisk the folder is:
C:\Users\Username\Documents\Visual Studio 2008\Addins.
If the Addins folder do not exist create it.
Gruss
jochen
|
|
|
|
|
Win7
I already created the folder, inserted the plugin, no effect.
|
|
|
|
|
hi,
the plugin do not work with the Express Editon.
1. make sure the files: matchingbraces.Addin and MatchingBraces.dll are in the folder "C:\Users\username\Documents\Visual Studio 2008\Addins" (click on the adress in the explorer window to see the whole path).
2. start VS and take a look in Tools->Addin-Manager if the addin is available and
Startup is enabled.
3. open a C++ document and put the cursor behind a brace
tested on Win7 64 bit, englisch VS, but in the time of writing the addin I used a german version of VS and it works.
hope this helps, jochen
|
|
|
|
|
Sorry for the delay, had some other things to do.
Just wanted to say thanks for the VERY fast answers and now it works fine here as well
I think my mistake was to make a subdirectory for the plugin in the Addins dir.
Thanks again
|
|
|
|
|
I build the source version and it doesn't work when I copied dll file and AddIn file! why ?
|
|
|
|
|
|
I have Professional edition.
Problem does't exist anymore, in matchingbraces.AddIn file I have changed <loadbehavior>0<loadbehavior> to <loadbehavior>1<loadbehavior> and work's great.
|
|
|
|
|
|
hi jochen,
thanks for the interesting article. could you please advise as to how i could create a similar add-in that would not only find the matching end brace, but add to it a comment that relates it back to the signiture of the block it closes? i usually work in C#, so if you could use sample code in C# it would be greatly appreciated.
thanks again for sharing your expertise.
kjward
|
|
|
|
|
hi,
sorry didn´t used c# since programming this addin. so I have the some effort as you have. take a look on the other addin examples and look on msdn.com
jochen
|
|
|
|
|
I modified this add-in to work for Visual Basic code files by changing the following functions:
private bool isCPlusPlusText()
{
if (_applicationObject.ActiveDocument == null ||
////// _applicationObject.ActiveDocument.Language != "C/C++")
_applicationObject.ActiveDocument.Language != "Basic")
{
return false;
}
else
{
return true;
}
}
public void OnStartupComplete(ref Array custom)
{
EnvDTE.Properties txtEdCS2 =
////// _applicationObject.get_Properties("TextEditor", "C/C++");
_applicationObject.get_Properties("TextEditor", "Basic");
bool word_wrap_c = (bool)txtEdCS2.Item("WordWrap").Value;
if (word_wrap_c != true)
{
MessageBox.Show("You have 'WordWrap' disabled in the Editor settings. \nYou need" +
" to enable it for the MatchingBraces plugin to work correctly.", "MatchingBraces - AddIn",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
This works in VS2008, but does not work in VS2005, even after modifying the .AddIn file from
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>9.0</Version>
</HostApplication>
To:
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>8.0</Version>
</HostApplication>
Anyone have any idea why the VB version works in VS2008 but not VS2005?
|
|
|
|
|
would it be that simple to include c# as well?
kjward
|
|
|
|
|
It would be a little more work to support multiple languages because the macro gets the properties of the text editor (C/C++, C#, VB) on startup and makes some decisions based on that. That said, it should only be a LITTLE more work. I think that given the example of what I did with the original macro, it should be straightforward to implement this yourself.
|
|
|
|
|
thanks for the quick reply bruce.
what i'm really looking to do is simply add a comment to the end brace of a block to match it's signiture. i thought i could modify/extend your example to do this. is there a better approach to do what i want?
kjward
|
|
|
|
|
Sorry kjward, but my knowledge of Windows add-ins is limited. I found the article by Jochen Baier and after downloading the source code I found it pretty simple to modify for my use with the VB editor. What you want to do sounds more complicated. My suggestion to you would be to download the source code, look at it and experiment with it to see if you can achieve the results you want. If not, perhaps try to contact Jochen Baier. Bottom line is that as long as you experiment on test C# source files, I don't think you can hurt anything by testing, because if your changes cause the C# files to be junked up, you can just deleted the DLL from the add-in directory and the editor will return to its normal behavior.
|
|
|
|
|
It doesn't mention it doesn't work for VS 2008 Express version...
|
|
|
|
|
Got a message indicating word wrap was disabled and needed it enabled for this addin to work. Enabled word wrap, restart vs2008: not working.
|
|
|
|
|
Visual Basic also lacks the feature to highlight round brackets. just when you close a round bracket the first time, the corresponding bracket gets highlighted, but unlike c# not when you place the cursor next to a bracket. ctrl + ] also isn't working for visual basic.net.
would be great if you could adapt this addin to work for visual basic as well.
|
|
|
|
|
It is a good work.
It is possible to change the "matching advice" using the colors of
"Brace Matching (Highlight)" [<-this works] and "(Rectangle)" of "Fonts and Colors"
of Options settings ?
Thanks.
modified on Thursday, March 26, 2009 10:05 PM
|
|
|
|