86
Smart, slim and good looking Tom Schindl <[email protected]> Twitter: @tomsontom Blog: http://tomsondev.bestsolution.at Website: http://www.bestsolution.at

Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

Smart, slim and good looking

Tom Schindl <[email protected]>

Twitter: @tomsontomBlog: http://tomsondev.bestsolution.atWebsite: http://www.bestsolution.at

Page 2: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

About Tom‣ CTO BestSolution.at Systemhaus GmbH

‣ Eclipse Committer

‣ e4

‣ Platform

‣ EMF

‣ Project lead

‣ e(fx)clipse

‣ Twitter: @tomsontom

‣ Blog: tomsondev.bestsolution.at

‣ Corporate: http://bestsolution.at

Page 3: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

JavaFX applications‣ By default used for database frontends and visualization applications

Page 4: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

JavaFX applications‣ By default used for database frontends and visualization applications

Page 5: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

JavaFX applications‣ By default used for database frontends and visualization applications

Page 6: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

The requirement‣ Provide a lightweight text-editor framework who

‣ Supports declarative definition for syntax highlighting like any sane editor since vi has (exception is Eclipse)

‣ Must be themable

‣ Should not require a workspace (aka core.resources)

‣ Should run in/outside OSGi

‣ Should optionally support Autocomplete, Error Markers, …

Page 7: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

The plan

Page 8: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Make use of org.eclipse.text and provide a declarative wayto configure syntax highlighting

The plan

Page 9: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Make use of org.eclipse.text and provide a declarative wayto configure syntax highlighting

‣ Everything is a service (Highlighting, Auto-complete, …)

The plan

Page 10: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Make use of org.eclipse.text and provide a declarative wayto configure syntax highlighting

‣ Everything is a service (Highlighting, Auto-complete, …)

‣ Fork org.eclipse.jface.text and replace SWT API calls withJavaFX APIs

The plan

Page 11: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Make use of org.eclipse.text and provide a declarative wayto configure syntax highlighting

‣ Everything is a service (Highlighting, Auto-complete, …)

‣ Fork org.eclipse.jface.text and replace SWT API calls withJavaFX APIs

‣ „Houston we have a problem“ JavaFX has no StyledText-Control

The plan

Page 12: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Make use of org.eclipse.text and provide a declarative wayto configure syntax highlighting

‣ Everything is a service (Highlighting, Auto-complete, …)

‣ Fork org.eclipse.jface.text and replace SWT API calls withJavaFX APIs

‣ „Houston we have a problem“ JavaFX has no StyledText-Control

‣ Ok let’s create one!

The plan

Page 13: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

The result

Page 14: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

The result

Page 15: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

The result

Page 16: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

The result

Page 17: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

DI

Basic Architecture

Editor-Control (file:/mysample.ts)

content

auto-complete

syntax highlighting

error-marker

Page 18: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

DI

Basic Architecture

Editor-Control (file:/mysample.ts)

content

auto-complete

syntax highlighting

error-marker

Page 19: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

DI

Basic Architecture

Editor-Control (file:/mysample.ts)

content

auto-complete

syntax highlighting

error-marker

Page 20: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

DI

Basic Architecture

Editor-Control (file:/mysample.ts)

content

auto-complete

syntax highlighting

error-marker

Page 21: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

DI

Basic Architecture

Editor-Control (file:/mysample.ts)

content

auto-complete

syntax highlighting

error-marker

Page 22: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??

Page 23: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

Page 24: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

Page 25: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

Page 26: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

StyleText (Eclipse Text) RichText (regex)

Page 27: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

StyleText (Eclipse Text) RichText (regex)

init - 10 000 Loc 327ms 400ms

Page 28: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

StyleText (Eclipse Text) RichText (regex)

init - 10 000 Loc 327ms 400ms

init - 150 000 Loc 1100ms 3300ms

Page 29: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

StyleText (Eclipse Text) RichText (regex)

init - 10 000 Loc 327ms 400ms

init - 150 000 Loc 1100ms 3300ms

change - 10 000 Loc 30ms 110ms (*)

Page 30: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

StyleText (Eclipse Text) RichText (regex)

init - 10 000 Loc 327ms 400ms

init - 150 000 Loc 1100ms 3300ms

change - 10 000 Loc 30ms 110ms (*)

change - 150 000 Loc 50ms 1800ms (*)

Page 31: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why Eclipse Text??‣ Why using Eclipse Text

‣ it’s fast

‣ it’s faster than fast

StyleText (Eclipse Text) RichText (regex)

init - 10 000 Loc 327ms 400ms

init - 150 000 Loc 1100ms 3300ms

change - 10 000 Loc 30ms 110ms (*)

change - 150 000 Loc 50ms 1800ms (*)* Potential Bug: numbers might be devided by 2

Page 32: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast‣ Eclipse Text is parsing text in 2 phases

‣ First it partitions text

‣ Afterwards it tokenizes text

‣ On change it only has to parse the modified partition instead of the complete file

Page 33: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast?

/** * This is a sample class */ class Sample { //Some information

public void test() { /* * Some more information */ var s =

"Hello World"

; print(s);

} }

Page 34: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast?

/** * This is a sample class */ class Sample { //Some information

public void test() { /* * Some more information */ var s =

"Hello World"

; print(s);

} }

__dart_dartdoc

Page 35: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast?

/** * This is a sample class */ class Sample { //Some information

public void test() { /* * Some more information */ var s =

"Hello World"

; print(s);

} }

__dart_dartdoc

__dart_sl_comment

Page 36: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast?

/** * This is a sample class */ class Sample { //Some information

public void test() { /* * Some more information */ var s =

"Hello World"

; print(s);

} }

__dart_dartdoc

__dart_sl_comment

__dart_ml_comment

Page 37: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast?

/** * This is a sample class */ class Sample { //Some information

public void test() { /* * Some more information */ var s =

"Hello World"

; print(s);

} }

__dart_dartdoc

__dart_sl_comment

__dart_ml_comment

__dart_string

Page 38: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Why is it so fast?

/** * This is a sample class */ class Sample { //Some information

public void test() { /* * Some more information */ var s =

"Hello World"

; print(s);

} }

__dart_dartdoc

__dart_sl_comment

__dart_ml_comment

__dart_string

__dftl_partitioning

Page 39: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Page 40: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Start End MultiLine

Page 41: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Start End MultiLine

dartdoc /** */ !

Page 42: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Start End MultiLine

dartdoc /** */ !

comment single // "

Page 43: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Start End MultiLine

dartdoc /** */ !

comment single // "

comment multi /* */ !

Page 44: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Start End MultiLine

dartdoc /** */ !

comment single // "

comment multi /* */ !

string " " "

Page 45: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Partitioning Rules

Start End MultiLine

dartdoc /** */ !

comment single // "

comment multi /* */ !

string " " "

character ' ' "

Page 46: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Tokenizing a Partition

/** * This is a sample class */ class Sample {

public void test(String s) { print(s); }

}

Page 47: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Tokenizing a Partition

/** * This is a sample class */ class Sample {

public void test(String s) { print(s); }

}

tk(dart_doc,0,25)

Page 48: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Tokenizing a Partition

/** * This is a sample class */ class Sample {

public void test(String s) { print(s); }

}

tk(dart_doc,0,25)

Page 49: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Tokenizing a Partition

/** * This is a sample class */ class Sample {

public void test(String s) { print(s); }

}

tk(dart_doc,0,25)

tk(dart_keyword,27,31)

tk(dart_keyword,41,45)

Page 50: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Tokenizing a Partition

/** * This is a sample class */ class Sample {

public void test(String s) { print(s); }

}

tk(dart_doc,0,25)

tk(dart_keyword,27,31)

tk(dart_keyword,41,45)

tk(dart_default,28,34)

Page 51: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Page 52: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Service 1 - Syntax Highlighting

Page 53: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting

Page 54: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

Page 55: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

Page 56: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

‣ Holds the partitioning and tokenizing information

Page 57: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

‣ Holds the partitioning and tokenizing information

‣ Generated artifacts

Page 58: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

‣ Holds the partitioning and tokenizing information

‣ Generated artifacts

‣ CSS definitions

Page 59: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

‣ Holds the partitioning and tokenizing information

‣ Generated artifacts

‣ CSS definitions

‣ JSON-Configurations

Page 60: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

‣ Holds the partitioning and tokenizing information

‣ Generated artifacts

‣ CSS definitions

‣ JSON-Configurations

‣ Artifacts contributed through OSGi-services

Page 61: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Syntax highlighting‣ Define by DSL (with the help of Xtext)

‣ Designed to be as close to Eclipse-Text as possible

‣ Holds the partitioning and tokenizing information

‣ Generated artifacts

‣ CSS definitions

‣ JSON-Configurations

‣ Artifacts contributed through OSGi-services

Page 62: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Page 63: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Livecoding

Page 64: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

There’s trend going on‣ Language inventors ship headless services providing access to

‣ Semantic information used to build eg Outline-Views

‣ Autocompletion

‣ Error-Reconciling

‣ Benefit for them ALL IDE can add support for the language more easily

Page 65: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Need examples

Page 66: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Dart-Ships the Dart-Analysis-Server

Need examples

Page 67: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Dart-Ships the Dart-Analysis-Server

‣ Typescript ships ts-server and/or an embeddable JS-Component named LanguageService supporting Typescript andsince 1.7 JavaScript

Need examples

Page 68: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Dart-Ships the Dart-Analysis-Server

‣ Typescript ships ts-server and/or an embeddable JS-Component named LanguageService supporting Typescript andsince 1.7 JavaScript

‣ For C# there’s omnisharp built on top of roslyn

Need examples

Page 69: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

‣ Dart-Ships the Dart-Analysis-Server

‣ Typescript ships ts-server and/or an embeddable JS-Component named LanguageService supporting Typescript andsince 1.7 JavaScript

‣ For C# there’s omnisharp built on top of roslyn

‣ go and rust have headless server apps to talk to

Need examples

Page 70: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

TS-Language-Service in Java‣ Java-API provided by BestSolution at github

‣ Uses j2v8 if available else falls back to nashorn

Page 71: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

TS-Language-Service in Java

import at.bestsolution.typescript.service.api.TSServer;import at.bestsolution.typescript.service.api.TSServerFactory;import at.bestsolution.typescript.service.api.services.LanguageService;

TSServerFactory factory = Util.lookupService(TSServerFactory.class);TSServer server = factory.getServer(UUID.randomUUID().toString(), s -> {// ... project init

});LanguageService s = server.getService(LanguageService.class);s.getCompletionsAtPosition("myfile.ts", 100);

‣ Java-API provided by BestSolution at github

‣ Uses j2v8 if available else falls back to nashorn

Page 72: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Autocomplete

Page 73: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Autocomplete‣ Autocomplete is provided by a 2 services

Page 74: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Autocomplete‣ Autocomplete is provided by a 2 services

‣ Core service to get the completion entries

Page 75: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Autocomplete‣ Autocomplete is provided by a 2 services

‣ Core service to get the completion entries

Page 76: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Autocomplete‣ Autocomplete is provided by a 2 services

‣ Core service to get the completion entries

‣ UI service to present them

Page 77: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Autocomplete‣ Autocomplete is provided by a 2 services

‣ Core service to get the completion entries

‣ UI service to present them

Page 78: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Page 79: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Livecoding

Page 80: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Error-Markers

Page 81: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Error-Markers‣ Error markers have use two services

‣ Core-Service to build an Annotation-Model

‣ UI-Bound-Service to visualize the Errors as

‣ Markers next to the Line-Numbers

‣ Overlay in the content area underlining the error

Page 82: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Error-Markers‣ Error markers have use two services

‣ Core-Service to build an Annotation-Model

‣ UI-Bound-Service to visualize the Errors as

‣ Markers next to the Line-Numbers

‣ Overlay in the content area underlining the error

Page 83: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

efxcode - Error-Markers‣ Error markers have use two services

‣ Core-Service to build an Annotation-Model

‣ UI-Bound-Service to visualize the Errors as

‣ Markers next to the Line-Numbers

‣ Overlay in the content area underlining the error

Page 84: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Page 85: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Livecoding

Page 86: Smart, slim and good looking€¦ · StyleText (Eclipse Text) RichText (regex) init - 10 000 Loc 327ms 400ms (c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike

(c) BestSolution.at - Licensed under Creative Commons Attribution-NonCommerical-ShareAlike 3.0

Resources‣ e(fx)clipse - http://efxclipse.org/

‣ Code-Editor Sources - https://github.com/BestSolution-at/eclipsecon2016code