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
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Language Server Protocol 2
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
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
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
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
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
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
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)
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)
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)
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
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.)
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?
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
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
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
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
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
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)
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