Designing, implementing and integrating a structured C# code editor
Kirill Osenkov
Diploma thesis in Computer Science (equiv. to Master of Science)
Brandenburg University of Technology
Cottbus, Germany
June 1, 2007
Full text (pdf)
Screenshots
Presentation (in German)
Links about structured editors
Abstract
Programs are represented as text by most code editors. Structured editors, on the contrary, directly display the parse tree of a program as a hierarchy of embedded blocks. This way the visual layout better illustrates the structure of the program and allows for atomic operations on the language constructs. The structured editor lets developers avoid syntax errors and concentrate on the meaning of the program instead of formatting.
In the scope of this thesis, an experimental structured editor is created for a subset of C# 1.0. It is integrated into the SharpDevelop IDE as an add-in and supports language-aware code completion. The implementation of the editor (.NET) is based on a framework specifically designed for building structured editors. The framework, the editor and the integration add-in are all documented together with the architecture and implementation details.
Contents
- Introduction
- Text vs. structured editors
- Integration of an editor with the IDE
- Principles of plain text editors
- Principles of structured editors
- Disadvantages and possible difficulties
- Existing research
- History
- Intentional Programming
- JetBrains MPS
- The Synthesizer Generator
- Other implementations
- Summary
- Functionality of the structured editor
- Creating a program
- Namespace member declarations
- Type declarations
- Access modifiers
- Class and struct members
- Statements
- Control structures
- Comments
- Code completion
- Architecture
- The Editor Framework
- Utils
- Canvas
- Controls
- Core
- Implementation of the C# editor
- Blocks
- Data structure
- Tree organization
- Operations on the data structure
- ContainerBlock
- RootBlock
- HContainerBlock, VContainerBlock
- LinearContainerBlock
- TextBoxBlock
- TextBoxBlockWithCompletion
- LabelBlock
- UniversalBlock
- ButtonBlock
- EmptyBlock
- Implementation of the functionality
- Designing the user interface
- Focus
- Events and user interaction
- Actions
- Controls
- VisibilityConditions
- Implementing the C# editor
- The project structure
- Defining data structures (blocks)
- Dynamic help
- LanguageService
- ClassNavigator algorithms
- Stand-alone editor window
- Integrating into SharpDevelop
- The SharpDevelop IDE
- Architecture
- Sharpdevelop Add-In
- Round-tripping
- Implementation of the add-in
- Code completion
- Summary
- Future research directions
- Drawbacks of the current implementation
- References
- List of figures