Export (0) Print
Expand All

IronPython Language Service Sample

Visual Studio 2005
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample implements a language service that uses the IronPython parser to enhance the Visual Studio code editor. For more information about language services, see Language Services.

The language service Intellisense features highlighted by this sample include:

  • Statement completion.

  • Syntax checking for syntax coloring and error highlighting.

  • Tooltip support for method overloads.

  • Go To Source Code from the context menu.

  • Code snippets, some of which are included in the sample.

In addition, the language service sample project provides a home for IronPython library manager. The library manager works with the IronPython parser to produce a code model that supports Class View and the Object Browser.

NoteNote

The sample library manager builds a code model, but cannot make the round trip from the code model back to the source code. For example, you cannot delete, refactor, or rename methods from the Class View.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.  Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build and run the sample

  1. Open the IronPython.sln solution in the <Installation Path>\VisualStudioIntegration\Samples\IronPythonIntegration folder.

    NoteNote

    This sample includes the LanguageService project.

  2. Press F5 to build the sample, register it in the experimental hive, and start Visual Studio from the experimental hive.

To see the sample's functionality

  1. On the File menu, click New Project to display the New Project dialog box.

  2. Create a new PythonProject Console Application.

    The new project appears in Solution Explorer, the "main" file Program.py appears in the code editor, and selected properties of the project appear in the Properties Browser.

  3. Add this line to the end of the Program.py file:

    def add(a, b):
        return a + b
    

    Notice that the keywords are colorized as you type, and that error highlighting shows until the definition is syntactically correct.

  4. Add this line to the end of the Program.py file:

    print add(3, 4)
    

    Notice that Intellisense opens for statement completion when you type the left parenthesis.

  5. On the View menu, click Class View to display the Class View.

    The program Program.py and method add appear in the Class View.

Demonstrates

See Also

Other Resources

IronPython Samples

Community Additions

ADD
Show:
© 2014 Microsoft