lsp.lua

---@meta LSP.

local lsp = {}

---@class ClientOptions
---@field name string The name under which to register the language server.
---@field cmd function|string[] The command to start the language server, or a function returning a string[].
---@field transport? "stdio"|"localsocket" Defaults to stdio.
---@field serverName? string The socket path when transport == "localsocket".
---@field languageFilter LanguageFilter The language filter deciding which files to open with the language server.
---@field startBehavior? "AlwaysOn"|"RequiresFile"|"RequiresProject"
---@field initializationOptions? table|string The initialization options to pass to the language server, either a JSON string, or a table.
---@field settings? AspectContainer
---@field onStartFailed? function This callback is called when client failed to start.
local ClientOptions = {}

---@class LanguageFilter
---@field patterns? string[] The file patterns supported by the language server.
---@field mimeTypes? string[] The mime types supported by the language server.
local LanguageFilter = {}

---@class Client
---@field on_instance_start function The callback to call when a language client starts.
lsp.Client = {}

---@param msg string The name of the message to handle.
---@param callback function The callback to call when the message is received.
---Registers a message handler for the message named 'msg'.
function lsp.Client:registerMessage(msg, callback) end

---@param msg table the message to send.
---Sends a message to the language server.
function lsp.Client:sendMessage(msg, callback) end

---Creates a new Language Client.
---@param options ClientOptions
---@return Client
function lsp.Client.create(options) end

return lsp

©2024 Qt 公司限制公司。此处包含的文档贡献是各所有者版权的。在此提供的文档是根据自由软件基金会发布的 GNU 自自由文档许可协议版本 1.3 条款许可的。Qt 及其相关标识是芬兰及/或其他国家的 Qt 公司的商标。所有其他商标均为其各自所有者的财产。