Nemerle – integration for VS 2005

About

This project is dedicated to the creation of Nemerle integration for VS 2005. Minimum goals for the project are to implement:

  1. Code completion on input.

  2. Quick Info tooltip display when the cursor is over an identifier.

  3. Full-fledged syntax highlighting (according to macros and types imported into the particular file).

  4. Quick Info tooltip display for function parameters.

  5. Code navigation.

  6. WinForms designer.

  7. Simple code snippets.

The following features may be implemented later on:

  1. Refactoring.

  2. Semantic constructs look-up.

  3. Visual Web designer support.

  4. Support for automatic snippets generated at run-time for imported macros.

  5. SVN support.

  6. Other delightful features have been forgotten to enlist.

License

BSD-style open source. In a nutshell: You must mention the authors in your products’ “About”s, readme etc. and your derived code must also retain all copyright notices and refer to them as appropriate.

How to build the project

Read this instruction up to the end!

You will need the following to build the project:

  1. Have an SVN client (like TortoiseSVN) installed.*

  2. Have a VS 2005 installation with the modules for C# and C++.*

  3. Download and install the latest version of VS SDK. You will have to register in VSIP program on http://affiliate.vsipmembers.com/. Then go to http://affiliate.vsipmembers.com/affiliate/downloadFiles.aspx and download the latest available version. Attention! You may be confused by version naming and the order of their appearance on the website. The latest versions are usually named like «MonthName 2006 RTM». Choose the version with the latest month available and download it (for example, at the moment when this instruction is being written it was September 2006 V3 RTM). An installation path for VS SDK should be short and shouldn’t contain any whitespaces (to avoid potential problems). Like «C:\VS\VS2005_SDK» for example. If you already have any previous VS SDK version installed and encounter any problems while installing a new one, try to uninstall the previous version first before asking for help elsewhere.

  4. Set or reset an environment variable named «VisualStudioIntegration». It must be set to the following path: «Path_to_VSSDK\Year.Month\VisualStudioIntegration». Like «C:\VS\VS2005_SDK\2006.09\VisualStudioIntegration» for example. It should not contain any quotation-marks, they are here for illustrational purposes only.

  5. Download and install Simple VS integration .

  6. Checkout our update to the latest Nemerle compiler sources from the SVN repository (http://nemerle.org/svn/nemerle/trunk). You may try to access by https if http doesn’t work for you. See Hacking for details. *

  7. If you have installed Nemerle binaries before using msi installer then correct «Nemerle» environment variable: remove quotation-marks (it was a bug in 0.9.3 installer) and change it if you plan to install newly compiled binaries to another directory. Warning! You must build the latest compiler version yourself from the SVN sources to work with this project.

  8. Compile Nemerle compiler project and copy resulting assemblies to a directory where you want them to be installed (“%ProgramFiles%\Nemerle” for example). You should also run ngen* on them to reduce compiler startup times. ngen is usually installed to “%SystemRoot%\Microsoft.NET\Framework\v2.0.50727”. The command file that automates this task is presented below for your convinience.

  9. Checkout or update sources of this project from the SVN repository (http://nemerle.org/svn/vs-plugin/trunk).

  10. Start VS 2005, open Nemerle.VSIP.sln, then build and run it.

If all the steps above were performed correctly an experimental version of VS2005 where you can test Nemerle integration should start.

Here is the command file (you may name it BR.cmd) that performs compilation and pre-JIT of Nemerle compiler assemblies:

@echo off


set NemerleBin=D:\MyProjects\RSDN\Nemerle\nemerle\bin\Debug

set GacUtil=C:\VS\VS2005\SDK\v2.0\Bin\gacutil.exe

set NGen=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\ngen.exe

set NemerleInstall=%ProgramFiles%\Nemerle


MSBuild Nemerle.sln


@echo

@echo errorlevel=%errorlevel%


if not errorlevel 1 (


@echo GacUtil=%GacUtil%

@echo NGen=%GacUtil%

@echo NemerleBin=%GacUtil%


cd /D %NemerleInstall%


%GacUtil% /u Nemerle

%GacUtil% /u Nemerle.Compiler

%GacUtil% /u Nemerle.MSBuild.Tasks

%GacUtil% /u Nemerle.Macros


%NGen% uninstall Nemerle.dll

%NGen% uninstall Nemerle.Compiler.dll

%NGen% uninstall Nemerle.Macros.dll

%NGen% uninstall Nemerle.MSBuild.Tasks.dll

%NGen% uninstall ncc.exe


@echo errorlevel=%errorlevel%

set errorlevel=0

@echo errorlevel=%errorlevel%


copy /Y %NemerleBin%\*.dll


if not errorlevel 0 (

@echo errorlevel=%errorlevel%

@echo !!! ERORR: copy files !!!

pause

exit /b 1

)


copy /Y %NemerleBin%\*.exe


if not errorlevel 0 (

@echo !!! ERORR: copy files !!!

pause

exit /b 1

)


copy /Y %NemerleBin%\*.pdb


if not errorlevel 0 (

@echo !!! ERORR: copy files !!!

pause

exit /b 1

)


%NGen% install Nemerle.dll

%NGen% install Nemerle.Compiler.dll

%NGen% install Nemerle.Macros.dll

%NGen% install Nemerle.MSBuild.Tasks.dll

%NGen% install ncc.exe

)

pause

Don’t forget to change your machine-specific paths marked by red.

This command file must be created in the Nemerle compiler source root directory (in the same with Nemerle.sln).

* If you don’t understand what does this mean and unable to find relevant information using Google and Nemerle web site this project is probably not for you. Sorry.

Possible problems

If you try to recompile Nemerle compiler binaries using an opened Visual Studio and you have used previous compiler versions at least once you’ll see a lot of twinkling text at the registration stage and the number of files copied will be different from anticipated 4, 1, 5. Just close the studio and run the compilation and pre-JIT from the command line again.

Notice that you’ll have to force rebuild of the integration project after every new build of Nemerle compiler assemblies.

How to get involved in the development of VS 2005 integration and Nemerle compiler?

You can obtain login and password that will grant you access to the SVN repository with the sources and you’ll be able to work on them and commit the changes (see below). You should realize that this implies a certain degree of responsibility and your changes may affect integrity of the project. So you should be accurate and attentive and your changes should be reasonable. Usually the best way to start is to ask questions and participate in the discussion in the Nemerle Google group and join developers’ mailing list. You may find information how to subscribe here. Conference archives are available here. There’s also a forum for Russian-speaking people solely dedicated to the integration project: http://rsdn.ru/Forum/?group=prj.nemerle. Be polite and respect other people opinions.

Follow the coding style of the original code while making your changes.

You can send patches (created automatically by SVN client) personally to the integration project’s lead developers (VladD2 and IT at the moment – see http://nemerle.org/svn/nemerle/trunk/misc/users for contact information) until you have a personal SVN login. Or you can also attach patches to your developers’ mailing list postings. Please don’t attach patches with the size of more than 100 Kb.

To obtain an SVN login you should generate a password hash here first. Then you should send the generated hash to the project admin Michal Moskal [malekith A T nemerle.org]. After obtaining permission add yourself and your contact information to the http://nemerle.org/svn/nemerle/trunk/misc/users.

Information about the main developers of Nemerle can be found here.

Unit tests

The VS2005 integration project contains unit tests. NUnit framework (http://www.nunit.org/) with the version 2.2.8 or higher is required to run them.

You may encounter debugger crashes while debugging in VS 2005 in interactive mode for prolonged periods of time. This makes complicated problems hard to debug. This is one of the reasons why it is desirable to employ unit tests as a good replacement for interactive debugging. Nemerle.Compiler.Utils project contains unit tests in Nemerle.Completion2\Tests subdirectory. (Note: Completion Engine will possibly be renamed to IntelliSense Engine in the future).

Files:

contain sample code that is parsed in the tests. More files or even whole projects will be possibly added here in the future.

Nemerle.Completion2\Tests\Tests.Init.n file contains IntelliSense Engine initialization code and misc helper methods (for IDE text keyboarding emulation for example).

Nemerle.Completion2\Tests\Tests.n file contains the tests themselves.

If you find a bug try to make a reproducible test case. This will reduce the time and effort to fix it.

You may also use unit tests to study IntelliSense engine internals and for debugging. It is recommended to avoid writing big and slow tests.

General information

The main Nemerle website is http://nemerle.org/. There are also some articles about Nemerle and the VS2005 integration project in Russian on RSDN.