搜尋套件、儲存庫與 APP 分類

套件詳情v0.4.0

lsp_server_ce

Dart 語言的 Language Server Protocol 實作。此套件可用於實作支援 Language Server Protocol 的伺服器。

AndroidiOSLinuxmacOSWebWindows
近 30 天下載
6.4萬
喜歡數
0
Pub 分數
130

安裝套件

flutter pub add lsp_server_ce

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Dart 實作的 Language Server Protocol (LSP),讓開發者能建構語言伺服器,為編輯器與 IDE 提供程式碼自動完成、診斷與重構等功能。此套件支援所有主要平台,並可無縫整合至 Flutter 專案。專為希望使用 LSP 標準擴充文字編輯器語言功能的工具作者設計。

適用情境

  • 為 Dart 或其他語言建構自訂語言伺服器
  • 將進階程式碼智慧整合至IDE中
  • 啟用即時語法檢查和建議
  • 使用豐富的語言功能建立編輯器擴充
  • 支援多平台開發工作流程

主要特色

  • 完整的 LSP 規範相容性
  • 跨平台支援(Android、iOS、Linux、macOS、Web、Windows)
  • 輕鬆整合至Flutter應用
  • 模組化設計,用於可擴充的語言伺服器邏輯
  • 內建對 LSP 消息與通訊協定的處理

適合對象

  • Dart 工具開發人員
  • IDE 插件創建者
  • 語言特性實作者
  • 程式碼分析工具建構者
  • 多平台開發團隊

使用建議

  • 需要了解語言伺服器協議
  • 可能需要額外設定以支援複雜的語言功能
  • 最適合熟悉伺服器-客戶端通訊模式的開發者
  • 不直接用於終端使用者應用程式
  • 依賴於編輯器相容性的正確設定

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

LSP Server

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.

Features

  • Life cycle methods

  • Language features

  • Generic registration of listeners for events and methods.

  • Generic methods to send events and requests

Getting started

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.

Full LSP spec definition.

LSP Guide for vscode.

LSP Example for vscode.

Usage

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),
      ),
    );
  });
}

Additional information

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.

Todo

Implement the missing features from the protocol:

  • workspaces
  • window
  • notebook
  • client (dynamic capabilities)
  • trace

所屬分類

依賴

依賴清單 8 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。

所在榜單