Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "User:Karol.gusak.eu/GSoC Proposal Orion Web IDE PHP Editor"

(PHP Editor Features)
(Timeline)
 
(7 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
= Current Status of Open Source Web-Based PHP Editors =
 
= Current Status of Open Source Web-Based PHP Editors =
  
After conducting a small research about existing web-based PHP editors and IDEs, I came to following conclusion. Most of the solutions are not open source, and often not free. Furthermore, their design is remarkably different from Orion's – they bring desktop experience into a browser, trying to resemble desktop UI as much as possible, whereas Orion's goal is to use the web as the development environment, adhering all of its principles.
+
After conducting a small research about existing web-based PHP editors and IDEs, I came to following conclusions. Most of the solutions are not open source, and often not free. Furthermore, their design is remarkably different from Orion's – they bring desktop experience into a browser, trying to resemble desktop UI as much as possible, whereas Orion's goal is to use the web as the development environment, adhering all of its principles.
 
Web-based PHP editors released under any open source license are sparse. Some of the open source PHP editor projects are abandoned or not updated for more than a year, like IDE.PHP [1], mEdit [2] or CodePress [3]. However, few projects are being actively developed and are worth mentioning.
 
Web-based PHP editors released under any open source license are sparse. Some of the open source PHP editor projects are abandoned or not updated for more than a year, like IDE.PHP [1], mEdit [2] or CodePress [3]. However, few projects are being actively developed and are worth mentioning.
  
Line 16: Line 16:
  
 
Another interesting project is Ace (Ajax.org Cloud9 Editor) [5] developed by Ajax.org and Mozilla. It's a standalone code editor component, used by Cloud9 IDE (among others). It supports syntax highlighting for many languages (including PHP), code indentation, key bindings and more. It's worth noting that Ace and CodeMirror defined a specification document for JavaScript syntax highlighting engines [6].
 
Another interesting project is Ace (Ajax.org Cloud9 Editor) [5] developed by Ajax.org and Mozilla. It's a standalone code editor component, used by Cloud9 IDE (among others). It supports syntax highlighting for many languages (including PHP), code indentation, key bindings and more. It's worth noting that Ace and CodeMirror defined a specification document for JavaScript syntax highlighting engines [6].
 
  
 
= Current Status of Orion =
 
= Current Status of Orion =
Line 41: Line 40:
 
During the discussion with Jacek Pospychala and others we came to conclusion that it'll be best to concentrate on one feature and make it as good as possible, and then implement few other features being a proof of concept, as opposed to trying to develop a lot of features with mediocre quality.
 
During the discussion with Jacek Pospychala and others we came to conclusion that it'll be best to concentrate on one feature and make it as good as possible, and then implement few other features being a proof of concept, as opposed to trying to develop a lot of features with mediocre quality.
  
The main feature I've chosen is "code autocompletion", because it's more challenging than most of others. It also can be done in parts, starting with very limited but usable functionality, and extending it by more production-like solutions.
+
The main feature I've chosen is "syntax highlighting", because it's crucial for any editor. It also can be done in parts, starting with very limited but usable functionality, and extending it by more production-like solutions.
  
The proof of concept features are "syntax highlighting", "syntax checking", "outliner" and "class and method definition finder". They will be implemented with smaller scope than the main feature.
+
Remaining features to be implemented are "syntax checking" and "code autocompletion". They will be implemented with smaller scope than the main feature.
  
Difficulty levels and relations between features were taken into account in Timeline section of this proposal – as a result they are planned to be implemented in different order than presented above. In situation when any feature will need to be withdrawn or will take significantly less time to implement than expected, one of remaining "reserve" feature will be taken into its place. On the other hand, in case of encountering a problem I won't be able to solve in reasonable time, I'll narrow the scope of feature functionality in order to meet the deadlines. Such approach provides great flexibility while ensuring maximal contribution to the project.
+
Difficulty levels and relations between features were taken into account in Timeline section of this proposal. In situation when any feature will need to be withdrawn or will take significantly less time to implement than expected, one of remaining "reserve" features will be taken into its place. On the other hand, in case of encountering a problem I won't be able to solve in reasonable time, I'll narrow the scope of feature functionality in order to meet the deadlines. Such approach provides great flexibility while ensuring maximal contribution to the project.
  
 
= Implementation Details =
 
= Implementation Details =
[work in progress]
 
  
 
== Syntax highlighting ==
 
== Syntax highlighting ==
* Integrate highlighting from Ace / implement support for their's syntax highlighting specification
+
The first part is to implement public-accessible PHP syntax highlighting service. It'll use an open source highlighting library on client-side (Ace) or custom code. Optionally (if time allows) a server-side highlighting solution (GeSHi) will be implemented, to ensure flexibility of API and possibility to easily switch between potential future solutions. An integration layer will also be added to encapsulate implementation and interface.
 +
 
 +
A separate step is to implement Orion plugin which will provide syntax highlighting functionality to the IDE using API mentioned above. This step will require cooperation with Orion developers, but thanks to separation of layers it'll be carried out concurrently with other tasks.
  
 
== Syntax checking ==
 
== Syntax checking ==
* Doing "php -l" on file and returning error information
+
One solution is to use PHP interpreter installed on server side, and pass a script to it invoking with "-l" parameter. Then parse it's output and place error messages on appropriate lines.
* Using ANSLR
+
 
 +
Other option is to use ANTLR to check for correct syntax using PHP grammar file and generated lexer.
  
 
== Code autocompletion ==
 
== Code autocompletion ==
* Consists of two parts:
+
Code autocompletion is divided into three parts (on timeline):
** Completion of standard PHP functions and PHP language syntax
+
 
** Completion of user-defined classes, methods, fields, etc
+
* '''Implement basic infrastructure''' - define UI and behavior of code autocompletion; prepare basic methods to be used in latter parts (like: retrieve a (fragment of) word user tries to autocomplete, create window with suggestions, assist user during filling-in the parameters list, handle mouse and key events) - it needs to be done in a way which is encouraged by Orion's documentation / developers
* Can use ANTLR to create AST
+
* '''Implement code autocompletion for standard PHP functions''' - prepare list of functions' signatures (in an extensible way, not hardcoded), implement autocompletion using basics created in earlier step
 +
* '''Implement code autocompletion for user-defined structures''' - use ANTLR with PHP grammar file to generate lexer and parser; use parser to generate Abstract Syntax Tree; use AST to find matching variables, functions, objects or methods
  
 
= Deliverables =
 
= Deliverables =
Line 78: Line 80:
 
* Identify potential problems that may occur during development
 
* Identify potential problems that may occur during development
  
May 23 -May 29
+
May 23 - June 19
* Implement PHP syntax highlighting
+
* Create public PHP syntax highlighting service using chosen open source client-side highlighting library
 +
* Develop integration API for chosen open source client-side highlighting library
 +
* Cooperate with Orion developers to create syntax highlighting plugin which can easily switch between mentioned implementations (as well as any potential future implementations)
  
May 30 - June 5
+
June 20 - July 10
* Implement code formatting for PHP files
+
* Create public PHP syntax validation service
 +
* Implement syntax validation plugin for Orion incorporating mentioned service underneath, with possibility to easily switch to potential future implementation
  
June 6 - June 12
+
July 11 - July 17
* Develop outline support for PHP files
+
* Implement basic infrastructure for code autocompletion functionality
* Integrate bracket matching for PHP functions
+
  
June 13 - June 19
+
July 18 - July 24
* Add "Jump to definition" feature for functions and methods in same file
+
* Implement code autocompletion for standard PHP functions
* Implement code completion for PHP standard functions
+
  
June 20 - July 3
+
July 25 - August 7
* Implement code validation (syntax checking) feature
+
* Implement code autocompletion for user-defined structures
 
+
July 4 - July 10
+
* Solve problems with features implemented up to this point (before midterm evaluation)
+
* Start implementing content assist feature
+
 
+
July 11 - July 24
+
* Implement content assist feature
+
 
+
July 25 - July 31
+
* Add "Jump to definition" feature for functions and methods defined in another file
+
 
+
August 1 - August 7
+
* Develop syntax expansion feature for PHP constructions (loops, conditional statements)
+
  
 
August 8 - August 14
 
August 8 - August 14
* Add more templates to syntax expansion feature
+
* Solve problems with implemented features - final touches
* Solve problems with implemented features; final touches
+
  
 
August 15 - August 21
 
August 15 - August 21
 
* Write the documentation of the newly implemented PHP editor internals and usage
 
* Write the documentation of the newly implemented PHP editor internals and usage
 
* Write the documentation of problems and obstacles in Orion design encountered during the implementation process of PHP editor
 
* Write the documentation of problems and obstacles in Orion design encountered during the implementation process of PHP editor
 
  
 
= About me =
 
= About me =

Latest revision as of 04:21, 1 May 2011

Abstract

Orion is a new open source project which aim is to provide client-side and server-side architecture for building web-based development tools. Its ambitious goal is to mimic the desktop success of the Eclipse Platform in web environment, becoming the full-featured open source tool integration framework for web-based software development.

To achieve this goal, Orion needs to be designed and developed with great flexibility in mind. Thanks to self-hosting development method Orion is being continuously tested for client-side technologies, such as JavaScript, HTML5 and CSS. However, the real test for platform's flexibility and extensibility is to develop support for new programming language, which is not in the group of primarily targeted languages.

Orion's support for PHP – one of the world's most popular languages – is very important for platform's future success, while the mature codebase of Eclipse's PDT project will provide invaluable help in implementation of PHP editor features. I propose to implement PHP support in Orion Web IDE as my Google Summer of Code 2011 project.


Current Status of Open Source Web-Based PHP Editors

After conducting a small research about existing web-based PHP editors and IDEs, I came to following conclusions. Most of the solutions are not open source, and often not free. Furthermore, their design is remarkably different from Orion's – they bring desktop experience into a browser, trying to resemble desktop UI as much as possible, whereas Orion's goal is to use the web as the development environment, adhering all of its principles. Web-based PHP editors released under any open source license are sparse. Some of the open source PHP editor projects are abandoned or not updated for more than a year, like IDE.PHP [1], mEdit [2] or CodePress [3]. However, few projects are being actively developed and are worth mentioning.

The CodeMirror [4] is a general-purpose JavaScript library for assisted-editing of code-like content, available under MIT-style license. Despite the early stage of development, the library handles source highlighting, indentation, and simple autocompletion.

Another interesting project is Ace (Ajax.org Cloud9 Editor) [5] developed by Ajax.org and Mozilla. It's a standalone code editor component, used by Cloud9 IDE (among others). It supports syntax highlighting for many languages (including PHP), code indentation, key bindings and more. It's worth noting that Ace and CodeMirror defined a specification document for JavaScript syntax highlighting engines [6].

Current Status of Orion

I analyzed the Orion's' client-side code related to the implementation of PHP editor functionality. For example, adding PHP syntax highlighting would mean modifying styler.js file from org.eclipse.orion.client.editor bundle, as there is no extension mechanism implemented for this functionality yet. In case of code completion and assistance, keyword completion could be achieved by altering contentAssist.js code. For syntax checking a dedicated service exist called IEditorSyntaxChecker which can be used to provide this feature for PHP files.

In Orion's current state, there is a risk that implementation of PHP editor features could resemble a bunch of hacks instead of a proof for Orion's extensibility. However, Orion is still in a very early and active development phase and because of this fact the architecture design is expected to change. John Arthorne told me on the orion-dev mailing list [7] that implementation of extension points (among other important changes) is planned for the next milestone, M7. As the deadline is set for April 29th, I will have time for familiarizing myself with changes and finding the best way for adding PHP editor features (the GSoC 2011 coding period starts on May 23rd) while conforming to new design solutions.


PHP Editor Features

The research part of my proposal allowed me to define a set of features that form a good web-based PHP editor (sorted by importance):

  • Syntax highlighting (coloring)
  • Syntax checking (code validation)
  • Code formatting (auto indentation)
  • Code autocompletion (content-assist)
  • Outliner (list of fields and functions / methods defined in file)
  • Class and method definition finder ("jump to definition")
  • Bracket highlighting (parentheses matching)
  • Syntax expansion (code templates)
  • Smart paste (indent on paste)
  • Code folding (function / method collapse)

During the discussion with Jacek Pospychala and others we came to conclusion that it'll be best to concentrate on one feature and make it as good as possible, and then implement few other features being a proof of concept, as opposed to trying to develop a lot of features with mediocre quality.

The main feature I've chosen is "syntax highlighting", because it's crucial for any editor. It also can be done in parts, starting with very limited but usable functionality, and extending it by more production-like solutions.

Remaining features to be implemented are "syntax checking" and "code autocompletion". They will be implemented with smaller scope than the main feature.

Difficulty levels and relations between features were taken into account in Timeline section of this proposal. In situation when any feature will need to be withdrawn or will take significantly less time to implement than expected, one of remaining "reserve" features will be taken into its place. On the other hand, in case of encountering a problem I won't be able to solve in reasonable time, I'll narrow the scope of feature functionality in order to meet the deadlines. Such approach provides great flexibility while ensuring maximal contribution to the project.

Implementation Details

Syntax highlighting

The first part is to implement public-accessible PHP syntax highlighting service. It'll use an open source highlighting library on client-side (Ace) or custom code. Optionally (if time allows) a server-side highlighting solution (GeSHi) will be implemented, to ensure flexibility of API and possibility to easily switch between potential future solutions. An integration layer will also be added to encapsulate implementation and interface.

A separate step is to implement Orion plugin which will provide syntax highlighting functionality to the IDE using API mentioned above. This step will require cooperation with Orion developers, but thanks to separation of layers it'll be carried out concurrently with other tasks.

Syntax checking

One solution is to use PHP interpreter installed on server side, and pass a script to it invoking with "-l" parameter. Then parse it's output and place error messages on appropriate lines.

Other option is to use ANTLR to check for correct syntax using PHP grammar file and generated lexer.

Code autocompletion

Code autocompletion is divided into three parts (on timeline):

  • Implement basic infrastructure - define UI and behavior of code autocompletion; prepare basic methods to be used in latter parts (like: retrieve a (fragment of) word user tries to autocomplete, create window with suggestions, assist user during filling-in the parameters list, handle mouse and key events) - it needs to be done in a way which is encouraged by Orion's documentation / developers
  • Implement code autocompletion for standard PHP functions - prepare list of functions' signatures (in an extensible way, not hardcoded), implement autocompletion using basics created in earlier step
  • Implement code autocompletion for user-defined structures - use ANTLR with PHP grammar file to generate lexer and parser; use parser to generate Abstract Syntax Tree; use AST to find matching variables, functions, objects or methods

Deliverables

  • Example implementation PHP editor in Orion with many interesting features
  • Proof of Orion architecture's flexibility and extensibility
  • Documentation of implementation details and usage instructions for PHP editor
  • Documentation of potential Orion's architecture obstacles which may hinder implementation of additional programming languages' support


Timeline

Prior to May 22

  • Get familiar with new features of Orion M7
  • Decide about final implementation details
  • Identify potential problems that may occur during development

May 23 - June 19

  • Create public PHP syntax highlighting service using chosen open source client-side highlighting library
  • Develop integration API for chosen open source client-side highlighting library
  • Cooperate with Orion developers to create syntax highlighting plugin which can easily switch between mentioned implementations (as well as any potential future implementations)

June 20 - July 10

  • Create public PHP syntax validation service
  • Implement syntax validation plugin for Orion incorporating mentioned service underneath, with possibility to easily switch to potential future implementation

July 11 - July 17

  • Implement basic infrastructure for code autocompletion functionality

July 18 - July 24

  • Implement code autocompletion for standard PHP functions

July 25 - August 7

  • Implement code autocompletion for user-defined structures

August 8 - August 14

  • Solve problems with implemented features - final touches

August 15 - August 21

  • Write the documentation of the newly implemented PHP editor internals and usage
  • Write the documentation of problems and obstacles in Orion design encountered during the implementation process of PHP editor

About me

I'm a 22 years old CS student and Software Engineering passionate, currently living in Poland and attending the Bialystok University of Technology. I'm on my 4th year (1st year of graduate studies - I got my BSc degree in February). Recently I was also accepted to Software Engineering programme at Chalmers University of Technology in Göteborg, Sweden. I'll abort my current studies and start the graduate (Master) level at Chalmers in autumn.

I'm a successful GSoC 2010 participant. I was working with FLOW3 – a PHP Web Application Framework of TYPO3 Association. I was also contributing code during some months after the GSoC (until the degree project came up). My task was providing the internationalization and localization subsystem for the framework (implementing selected features from Unicode's CLDR specification). You can find my contributed code in trunk: [8] (unit tests: [9]). I was also blogging regularly about the progress: [10].

My BSc degree project's main task was to create an OpenGL benchmark for Android. I learned some basics of OpenGL ES and 3D graphics rendering in general, as well as Android development. The application consists of several demo-animations rendered in real-time, which present different parts of OpenGL ES functionality.

I'm comfortable with PHP and Java. I know basics of JavaScript I can learn fast with little or no assistance. I have solid Computer Science knowledge from my undergraduate course, as well as considerable programming experience thanks to GSoC and other activities I undertake in my spare time. I'm also familiar with open source development workflow and tools. Programming is my hobby and I find learning new technologies and languages rewarding.

This is going to be (I hope ;-)) a second year of my participation in Google Summer of Code, so I have an experience how it all works. Furthermore I was preparing myself for a quite long time. I planned to apply for one of other Eclipse projects, but when Orion came up on the ideas' list I knew I need to apply there. I'm sure that Orion will become a big player in field of web-based IDEs in a very near future. The possibility to make my own small contribution towards this goal is very appealing to me. Also, by participating in this project I'll expand my programming and software engineering knowledge, and gain the opportunity to observe day-to-day real-life development process of a new open source software project.

I'm a good candidate for Orion project because I have many traits very important for successful GSoC participant. I'm hard working, fast learning and eager to learn. I'm a type of a person who always tries to plan and organize a work ahead and gets deadlines seriously. I also undertake activities beyond my university course in order to continuously expand my knowledge and become a professional. I hope I'll be allowed to make positive difference for Orion development.

Please visit my homepage [11] for additional information about me. Should you have any questions, please contact me: karol@gusak.eu or kgusak at Freenode.


Bibliography

Back to the top