Slide 1

Slide 1 text

Pavel Fatin Alexander Podkhalyuzin Scalathon, 2011 Scala plugin for IntelliJ IDEA

Slide 2

Slide 2 text

Thank you!

Slide 3

Slide 3 text

IntelliJ Scala Plugin Agenda  Why do we need it  What's inside  How it's made  How to contribute

Slide 4

Slide 4 text

Do we need an IDE for Scala?

Slide 5

Slide 5 text

Can't we just use Notepad? Rationale 

Slide 6

Slide 6 text

Is it always the right tool? Rationale ?

Slide 7

Slide 7 text

What makes us more productive?  Highlighting  Inspections  Code formatting  Auto-completion  Information look-up  Refactoring  Integration Rationale

Slide 8

Slide 8 text

What's already available?

Slide 9

Slide 9 text

Syntax highlighting Injected language By-name argument Implicit conversion Deprecated method Features

Slide 10

Slide 10 text

Error highlighting  Ordinary:  Type-aware:  Quick-fixes: Features

Slide 11

Slide 11 text

Inspections  Unused symbol  Variable could be value  Redundant return  Syntactic sugar  Method signature inspections Features

Slide 12

Slide 12 text

Language injection  Pattern-based:  Via parameter annotation:  Via value annotation: Features

Slide 13

Slide 13 text

Dark color schemes Features

Slide 14

Slide 14 text

Language-aware editor  Brace balancing:  Entities selection:  Code folding: Features

Slide 15

Slide 15 text

Formatting Features

Slide 16

Slide 16 text

Code completion Features

Slide 17

Slide 17 text

Information look-up  Type info  Parameter info  Documentation look-up  Definition look-up Features

Slide 18

Slide 18 text

Type Info Features

Slide 19

Slide 19 text

Parameter info Features

Slide 20

Slide 20 text

Documentation look-up Features

Slide 21

Slide 21 text

Definition look-up Features

Slide 22

Slide 22 text

Imports management  Import entity on completion  Auto-import unresolved symbol  Highlight unused imports  Optimize imports  Paste imports Features

Slide 23

Slide 23 text

Refactoring  Rename  Introduce variable  Inline variable  Extract method  Introduce parameter Features

Slide 24

Slide 24 text

Rename Features

Slide 25

Slide 25 text

Introduce variable Features

Slide 26

Slide 26 text

Inline variable Features

Slide 27

Slide 27 text

Extract method Features

Slide 28

Slide 28 text

Introduce parameter Features

Slide 29

Slide 29 text

Integrations  Java  JUnit / Specs / ScalaTest  Maven  Spring  Lift  SBT Features

Slide 30

Slide 30 text

How it's made (It's not rocket science theoretical physics)

Slide 31

Slide 31 text

Building the project  Get the latest IDEA EAP build  Download IDEA sources  Enable DevKit plugin  Configure a Plugin SDK  Clone Scala plugin repository  Open the project in IDEA Architecture

Slide 32

Slide 32 text

Plugging the plugin  Plugin.xml  OpenAPI Architecture

Slide 33

Slide 33 text

Code processing Document Lexer Parser Wrapper PSI Architecture Text Tokens AST

Slide 34

Slide 34 text

Processing example Literal Literal ReferenceExpression ReferenceExpression WhiteSpace WhiteSpace Architecture STRING WS IDENTIFIER TRUE "that's" + WhiteSpace WhiteSpace Literal Literal true WS InfixExpression InfixExpression

Slide 35

Slide 35 text

PSI viewer Architecture

Slide 36

Slide 36 text

PSI foundation Architecture PsiElement textRange parent children prevSibling nextSibling add(element) addBefore(element, anchor) addAfter(element, anchor) delete() replace(newElement)

Slide 37

Slide 37 text

PSI elements hierarchy Scala Architecture PsiFile ScTypeDefinition ScalaFile PsiComment ScGenerator PsiClass PsiElement

Slide 38

Slide 38 text

Scala Language Specification Architecture

Slide 39

Slide 39 text

Scala domain elements Architecture ScClass name constructor superTypes members extendsblock add(member, anchor) remove(member) isInheritor(psiClass)

Slide 40

Slide 40 text

TODO

Slide 41

Slide 41 text

Tasks  Bug fixes  Inspections  Refactorings  Intentions  Frameworks support  Type system improvement  [Your most wanted feature here] TODO

Slide 42

Slide 42 text

Everyone is Welcome!