UpdateUserType (Visual Studio Addin)
Here is another addin I wrote for VS2008 and then updated for VS2010. In C++ you can define your own custom keywords and VS will color them differently if you say so (ToolsOptions -> Fonts and Colors). There are a couple of problems with the VS solution.
- You have to edit the UserType.dat file.
- You have to restart VS.
- You have only one set of keywords for all of C++.
The second and third problems are the killers here. As you are developing code you will often find a set of keywords you’ll want to add. To do so you’ll have to open the .dat file, add the keywords and then restart VS. Even worse is that if you are working on an MFC project then you’ll likely want some MFC keywords but if you switch to Win32 then you want a different set of keywords. To resolve this problem you’ll have to keep multiple .dat files that you can swap in and out. Enter UpdateUserType.
UpdateUserType does a couple of things. Firstly it allows you to separate your keywords into different files (i.e. C++, MFC, Win32). Secondly UpdateUserType can merge all these files into a single .dat file. Thirdly the addin will detect when the .dat file changes and request VS to refresh its keyword list.
Using the addin UI you can add a list of .txt files to be monitored. Whenever one of these files is modified the addin merges them all into a new .dat file. This allows you to separate keywords by area and enable only the keywords appropriate for your current project. My personal technique is to keep one or more of them open in a separate editor so that I can add new keywords as I go through code. Saving the files in the editor causes the .dat file to be regenerated.
When the .dat file changes the addin requests VS to refresh the keyword list. When this happens VS will read the .dat file and begin coloring the keywords again. This feature allows you to add keywords on the fly and have VS begin coloring them almost instantiately.
Attached is the source and binaries for the VS2010 version of this addin. Additionally I’ve included some starter .txt files that you can use. A caveat is in order. The .XML file where the addin stores the files to be merged supports relative or absolute paths. However the UI and the code only supports absolute paths. Therefore if you use the UI to change the file list then the paths are converted to absolute paths.
To install the addin copy the contents of the Bin directory to your %My Documents%Visual Studio 2010Addins directory. You might need to enable the addin via ToolsAddin Manager. If the addin does not show up (it’ll appear under the Tools menu) then you might need to force a re-registration.
Se é para utilizar em C++ porque foi feito em C#? Pois agora para instalar vou ter que baixar o VSC# também. =/
Não tem como fazer o exe dele recebendo o caminho da dll por um aquivo externo?
O que estou precisando na verdade é saber onde coloco o UserType.dat no VS2010? pois no 2008 eu coloquei na pasta Common7/IDE e deu certo. Mas no VS2010 não.
Valeu. Desculpe-me o incomodo.
Could you post your comments in English? It’s the only (non-programming) language I know.
I want to try out your addin, BUT cant find the source or the binary.
Could you reattach please?
The addin has not been updated for newer versions of VS so it will not load. The original source code can be found here.