/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/

/*!
    \contentspage index.html
    \previouspage creator-editor-fakevim.html
    \page creator-language-servers.html
    \nextpage creator-mime-types.html

    \title Using Language Servers

    For several programming languages, a \e {language server} is available
    that provides information about the code to IDEs as long as they support
    communication via the language server protocol (LSP). This enables the
    IDE to provide the following services:

    \list
        \li \l{Completing Code}{Code completion}
        \li Highlighting the symbol under cursor
        \li \l{Semantic Highlighting}{Semantic highlighting}, as defined in
            \l{https://github.com/microsoft/vscode-languageserver-node/pull/367}
            {Proposal of the semantic highlighting protocol extension}
        \li Navigating in the code by using the \l{Searching with the Locator}
            {locator} or \l{Moving to Symbol Definition or Declaration}
            {moving to the symbol definition}
        \li Inspecting code by viewing the document
            \l{Viewing Defined Types and Symbols}{outline}
        \li \l{Finding Symbols}{Finding references to symbols}
        \li Code actions
        \li Integrating diagnostics from the language server
    \endlist

    By providing a client for the language server protocol, \QC can support
    the above features for several other programming languages besides C++.
    However, the client does not support language servers that require special
    handling.

    \section1 Adding MIME Types for Language Servers

    \QC uses the \l{https://www.iana.org/assignments/media-types/media-types.xhtml}
    {MIME type} of the file to determine which language server to request
    information from when you open a file for editing. Add new MIME types or
    file patterns to match language servers. If you do not set at least one MIME
    type or file pattern, no files will be sent to the language server. This is
    done to avoid unnecessary traffic and inaccurate information, as files are
    only sent to the languge server if they are known to be handled by it. For
    more information about how \QC uses MIME types, see \l {Editing MIME Types}.

    \section1 Specifying Settings for Language Clients

    To use a language server:

    \list 1
        \li Select \uicontrol Tools > \uicontrol Options >
            \uicontrol {Language Client} (or \uicontrol {Qt Creator} >
            \uicontrol Preferences > \uicontrol {Language Client} > on
            \macos) to view a list of language servers.
            \image qtcreator-language-client-options.png "Language client options page"
        \li Select the check box next to the language server name to enable the
            language server.
        \li Select \uicontrol Add to add language servers.
        \li In the \uicontrol Name field, enter a name for the language server.
            Select the \inlineimage replace.png
            (\uicontrol {Variables}) button to use a variable for the server
            name. For more information, see \l{Using Qt Creator Variables}.
        \li In the \uicontrol {Language} field, select
            \uicontrol {Set MIME Types} to select the MIME types of the files to
            send to the language server. In the field below, you can enter file
            patterns to extend the MIME types, separated by semicolons.
        \li In the \uicontrol {Startup behavior} field, select whether the
            language server is started when \QC starts or when a project or file
            with a matching MIME type is opened. The
            \uicontrol {General Messages} \l{Viewing Output}{output pane}
            displays information about the connection to the language server.
        \li In the \uicontrol Capabilities field, you can see the features
            that are supported by the language server. Only some of them are
            implemented by \QC.
        \li In the \uicontrol Executable field, enter the path to the language
            server executable.
        \li In the \uicontrol Arguments field, enter any required command line
            arguments. Select \uicontrol Variables to use variables as
            arguments.
    \endlist

    To remove language servers from the list, select \uicontrol Delete.

    \section1 Supported Locator Filters

    The locator enables you to browse not only files, but any items defined by
    \e {locator filters}. The language client plugin supports the following
    locator filters:

    \list
            \li Locating symbols in the current project (\c {:})
            \li Locating symbols in the current document (\c {.})
            \li Locating class (\c {c}), enum, and function (\c {m})
                definitions in your project
    \endlist

    \section1 Reporting Issues

    The language service client has been mostly tested with Python.
    If problems arise when you try it or some other language, please select
    \uicontrol Help > \uicontrol {Report Bug} to report them in the Qt Bug
    Tracker. The reports should include \QC console output with the environment
    variable \c {QT_LOGGING_RULES=qtc.languageclient.*=true} set.
*/
