Files
nexus/wiki/concepts/LSP-317-Specification.md

37 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "LSP 3.17 Specification"
type: concept
tags: [protocol, language-server, standardization]
sources: [lsp-index-engineer]
last_updated: 2026-04-25
---
## Definition
Language Server Protocol 3.17LSP 3.17)是 Microsoft 发起的语言服务器协议的最新版本,定义了编辑器/IDE 与语言服务器之间的标准化 JSON-RPC 通信规范,使得不同语言可以有统一的方式提供代码智能功能(跳转到定义、查找引用、悬停文档等)。
## Core Components
- **JSON-RPC 2.0**:基于 JSON 的远程过程调用协议
- **Server Capabilities**:服务器声明其支持的功能(如 definitionProvider、referencesProvider
- **Client Capabilities**:客户端声明其支持的功能
- **Lifecycle**initialize → initialized → shutdown → exit
- **textDocument/* 请求**textDocument/definition、textDocument/references、textDocument/hover 等
## Why LSP 3.17
LSP/Index Engineer 严格遵循 LSP 3.17 规范进行所有客户端通信正确处理每个语言服务器的能力协商。LSP 3.17 相比早期版本增加了:
- 增量同步Incremental同步
- Call Hierarchy 和 Type Hierarchy
- 更完整的诊断能力
- 更好的多根工作区支持
## Implementation Note
LSP/Index Engineer 的核心约束:**永远不要假设能力,必须始终检查服务器能力响应**。这确保了 graphd 能与任何符合 LSP 规范的服务器协作。
## Aliases
- LSP
- Language Server Protocol
- LSP 3.17