wex v26.10.0
wex::lsp::client Class Reference

Represents the Language Server Protocol client. More...

#include <wex/lsp/client.h>

Public Member Functions

 client (lexer lexer, wxEvtHandler *event_handler=nullptr)
 Constructor, specify lexer for which to create a LSP client, and handler for UI updates.
 ~client ()=default
 Destructor.
bool completion (const wex::path &path, const position_item &pos, const std::string &trigger=std::string(), bool is_incomplete=false)
 Requests code completion at position.
bool definition (const wex::path &path, const position_item &pos)
 Requests goto definition information.
bool did_change (const wex::path &path, const range_item &range, const std::string &text)
 Notifies server of document changes.
bool did_close (const wex::path &path)
 Notifies server of closed document.
bool did_open (const wex::path &path, const std::string &text)
 Notifies server of opened document.
bool did_save (const wex::path &path)
 Notifies server of saved document.
const std::string & extensions () const
 Returns extensions.
const capabilitiesget_capabilities () const
 Returns server capabilities.
bool hover (const wex::path &path, const position_item &pos)
 Requests hover (tooltip) information.
bool implementation (const wex::path &path, const position_item &pos)
 Requests goto implementation information.
bool initialize (const wex::path &root_path)
 Initializes the LSP client connection with root path.
bool is_initialized () const
 Returns whether the client is initialized.
bool is_running () const
 Returns whether the client is running.
const std::string & language_id () const
 Returns language id.
const std::string & lsp_server () const
 Returns the lsp server.
bool on_type_formatting (const wex::path &path, const position_item &pos, char c, bool use_tabs, int tab_size)
 Requests on type formatting information.
bool shutdown ()
 Shuts down the LSP connection gracefully.
int version (const std::string &uri) const
 Returns version for specified uri.

Detailed Description

Represents the Language Server Protocol client.

Each client communicates with one Server, based upon lexer setup.

Constructor & Destructor Documentation

◆ client()

wex::lsp::client::client ( lexer lexer,
wxEvtHandler * event_handler = nullptr )

Constructor, specify lexer for which to create a LSP client, and handler for UI updates.

The lexer determines which LSP server to use based on its configuration. If event_handler is nullptr, the client will not post events for UI updates.

Member Function Documentation

◆ completion()

bool wex::lsp::client::completion ( const wex::path & path,
const position_item & pos,
const std::string & trigger = std::string(),
bool is_incomplete = false )

Requests code completion at position.

Returns true if successful.

Parameters
paththe path
posthe position
triggerthe trigger, such as:
  • "." object memmbers
  • "::" class members
  • "->" pinter members
is_incompleteprevious completion list was marked isIncomplete: true this lets the server refine suggestions as the user keeps typing

◆ definition()

bool wex::lsp::client::definition ( const wex::path & path,
const position_item & pos )

Requests goto definition information.

Returns true if successful.

◆ did_change()

bool wex::lsp::client::did_change ( const wex::path & path,
const range_item & range,
const std::string & text )

Notifies server of document changes.

Returns true if successful.

◆ did_close()

bool wex::lsp::client::did_close ( const wex::path & path)

Notifies server of closed document.

Returns true if successful.

◆ did_open()

bool wex::lsp::client::did_open ( const wex::path & path,
const std::string & text )

Notifies server of opened document.

Returns true if successful.

◆ did_save()

bool wex::lsp::client::did_save ( const wex::path & path)

Notifies server of saved document.

Returns true if successful.

◆ hover()

bool wex::lsp::client::hover ( const wex::path & path,
const position_item & pos )

Requests hover (tooltip) information.

Returns true if successful.

◆ implementation()

bool wex::lsp::client::implementation ( const wex::path & path,
const position_item & pos )

Requests goto implementation information.

Returns true if successful.

◆ initialize()

bool wex::lsp::client::initialize ( const wex::path & root_path)

Initializes the LSP client connection with root path.

Returns true if successfully initialized.

◆ on_type_formatting()

bool wex::lsp::client::on_type_formatting ( const wex::path & path,
const position_item & pos,
char c,
bool use_tabs,
int tab_size )

Requests on type formatting information.

Returns true if successful.

◆ shutdown()

bool wex::lsp::client::shutdown ( )

Shuts down the LSP connection gracefully.

Returns true if shutdown was successful.