41
Crowdsourcing, Code Snippets, and more What Eclipse Code Recommenders has been up to for Luna @MarcelBruch +MarcelBruch

Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Embed Size (px)

DESCRIPTION

These slides present SnipMatch, an extensible snippet search and snippet completion engine for Eclipse.

Citation preview

Page 1: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Crowdsourcing, Code Snippets, and more

What Eclipse Code Recommenders has been up to for Luna

@MarcelBruch +MarcelBruch

Page 2: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

ONCE UPON A TIME…„Based on a true story…“

Page 3: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

3

That guy had a smart idea how to make Eclipse even better…

Thanks to Eike Stepper for permission to reuse his portraits :-)

Page 4: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

…he created an extension point…

4

Page 5: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

How can I read all extensions known to the

system?

5

Page 6: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

6

Hey, this was done so many times before. It should be easy to find an example…

Page 7: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

7

Page 8: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

7

Page 9: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

7

Page 10: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

7

Page 11: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

8

Page 12: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

9

I GIVE UP!

Page 13: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

But indeed there is an example…

10

IExtensionRegistry registry = Platform.getExtensionRegistry();IExtensionPoint point = registry.getExtensionPoint(EXT_POINT_ID);!for (IExtension ext : point.getExtensions()) { for (IConfigurationElement elem : ext.getConfigurationElements()) { MyProvider provider = elem.createExecutableExtension(CLASS_ATTR); res.add(provider); }}return res;

Page 14: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

SNIPMATCH„An (extensible) code snippet completion and search engine for Eclipse“

Page 15: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Live Demo

12

Searching for snippets inside the Snipmatch view

Page 16: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Live Demo

13

Searching for snippet in lightweight snippet search window

Page 17: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Live Demo

14

Inserting snippets with links, new var names, …

Page 18: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Live Demo

15

Create snippet from text selection

Page 19: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Live Demo

16

Xtext editor with syntax highlighting…

Page 20: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

17

Hmm, if creating own snippets is so simple, why not

share them with others?

Page 21: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Snippets arrayadd

arraymerge ...

Awesome New

Snippet

Snippets arrayadd

arraymerge ...

Snippets arrayadd

arraymerge ...

Snippets arrayadd

arraymerge ...

Crowdsourcing code snippets?

18

Page 22: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Snippets arrayadd

arraymerge ...

Awesome New

Snippet

Snippets arrayadd

arraymerge ...

Snippets arrayadd

arraymerge ...

Snippets arrayadd

arraymerge ...

Crowdsourcing code snippets?

18

Page 23: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Snippet Repository

Snippets arrayadd

arraymerge ...

Awesome new

Snippet

Snippets arrayadd

arraymerge ...

Snippets arrayadd

arraymerge ...

Snippets arrayadd

arraymerge ...

Crowdsourcing code snippets!

19

Page 24: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Live Demo

20

Sharing snippets via Gerrit Review System…

Page 25: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

21

Cool stuff!What’s planned for 2.2?

Page 26: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Snipmatch 2.2 Roadmap for SR1• Class-path dependent snippet proposals:

• No SWT on your class-path? => No SWT snippets.

• Xtext based snippet editor: • with syntax highlighting, code completion,error detection.

(preview demo’ed)

• Multiple repositories: • Gerrit, git, file, db, …

• General snippet goodness: • Create snippets from text selection. • Voting and commenting on snippets (SR2 maybe).

• Many more (crowdsourced and mined) snippets!22

Page 27: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Get ready for Eclipse Luna!

23

Page 28: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Get it from Luna update site!

24

Page 29: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Grab it from the Marketplace…

25

Page 30: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Credits• Credits for the emotion-portraits go to Eike Stepper.

• Thanks for permission to use themhere at the Eclipse Democamp Zürich.

26

Page 31: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Crowdsourcing, Code-Snippets, and more

What Eclipse Code Recommenders has been up to for Luna

@recommenders +code recommenders

Page 32: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

ANYTHING ELSE?

Page 33: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Mylyn Integration

29

Page 34: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Completion Tips

30

Page 35: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

More frameworks

31

0

950

1900

2850

3800

Kepler Luna (M3) Luna (M7) Luna

Page 36: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

More frameworks

31

Luna

Page 37: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

Crowdsourcing code completion?

32

Codetrails Connect Community Edition, Install from http://www.codetrails.com/connect

Page 38: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

!void ctor() {! List l = new A…}

Crowdsourcing constructor completion

33

What is the mostly likely completion a developer looks for in this particular situation ?

Page 39: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

!void ctor() {! List l = new A…}

Use (costly) subtype checks

34

Codetrails Completion Tweaks for Eclipse, Install from http://download.codetrails.com/updates/connect/

Page 40: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

But you may also crowdsource this...

35

It learns from you. From the very 1st moment.

Codetrails Connect Community Edition, Install from http://download.codetrails.com/updates/connect/

Page 41: Eclipse DemoCamp Zurich - SnipMatch in Recommenders 2.1

!void quickfix() {! List l = new A}

How about fixing quick-fix?

36Not fixed yet. But could be easily - when you start sharing your knowledge…