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

From Eclipsepedia

Jump to: navigation, search
 
 
(One intermediate revision by one user not shown)
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  
Line 16: Line 14:
 
Java editor. This book has a sample that shows how to
 
Java editor. This book has a sample that shows how to
 
write an HTML editor.
 
write an HTML editor.
For more details, see[[FAQ_How_do_I_write_an_editor_for_my_own_language%3F]]
+
For more details, see [[FAQ How do I write an editor for my own language%3F]]
  
  
 
 
 
 
* ''Add Content Assist''.
+
* ''Add Content Assist''. (see [[FAQ How do I add Content Assist to my language editor%3F]])
(see[[FAQ_How_do_I_add_Content_Assist_to_my_language_editor%3F]].
+
 
The DOM, developed in phase 2, allows us to navigate the source code, analyze it,
 
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  
 
present it in multiple modes, and manipulate its structure, a process  
Line 31: Line 28:
  
 
 
 
 
* ''Add Quick Fixes''
+
* ''Add Quick Fixes'' (see [[FAQ How do I implement Quick Fixes for my own language%3F]]  
(see[[FAQ_How_do_I_implement_Quick_Fixes_for_my_own_language%3F]]. After compilation errors have been detected, suggest how to fix the problem.
+
After compilation errors have been detected, suggest how to fix the problem.
 
How would you reason about code without an underlying model?
 
How would you reason about code without an underlying model?
 
   
 
   
 
 
 
 
* ''Add refactoring''
+
* ''Add refactoring'' (see [[FAQ How do I support refactoring for my own language%3F]])
(see[[FAQ_How_do_I_support_refactoring_for_my_own_language%3F]]
+
Implement operations on source code to restructure program constructs, following
). Implement operations on source code to restructure program constructs, following
+
 
the semantics of your language. Again, without a model of the underlying language, this
 
the semantics of your language. Again, without a model of the underlying language, this
 
is a daunting, error-prone task.
 
is a daunting, error-prone task.
  
 
 
 
 
* ''Add  an Outline view''
+
* ''Add  an Outline view'' (see [[FAQ How do I create an Outline view for my own language editor%3F]])
(see[[FAQ_How_do_I_create_an_Outline_view_for_my_own_language_editor%3F]]
+
The Outline view presents a summary of the structure of a particular program.  
). 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  
 
Using the same compiler and/or DOM saves a lot of time developing your  
 
language IDE.
 
language IDE.
Line 52: Line 47:
  
 
After completing your editor, you are ready to enter the Holy Grail of
 
After completing your editor, you are ready to enter the Holy Grail of
language IDEs; see[[FAQ_Language_integration_phase_4%3A_What_are_the_finishing_touches%3F]]
+
language IDEs; see [[FAQ Language integration phase 4%3A What are the finishing touches%3F]]
  
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+
{{Template: FAQ Tagline}}

Latest revision as of 08:15, 17 January 2007

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, see FAQ How do I write an editor for my own language?


 

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.

 

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

 

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.

 

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; see FAQ 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.