Jump to: navigation, search

Difference between revisions of "FAQ Language integration phase 3: How do I edit programs?"

 
Line 1: Line 1:
''
 
 
 
After creating a compiler, a builder, and a DOM,  
 
After creating a compiler, a builder, and a DOM,  
 
writing an editor is  a snap. To write an editor for a particular
 
writing an editor is  a snap. To write an editor for a particular
Line 7: Line 5:
  
  
* ''Implement an language-specific editor''.
+
* ''Implement a language-specific editor''.
 
The JDT places the bar high for any subsequent language implementers. No
 
The JDT places the bar high for any subsequent language implementers. No
 
matter how fast the compiler is and how well the build process is  
 
matter how fast the compiler is and how well the build process is  

Revision as of 15:36, 14 March 2006

After creating a compiler, a builder, and a DOM, writing an editor is a snap. To write an editor for a particular programming language, a few steps can be distinguished, all relying heavily on the existence of a DOM.


  • Implement a language-specific editor.

The JDT places the bar high for any subsequent language implementers. No matter how fast the compiler is and how well the build process is integrated, if your language has to be edited in the default text editor, you fail to even get close to being worthy of comparison to JDT. Writing an editor is not difficult. Many examples exist. The platform wizard has one for an XML editor. The examples shipped with Eclipse show a simplified Java editor. This book has a sample that shows how to write an HTML editor. For more details, seeFAQ_How_do_I_write_an_editor_for_my_own_language?


 

  • Add Content Assist.

(seeFAQ_How_do_I_add_Content_Assist_to_my_language_editor?. The DOM, developed in phase 2, allows us to navigate the source code, analyze it, present it in multiple modes, and manipulate its structure, a process also known as refactoring. Content Assist uses the DOM to figure out all the possible context-sensitive continuations for a given input. Quick Fixes know how to solve a given compilation error. Refactoring relies on the DOM to find all call sites for a given method before we can change its name. An Outline view uses the DOM to show the structure of the code in a hierarchical summary format.

 

  • Add Quick Fixes

(seeFAQ_How_do_I_implement_Quick_Fixes_for_my_own_language?. After compilation errors have been detected, suggest how to fix the problem. How would you reason about code without an underlying model?

 

  • Add refactoring

(seeFAQ_How_do_I_support_refactoring_for_my_own_language? ). Implement operations on source code to restructure program constructs, following the semantics of your language. Again, without a model of the underlying language, this is a daunting, error-prone task.

 

  • Add an Outline view

(seeFAQ_How_do_I_create_an_Outline_view_for_my_own_language_editor? ). The Outline view presents a summary of the structure of a particular program. Using the same compiler and/or DOM saves a lot of time developing your language IDE.


After completing your editor, you are ready to enter the Holy Grail of language IDEs; seeFAQ_Language_integration_phase_4:_What_are_the_finishing_touches?


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.