lsp_server_ce
Dart 語言的 Language Server Protocol 實作。此套件可用於實作支援 Language Server Protocol 的伺服器。
Dart 語言的 Language Server Protocol 实現。
以下為英文專案原文快照,最新內容請造訪 GitHub。
This is a dart implementation of the Language Server Protocol and comes with all serializable objects defined in the specification (v3.17).
The interface also contains the event methods for Document synchronization as well as the Language Features.
Life cycle methods
Language features
Generic registration of listeners for events and methods.
Generic methods to send events and requests
To get a better understanding of how this work it can be useful to look at the official documentation and the similar implementations in node.
LSP Guide for vscode.
LSP Example for vscode.
You can use any stream you want, stdio is commonly used and is easy to set up.
void main() async {
// Create a connection that can read and write data to the LSP client.
// Supply a readable and writable stream. In this case we are using stdio.
// But you could use a socket connection or any other stream.
var connection = Connection(stdin, stdout);
// Register a listener for when the client initialzes the server.
// You are suppose to respond with the capabilities of the server.
// Some capabilities must be enabled by the client, you can see what the client
// supports by inspecting the ClientCapabilities object, inside InitializeParams.
connection.onInitialize((params) async {
return InitializeResult(
capabilities: ServerCapabilities(
// In this example we are using the Full sync mode. This means the
// entire document is sent in each change notification.
textDocumentSync: const Either2.t1(TextDocumentSyncKind.Full),
),
);
});
}
Who should use this? If you want to build a plugin for an editor that supports the LSP format, and you want to build the server in Dart, then this is the package for you. With this package you can implement features such as "linting", "go to reference", giving contextual information and more.
Implement the missing features from the protocol:
依賴清單 10 項
^2.4.2^2.11.0^1.17.1^3.0.0>=0.13.0 <2.0.0^3.0.2^1.8.3^2.1.1^3.0.0^1.21.0先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗