| 3rdparty |
|
|
- |
| CMakeLists.txt |
|
1117 |
- |
| generate.ts |
!
\internal
\page lspgenerate.html
\title Generate Language Server Protocol
The language server protocol is largely generated from the
specification
src/languageserver/3rdparty/metaModel.json
You can obtain the specification by searching for "meta model" on the
LSP website, and by removing invisible characters for the qt sanity
bot by doing
\badcode
iconv -f utf-8 -t ascii//IGNORE metaModelDirty.json > metaModel.json
\endcode
To generate the C++ classes open a terminal in this folder
(src/languageserver) and run:
\badcode
npm install
npm run generate
\endcode
It generates:
src/languageserver/qlanguageserverspectypes_p.h:
Types defined in the protocol are defined as C++ POD objects in the
QLspSpecification namespace, that implement the walk template for
serialization/deserialization, enmuerations are also defined, along
with helpers to ensure their conversion to json is what defined in
the specification (some enumeration should be stored as numbers,
other as lowercase string, other as string equal to the enumeration
constant).
src/languageserver/qlanguageserverspec_p.h
Includes qlanguageserverspectypes_p.h, and defines:
the Capabilites one has to check/define, and aliases for the types
defining them in the namespace ClientCapabilitiesInfo for the
client ones, and in ServerCapabilitiesInfo for the server side.
in Requests the method and alias for the paramenters of the
requests
in Notifications the same for notifications
in Responses, aliases for the types of the responses or partial
responses
finally it defines RequestParams and NotificationsParams as
variants able to keep any request or notification parameters
src/languageserver/qlanguageservergen_p.h
Defines the ProtocolGen class that defines the typed LSP protocol:
requestXX or notifyXX methods to preform requests/send
notifications
registerXXRequestHandler methods to handle requests
registerXXNotificationHandler methods to handle notifications
src/languageserver/qlanguageservergen_p_p.h
Declaration of QLanguageServeGenPrivate.
src/languageserver/qlanguageservergen.cpp
Implementation of QLanguageServeGen and QLanguageServeGenPrivate.
src/languageserver/qlspnotifysignals_p.h An object that emits signals
for notifications, this way one can easily have multiple handlers
for the same notification, by simply connecting the signal multiple
times.
The goal is to keep the generated part simple, that is the reason when
possible setup/tweaks are done in other non generated files:
src/languageserver/qlanguageserverprespectypes_p.h:
setup for qlanguageserverspectypes_p.h and qlanguageserverspec_p.h
src/languageserver/qlanguageserverbase_p.h and qlanguageserverbase.cpp:
setup for qlanguageservergen* (base class)
src/languageserver/qlanguageserverprotocol_p.h, qlanguageserverprotocol_p_p.h and
qlanguageserverprotocol.cpp:
Define QLanguageServerProtocol the main "user facing" class built on
the top of qlanguageservergen*
|
43292 |
- |
| package.json |
|
501 |
- |
| qlanguageserverbase.cpp |
|
5140 |
- |
| qlanguageserverbase_p.h |
|
3640 |
- |
| qlanguageserverbase_p_p.h |
|
935 |
- |
| qlanguageservergen.cpp |
|
129831 |
- |
| qlanguageservergen_p.h |
|
46761 |
- |
| qlanguageservergen_p_p.h |
|
872 |
- |
| qlanguageserverjsonrpctransport.cpp |
|
3647 |
- |
| qlanguageserverjsonrpctransport_p.h |
|
1247 |
- |
| qlanguageserverprespectypes_p.h |
|
2643 |
- |
| qlanguageserverprotocol.cpp |
!
\internal
\class QLanguageServerProtocol
\brief Implements the language server protocol
QLanguageServerProtocol objects handles the language server
protocol both to send and receive (ask the client and reply to the
client).
To ask the client you use the requestXX or notifyXX methods.
To reply to client request you have to register your handlers via
registerXXRequestHandler, notifications can be handled connecting the
receivedXXNotification signals.
The method themselves are implemented in qlanguageservergen*
files which are generated form the specification.
You have to provide a function to send the data that the protocol
generates to the constructor, and you have to feed the data you
receive to it via the receivedData method.
Limitations: for the client use case (Creator),the handling of partial
results could be improved. A clean solution should handle the progress
notification, do some extra tracking and give the partial results back
to the call that did the request.
|
2398 |
- |
| qlanguageserverprotocol_p.h |
|
966 |
- |
| qlanguageserverspec_p.h |
|
35445 |
- |
| qlanguageserverspectypes_p.h |
@deprecated use jsonrpcReservedErrorRangeStart |
200387 |
- |
| qlspnotifysignals.cpp |
|
17281 |
- |
| qlspnotifysignals_p.h |
|
4212 |
- |
| qtlanguageserverglobal.h |
|
442 |
- |