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

SourceKit-LSPをブラウザでコードを読むために活用する

 SourceKit-LSPをブラウザでコードを読むために活用する

SourceKit-LSPをブラウザでコードを読むために活用する
1. SourceKit for Safari Demo
2. SourceKit-LSPとは
3. LSP(Language Server Protocol)とは
4. SourceKit-LSPを使ってみる
5. SourceKit-LSPと通信する
6. Safari ExtensionとSourceKit-LSPを連携する
7. iPadでSourceKit-LSPを使う!?

w/ Presenter Note
https://www.icloud.com/keynote/0TuUNBtyBEnm5Mxqe0o7ROIRQ#iOSDC_-_SourceKit_LSP

Kishikawa Katsumi

September 19, 2020
Tweet

More Decks by Kishikawa Katsumi

Other Decks in Programming

Transcript

  1. ໨࣍ 1. SourceKit for Safari Demo 2. SourceKit-LSPͱ͸ 3. LSPʢLanguage

    Server Protocolʣͱ͸ 4. SourceKit-LSPΛ࢖ͬͯΈΔ 5. SourceKit-LSPͱ௨৴͢Δ 6. Safari ExtensionͱSourceKit-LSPΛ࿈ܞ͢Δ 7. iPadͰSourceKit-LSPΛ࢖͏ʂʁ
  2. SourceKit-LSPͱ͸ SourceKit-LSP is an implementation of the Language Server Protocol

    (LSP) for Swift and C-based languages. It provides features like code-completion and jump-to-definition to editors that support LSP. SourceKit-LSP is built on top of sourcekitd and clangd for high-fidelity language support, and provides a powerful source code index as well as cross-language support. https://github.com/apple/sourcekit-lsp
  3. LSPʢLanguage Server Protocolʣͱ͸ Adding features like auto complete, go to

    definition, or documentation on hover for a programming language takes significant effort. Traditionally this work had to be repeated for each development tool, as each tool provides different APIs for implementing the same feature. A Language Server is meant to provide the language-specific smarts and communicate with development tools over a protocol that enables inter-process communication. The idea behind the Language Server Protocol (LSP) is to standardize the protocol for how such servers and development tools communicate. This way, a single Language Server can be re-used in multiple development tools, which in turn can support multiple languages with minimal effort. https://microsoft.github.io/language-server-protocol/
  4. SourceKit-LSPΛ࢖ͬͯΈΔ with VS Code 1. SourceKit-LSP Visual Studio Code extensionΛϏϧυɾΠϯετʔϧ

    2. VS CodeʹSourceKit-LSPͷઃఆΛ͢Δ https://github.com/apple/sourcekit-lsp/tree/master/Editors#visual-studio-code
  5. SourceKit-LSPͱ௨৴͢Δ The protocol does not make any provisions about how

    requests, responses and notifications are transferred between client and server. https://en.wikipedia.org/wiki/Language_Server_Protocol#Transport_layer
  6. SourceKit-LSPͱ௨৴͢Δ The protocol does not make any provisions about how

    requests, responses and notifications are transferred between client and server. In this implementation, an editor communicates through stdin/stdout with the TypeScript server process and uses a JSON payload https://en.wikipedia.org/wiki/Language_Server_Protocol#Transport_layer https://docs.microsoft.com/en-us/visualstudio/extensibility/language-server-protocol?view=vs-2019#how-work-on-the-lsp-started