Auto-sync: 2026-04-21 00:02

This commit is contained in:
2026-04-21 00:02:55 +08:00
parent 177469a1cd
commit cb7c11e14f
235 changed files with 16567 additions and 237 deletions

View File

@@ -0,0 +1,32 @@
---
title: "LSP (Language Server Protocol)"
type: concept
tags: [protocol, code-intelligence, editor]
last_updated: 2026-04-20
---
## Definition
Language Server ProtocolLSP是微软提出的标准化协议为编辑器/IDE 提供编程语言特性支持(自动补全、跳转定义、悬停文档等),实现语言功能与编辑器的解耦。
## Core Features
- **文本文档同步**textDocument/didOpen、textDocument/didChange
- **代码导航**textDocument/definition、textDocument/references、textDocument/documentSymbol
- **代码补全**textDocument/completion
- **悬停文档**textDocument/hover
- **诊断信息**textDocument/publishDiagnostics
## LSP 3.17 Key Capabilities
- 能力协商机制initialize 阶段交换 serverCapabilities
- 完整生命周期管理initialize → initialized → shutdown → exit
- Workspace symbols 和 文件 URI 标准化
## Language Servers
- TypeScript: typescript-language-server
- PHP: intelephense, phpactor
- Go: gopls
- Rust: rust-analyzer
- Python: pyright, pylance
## Connections
- [[graphd]] ← 依赖使用 ← [[LSP (Language Server Protocol)]]
- [[LSP Client Orchestration]] ← 基于 ← [[LSP (Language Server Protocol)]]