Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Protocol Buffers Language Server

micnncim
September 13, 2019

Protocol Buffers Language Server

Mercari Summer Internship for Engineer 2019

micnncim

September 13, 2019
Tweet

More Decks by micnncim

Other Decks in Programming

Transcript

  1. @ m i c n n c i m
    Protocol Buffers
    Language Server
    Mercari Summer Internship for Engineer 2019

    View full-size slide

  2. TABLE OF
    CONTENTS
    About Me
    What is Internship at Merpay Expert Team?
    What is Language Server Protocol?
    What is Protocol Buffers?
    What is Protocol Buffers Language Server?
    Future Work

    View full-size slide

  3. ABOUT ME
    @micnncim
    Team: Merpay Expert Team
    Twitter: @micnncim
    GitHub: @micnncim
    Interest: Go, Cloud Native, DevOps
    Blog: micnncim.github.io

    View full-size slide

  4. What is Internship at
    Merpay Expert Team?
    Introduction

    View full-size slide

  5. Internship at
    Merpay Expert Team
    1 Go
    Anything written by Go.
    2 OSS
    Anything related to OSS.
    Contributions to OSS
    or/and
    OSS from scratch.

    View full-size slide

  6. My Output:
    Protocol Buffers
    Language Server
    Language Server for Protocol Buffers
    Almost nothing ever.

    View full-size slide

  7. What is
    Language Server Protocol?

    View full-size slide

  8. Language Server Protocol
    1 Language Server
    Language-specific smarts
    inside a server.
    Communicate with client
    in editor / IDE.
    2 Protocol
    A single Language Server
    can be re-used
    in multiple development tool.
    3 Communication
    Development tools
    communicate with server
    over JSON-RPC.

    View full-size slide

  9. Without LSP
    https://github.com/gophercon/2019-talks/blob/master/RebeccaStambler-GoPleaseStopBreakingMyEditor/slides.pdf

    View full-size slide

  10. With LSP
    https://code.visualstudio.com/api/language-extensions/language-server-extension-guide

    View full-size slide

  11. Implementations
    https://microsoft.github.io/language-server-protocol/implementors/servers

    View full-size slide

  12. Implementations
    https://microsoft.github.io/language-server-protocol/implementors/servers
    No Language Server
    for Protocol Buffers!

    View full-size slide

  13. What is
    Protocol Buffers?

    View full-size slide

  14. Protocol Buffers
    IDL
    Defines structure
    once,
    then you can use
    generated code
    by multiple languages.
    Serializer
    Serializes binary based
    data.
    Faster than JSON, etc.
    Pluggable Design
    Uses plugins like
    `protoc-gen-`
    to be extensible.

    View full-size slide

  15. Protocol Buffers
    https://www.youtube.com/watch?v=AW09fAsEb00

    View full-size slide

  16. What is
    Protocol Buffers
    Language Server?
    micnncim/protocol-buffers-language-server

    In progress...
    mercari/protocol-buffers-language-server

    View full-size slide

  17. Protocol Buffers
    Language Server
    Definition
    Supports
    `textDocument/definition`.
    Completion
    Supports
    `textDocument/completion`
    Text Sync
    Supports
    `textDocument/didOpen`
    `textDocument/didChange`
    `textDocument/didSave`

    View full-size slide

  18. How to implement?
    Parse code
    All parsers of
    protobuf written by
    Go are incomplete
    so it's so hard to get
    desirable info.
    Follow Protocol
    LSP gives protocol of
    >50 methods for
    language features
    Run with JSON-RPC
    Implement communication
    with JSON-RPC

    View full-size slide

  19. Hard points
    All of
    language features
    e.g.)
    godef, gopkgs, gocode,
    guru, gorename, goimports,
    dlv, goformat, golint, ...
    Text
    Synchronization
    Manages files
    and status of files
    in many workplaces:
    Open, Change, Save

    View full-size slide

  20. https://github.com/gophercon/2019-talks/blob/master/RebeccaStambler-GoPleaseStopBreakingMyEditor/slides.pdf
    Implement All!
    Hard points

    View full-size slide

  21. Implement
    Other Functions
    textDocument/hover
    textDocument/publishDia
    gnostics
    textDocument/rename
    etc.
    Release
    Packages
    Homebrew
    Linuxbrew
    Snap
    etc.
    Improve
    Performance
    go-language-server/protocol
    go-language-server/jsonrpc2
    Future Work

    View full-size slide

  22. THANK YOU!
    Twitter: @micnncim
    GitHub: @micnncim
    My Gophers
    from GopherCon and Go Conference Tokyo

    View full-size slide