Auto-sync: 2026-04-21 00:02
This commit is contained in:
32
wiki/concepts/LSP-Language-Server-Protocol.md
Normal file
32
wiki/concepts/LSP-Language-Server-Protocol.md
Normal 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 Protocol(LSP)是微软提出的标准化协议,为编辑器/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)]]
|
||||
Reference in New Issue
Block a user