Slide 1

Slide 1 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Implementing Language Servers the Good, the Bad, the Ugly Martin Lippert @martinlippert

Slide 2

Slide 2 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Language Server Protocol 2

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 3 https://code.visualstudio.com/images/2016_06_27_language-server-protocol.png

Slide 4

Slide 4 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 4 https://code.visualstudio.com/images/2016_06_27_language-server-sequence.png

Slide 5

Slide 5 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Our Background 5

Slide 6

Slide 6 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 6 and more to come… Cloud Foundry Manifest Files Concourse CI Pipeline Manifests BOSH Deployment Manifest Files

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The Good Parts 7

Slide 8

Slide 8 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ write once, run in any editor/IDE 8 great for language builders great for framework builders

Slide 9

Slide 9 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ write in a language of your choice 9 never re-write a parser (and incremental compiler) for C++, JavaScript, C# etc. in Java again

Slide 10

Slide 10 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ re-use the libraries of your choice 10 don’t worry about OSGi-compatible versions of your libraries anymore

Slide 11

Slide 11 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ready-to-use libraries available 11 node-based (from VSCode) java-based (lsp4j)

Slide 12

Slide 12 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ great for black-box testing 12 startup in process send messages observe the results (as messages)

Slide 13

Slide 13 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ separate processes 13 never get a blocking UI again all async by design if it crashes, don’t worry - just restart specific process arguments possible (e.g. JVM arguments)

Slide 14

Slide 14 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ protocol extensions 14 you can enhance the protocol for your needs define custom messages

Slide 15

Slide 15 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The Bad Parts 15

Slide 16

Slide 16 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ you might have to do the work twice 16 you can’t benefit from the work of other language servers (e.g. parsing Java code, using the index, etc.)

Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ too many processes ? 17 what happens if you start a JVM language server process for every Java project in your workspace?

Slide 18

Slide 18 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ server processes don’t have a UI 18 the nature of a server… :-) but requires extra work if you need UI interaction

Slide 19

Slide 19 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ protocol extensions 19 you have to write the client code for each and every client yourself dive into the API details of the clients again

Slide 20

Slide 20 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The Ugly Parts 20

Slide 21

Slide 21 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ every client is different 21 you have to test against every single client this can become a real nightmare sometimes feature flags necessary

Slide 22

Slide 22 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ the protocol has room for interpretation 22 e.g. code completion - magic indentation could also be a good thing and solved and detailed over time

Slide 23

Slide 23 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ the glue code 23 every client has a different way how to integrate language servers

Slide 24

Slide 24 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Summary 24

Slide 25

Slide 25 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ LSP - is THE WAY TO GO 25 more and more clients better and better clients focus on what you are good at (language, framework, editor)

Slide 26

Slide 26 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Thanks!!! 26 Download STS from: https://spring.io/tools Ask questions on Stack Overflow: http://stackoverflow.com/questions/tagged/spring-tool-suite Report issues: https://github.com/spring-projects/spring-ide