语言服务器协议中的 Trace 设置有什么意义?
What is the sense of the Trace setting in the Language Server Protocol?
我想弄清楚语言服务器协议中的 trace
设置的作用。所以根据规范:
The initial trace setting. If omitted trace is disabled ('off').
但这并不能告诉我太多。它嵌入在 InitializeParams
interface:
interface InitializeParams {
/**
* The process Id of the parent process that started
* the server. Is null if the process has not been started by another process.
* If the parent process is not alive then the server should exit (see exit notification) its process.
*/
processId: number | null;
/**
* The rootPath of the workspace. Is null
* if no folder is open.
*
* @deprecated in favour of rootUri.
*/
rootPath?: string | null;
/**
* The rootUri of the workspace. Is null if no
* folder is open. If both `rootPath` and `rootUri` are set
* `rootUri` wins.
*/
rootUri: DocumentUri | null;
/**
* User provided initialization options.
*/
initializationOptions?: any;
/**
* The capabilities provided by the client (editor or tool)
*/
capabilities: ClientCapabilities;
/**
* The initial trace setting. If omitted trace is disabled ('off').
*/
trace?: 'off' | 'messages' | 'verbose';
/**
* The workspace folders configured in the client when the server starts.
* This property is only available if the client supports workspace folders.
* It can be `null` if the client supports workspace folders but none are
* configured.
*
* Since 3.6.0
*/
workspaceFolders?: WorkspaceFolder[] | null;
}
我在本地使用测试语言服务器进行了尝试,但无论我输入什么值(off
、messages
、verbose
),都没有真正改变。
它实际上有什么作用?
我一直在试验 Microsoft 的示例 (https://github.com/Microsoft/vscode-extension-samples)。在他们的 lsp-sample
中,您可以通过设置 ui 更改跟踪值:
结果是它打印出原始 JSON-RPC 消息:
我没有详细讨论这个问题,但我假设在客户端设置 'trace: verbose' 将 InitializeParams
中的值设置为传递给服务器,因此它可以添加自己的跟踪行.
不是一个明确的答案,但希望你能看到跟踪输出应该出现在哪里。
我想弄清楚语言服务器协议中的 trace
设置的作用。所以根据规范:
The initial trace setting. If omitted trace is disabled ('off').
但这并不能告诉我太多。它嵌入在 InitializeParams
interface:
interface InitializeParams {
/**
* The process Id of the parent process that started
* the server. Is null if the process has not been started by another process.
* If the parent process is not alive then the server should exit (see exit notification) its process.
*/
processId: number | null;
/**
* The rootPath of the workspace. Is null
* if no folder is open.
*
* @deprecated in favour of rootUri.
*/
rootPath?: string | null;
/**
* The rootUri of the workspace. Is null if no
* folder is open. If both `rootPath` and `rootUri` are set
* `rootUri` wins.
*/
rootUri: DocumentUri | null;
/**
* User provided initialization options.
*/
initializationOptions?: any;
/**
* The capabilities provided by the client (editor or tool)
*/
capabilities: ClientCapabilities;
/**
* The initial trace setting. If omitted trace is disabled ('off').
*/
trace?: 'off' | 'messages' | 'verbose';
/**
* The workspace folders configured in the client when the server starts.
* This property is only available if the client supports workspace folders.
* It can be `null` if the client supports workspace folders but none are
* configured.
*
* Since 3.6.0
*/
workspaceFolders?: WorkspaceFolder[] | null;
}
我在本地使用测试语言服务器进行了尝试,但无论我输入什么值(off
、messages
、verbose
),都没有真正改变。
它实际上有什么作用?
我一直在试验 Microsoft 的示例 (https://github.com/Microsoft/vscode-extension-samples)。在他们的 lsp-sample
中,您可以通过设置 ui 更改跟踪值:
InitializeParams
中的值设置为传递给服务器,因此它可以添加自己的跟踪行.
不是一个明确的答案,但希望你能看到跟踪输出应该出现在哪里。