IAC 2024 - IA Fast Track to Search Focused AI Solutions
[EclipseCon France 2017] Eclipse Platform Generic Editor
1. The New Generic and
Extensible Code Editor
Easily-extendable Eclipse Text Editor for quick
language support and more
A talk for Eclipse Platform plugin developers
5. The New Generic and
Extensible Code Editor
Easily-extendable Eclipse Text Editor for quick
language support and more
A talk for Eclipse Platform plugin developers
6. State of art – the good
Awesome separation and interaction of
– 💾 The file: the main user concept
●
Storage
●
Errors/Warnings
●
Navigation in Project Explorer
– 💾 The document and buffer: Working copy
●
Where on-the-fly validation happens
– ✎ The editor: where and how you edit
●
Supposed to host plain edition features (edition, completion, hover…)
●
Show document issues and allow to interact with them
✘ ✔
7. State of art – the “bad”
So many similar editorS,,,
– As an Eclipse plugin developer
●
Lot of very Eclipse-specific boilerplate glue code and duplication with other editors
●
Current design encourages to put language logic in the editor so reduce re-usability
●
Current design requires active effort for consistency
●
Editor isn’t extensible
– As an Eclipse IDE user
●
Need to find the right editor for the right feature
●
Logic is tied to editor when user thinks about files
●
Different similar editors can have inconsistent behaviors (shortcuts…)
8. “Prefer composition over inheritance”
“Don’t call us, we’ll call you –
Hollywood Principle”
-
(Strategy and extensibility pattern)
Solution – consider good old OO design patterns
9. A ‘Generic’ editor for the IDE ?
- One Editor & Multiple per-language extensions versus One Editor per language approach
- Instead of creating an editor, ‘smarten up’ the generic editor to sense and support a language
10. Features – June 2017
- Extensible asynchonous autocomplete
- Extensible hover (tooltip) information
- Extensible syntax highlighting
- Renders errors/warnings/quickfixes
- Similar concept to the way Notepad++ or Monaco work
11. The editor is an empty shell, it will do as much as content you provide it through
extensions
“Extensible”, you said?
12. And how exactly does it work in practice?
1.Get a new or existing plug-in project
2.Add an extension to e.g.
org.eclipse.ui.genericeditor.presentationReconcilers
a.Supply a content-type for which this code will work
3.Write the presentation (or autocomplete or hover) logic code
15. Underlying Vision
1. Productivity & Time to market: Make possible quick language support with
very little boilerplate
2. Separation of concerns: Abstract out the provider of the ‘smartness’ for a
given language
– Opens the road to using language servers
3. Quality, maintenance & DRY: do we need as many text editors as languages
a. More factorization (less maintenance cost)
b. More consistency
c. Less memory consumption
17. Use it now!
1. Try it out!
a. Oxygen have a plug-in template wizard for that
b. Try it for your use-case and give feedback
2. Contribute basic support for a language
a. It doesn’t have to be a well-defined language
b. E.g. The sample is for .project file editor
20. Future Plans
1.Get Generic Editor infrastructure improved
a. more extension points (folding, auto-edit, bracket matching…)
2.Platform to provide a more complete framework for code edition,
beyond just editor
a. Common commands and shortcuts (to avoid duplication/inconsistencies)
3.Keep making Content-Types a 1st
class-citizen in the IDE
a. Add icon
b. Let user define content-type/editor association in preferences
21. Many thanks to those who helped with reviewing
esp. Daniel Megert & Alenksandar Kurtakov
Sopot : Beginning to ‘Viola!’ slide - 5 min
Mickael: ‘Underlying vision’ to ‘Demo 1’, - 5 min
demo 1- 10-15 minutes
demo 2-
Sopot : Beginning to ‘Viola!’ slide - 5 min
Mickael: ‘Underlying vision’ to ‘Demo 1’, - 5 min
demo 1- 10-15 minutes
demo 2-
Cut a hole in a box…
Put your junk in that box…
Make her open the box!
Open C# file
Hover on some code to initiate server
move mouse away from code and click on last line to prevent it form doing over request while server loads
talk about syntax highlightinh
wait for markers to be shown
Show completion and complete it (BackgroundColor.GetType())
Show hover
This could have been done with a new separate editor, but it’s the opposite of what we want