2

我试图弄清楚trace语言服务器协议中的设置是做什么的。所以根据规范:

初始跟踪设置。如果省略的跟踪被禁用('off')。

但这并不能告诉我太多。它嵌入在InitializeParams界面中:

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) 的值是什么,都没有真正改变。

它实际上是做什么的?

4

1 回答 1

1

我一直在试验微软的例子(https://github.com/Microsoft/vscode-extension-samples)。在他们lsp-sample中,您可以通过设置 ui: 更改 trace 的值: 设置界面 结果是它打印出原始 JSON-RPC 消息: 跟踪消息 我没有详细介绍,但我假设设置 'trace: verbose'在客户端设置InitializeParams传递给服务器的值,因此它可以添加自己的跟踪行。不是一个明确的答案,但希望你能看到跟踪输出应该出现在哪里。

于 2018-09-26T08:30:11.587 回答