Advanced user level
Language Server Protocol and Implementation: Supporting Language-Smart Editing and Programming Tools
ā Scribed by Nadeeshaan Gunasinghe, Nipuna Marcus
- Publisher
- Apress
- Year
- 2021
- Tongue
- English
- Leaves
- 250
- Category
- Library
No coin nor oath required. For personal study only.
⦠Synopsis
Understand the important aspects of implementing a production-grade language server in support of language-smart tools such as code editors and other programming utilities. This book shows you how to create a single implementation of a language server that can be used by multiple tools, enabling you to do the job once in a way that can be shared and reused.
This book covers the language server protocol used for communication between programming tools and your language server. The book also provides an in-depth understanding of the design, implementation, and user experience aspects which should be considered when implementing a language server. The book walks you through an example language server implementation to illustrate the basic concepts, then goes on to cover advanced aspects of language server use such as progress reporting, launchers, and extension points.
User experience is an important aspect of language server implementation and different tooling vendors strive to provide their own unique user experiences. This book explains how the protocol features can be leveraged to address the unique developer experience provided by different tooling vendors. The book also shows how to enhance the smoothness of the editing experience by orchestrating multiple features together.
What You Will Learn
- Implement a language server from scratch
- Understand language server protocol and its data models
- Leverage the protocol while preserving the unique user experience of different editors
- Extend the protocol to support more than its standard capabilities
- Run a language server on top of launchers such as standard I/O and TCP socket
- Seamlessly incorporate language semantics into your protocol features
Who This Book Is For
Developers focused on and passionate about implementing language development tools such as plug-ins and extensions for interactive development environments (IDEs) or other tools that rely upon parsing of language statements and commands, and developers who need an in-depth understanding of the language server protocol as well as how to use the language server protocol to develop extensible language services
⦠Table of Contents
Table of Contents
About the Authors
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Developer Tools andĀ Language Services
Early Programmable Computers
Code Forms andĀ Punched Cards
Text Editors vs. Source Code Editors
Why IDEs
Language Intelligence
Summary
Chapter 2: Understanding the Language Server Protocol
Understanding JSON-RPC
Request Object
jsonrpc
method
params
id
Notification
Response Object
jsonrpc
result
error
id
Error Object
code
message
data
Batch
Understanding theĀ Base Protocol
Header Part
Content Part
Communication Model
General Messages
Outline Placeholder
window
telemetry
workspace
textDocument
Summary
Chapter 3: Implementing aĀ Language Server
Tools andĀ Dependencies
Building theĀ Project
Compatibility withĀ Ballerina
Debugging theĀ Client andĀ theĀ Server
Understanding theĀ Main Components
Server API
Server Core
Client Implementation
Summary
Chapter 4: General Messages
General Messages
Initialize
Generating theĀ InitializeResult
Initialized
Shutdown
Exit
Window Operations
ShowMessage
ShowMessageRequest
Generating theĀ Request
ShowDocument
Generating theĀ Request
LogMessage
Progress/Create
Progress/Cancel
Summary
Chapter 5: Text Synchronization
General Capabilities
didOpen
Indexing andĀ Project Initialization
didChange
willSave
willSaveWaitUntil
didSave
didClose
Summary
Chapter 6: Diagnostics, Smart Editing, andĀ Documentation
Diagnostics
Initialization andĀ Capabilities
Publishing theĀ Diagnostics
Completion
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ Completions
Text Insertion
Documentation andĀ Additional Information
Sorting andĀ Filtering
Completion Resolve
Signature Help
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ Signature Help
Hover
Initialization andĀ Capabilities
Client Capabilities
Generating theĀ Hover
Summary
Chapter 7: Refactoring and Code Fixes
Rename
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ Workspace Edit
Prepare Rename
Formatting
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ Formatting TextEdits
Range Formatting
Initialization andĀ Capabilities
Generating theĀ Range Formatting TextEdits
On Type Formatting
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ OnĀ Type Formatting TextEdits
Code Actions
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ CodeAction
Request Parameters
Generating theĀ Response
Code Actions Resolve
CodeLens
Initialization andĀ Capabilities
Client Capabilities
Server Capabilities
Generating theĀ Response
CodeLens Resolve
CodeLens Refresh
Summary
Chapter 8: Code Navigation andĀ Navigation Helpers
Reference
Client Capabilities
Server Capabilities
Generating theĀ Response
Definition
Client Capabilities
Server Capabilities
Generating theĀ Response
Type Definition
Client Capabilities
Server Capabilities
Generating theĀ Response
Implementation
Client Capabilities
Server Capabilities
Generating theĀ Response
Declaration
Client Capabilities
Server Capabilities
Generating theĀ Response
Document Symbol
Client Capabilities
Server Capabilities
Generating theĀ Response
Using SymbolInformation
Using DocumentSymbol
Document Highlight
Client Capabilities
Server Capabilities
Generating theĀ Response
Document Link
Client Capabilities
Server Capabilities
Generating theĀ Response
Document Link Resolve
Summary
Chapter 9: Presentation andĀ Selection
Semantic Tokens
Client Capabilities
Server Capabilities
Generating theĀ Response
Semantic Tokens forĀ Whole DocumentĀ ā full
Semantic Tokens forĀ Whole DocumentĀ ā full/delta
Semantic Tokens forĀ aĀ RangeĀ ā range
Encoding andĀ Decoding aĀ Token
Document Color
Client Capabilities
Server Capabilities
Generating theĀ Response
Color Presentation
Generating theĀ Response
Folding Range
Client Capabilities
Server Capabilities
Generating theĀ Response
Selection Range
Client Capabilities
Server Capabilities
Generating theĀ Response
Linked Editing Range
Client Capabilities
Server Capabilities
Generating theĀ Response
Prepare Call Hierarchy
Client Capabilities
Server Capabilities
Generating theĀ Response
Call Hierarchy Incoming
Generating theĀ Response
Call Hierarchy Outgoing
Generating theĀ Response
Summary
Chapter 10: Workspace Operations
Workspace Folders
Client Capabilities
Server Capabilities
Sending theĀ Request
Workspace Folders Change Notification
Client Capabilities
Server Capabilities
Processing theĀ Notification
Notification ofĀ Configuration Change
Client Capabilities
Processing theĀ Notification
Configuration
Client Capabilities
Generating theĀ Request
Watched Files Change Notification
Client Capabilities
Registration Options
Processing theĀ Notification
Workspace Symbol
Client Capabilities
Server Capabilities andĀ Registration Options
Generating theĀ Response
Execute Command
Client Capabilities
Server Capabilities
Executing theĀ Command
Apply Edit
Client Capabilities
Sending theĀ Request
Will Create Files
Client Capabilities
Registration Options
Generating theĀ Response
Did Create Files
Client Capabilities
Server Capabilities
Handling theĀ Notification
Will Rename Files
Client Capabilities
Server Capabilities
Generating theĀ Response
Did Rename Files
Client Capabilities
Server Capabilities
Handling theĀ Notification
Will Delete Files
Client Capabilities
Server Capabilities
Generating theĀ Response
Deleted Files Notification
Client Capabilities
Server Capabilities
Handling theĀ Notification
Summary
Chapter 11: Advanced Concepts
Work Done Progress
Begin Progress
Report Progress
End Progress
Implementing theĀ Server-Initiated Progress
Partial Result Support
Working withĀ Launchers
Extension Points
Implementing andĀ Extending Protocol Services
Request Parameters
Response Parameters
Implementing theĀ Service
Supporting Multiple Languages
Dynamic Registration ofĀ Capabilities
Implementing aĀ Delegator Mechanism
Summary
Index
š SIMILAR VOLUMES
Advanced user level
Exceptionally comprehensive in approach, this book explores the major issues in both design and implementation of modern programming languages and provides a basic introduction to the underlying theoretical models on which these languages are based. The emphasis throughout is on fundamental concepts
Programming Languages: Concepts and Implementation is a textbook on the fundamental principles of programming languages through a combination of concept-based and interpreter-based approaches. The book has an implementation-oriented focus and features conceptual and programming exercises that give s