В чем смысл настройки трассировки в протоколе языкового сервера? - PullRequest
0 голосов
/ 11 июня 2018

Я пытаюсь выяснить, что делает параметр 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), на самом деле ничего не меняется.

Что это на самом деле делает?

1 Ответ

0 голосов
/ 26 сентября 2018

Я экспериментировал с примерами Microsoft (https://github.com/Microsoft/vscode-extension-samples). В их lsp-sample вы можете изменить значение трассировки через настройки интерфейса: settings UI, и в результате онвыводит необработанные сообщения JSON-RPC: traced messages Я не стал вдаваться в подробности, но я предполагаю, что настройка 'trace: verbose' на стороне клиента устанавливает значение в InitializeParams передать на сервер, чтобы он мог добавить свои собственные линии трассировки. Не окончательный ответ, но, надеюсь, вы сможете увидеть, где должен появиться вывод трассировки.

...