Commit Graph

16 Commits

Author SHA1 Message Date
David Schulz
4070d6a289 Editor: add formatter support
Change-Id: I65590273b2541e08a39970cd9bb4739a5634b2f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-22 06:00:11 +00:00
David Schulz
c56e58fab4 Utils: move text replacement helper to Utils::Text
Change-Id: I82b3304f91d575369e74d5f7404c189e14ba4730
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-09 08:23:07 +00:00
Nikolai Kosjar
c4889e9904 Clang: Extract Utils::utf8AdvanceCodePoint
Change-Id: I922c7b0f2f0e0d50f34035e9affef4504df59892
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-08-27 08:26:45 +00:00
hjk
7ab6783e24 Standardize on int for line and column values
Recently tons of warnings show up for presumably "problematic"
singned <-> unsigned and size conversions.

The Qt side uses 'int', and that's the biggest 'integration surface'
for us, so instead of establishing some internal boundary between
signed and unsigned areas, push that boundary out of creator core code,
and use 'int' everywhere.

Because it reduces friction further, also do it in libcplusplus.

Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-26 09:23:48 +00:00
Ivan Donchevskii
118c126f98 ClangFormat: Refactor code
Reorder some functions, remove code duplication.

Change-Id: I33e118e567dee7db622bbc99e6a7c500db54e5c5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-20 06:49:47 +00:00
Eike Ziller
2bebfe9985 Help: Add fallback word lookup for context help to base text editor
If we do not have a hover handler, or that did not produce any result,
use the word under cursor and try with that.
This adds at least some help fallback mechanism to all text editors,
e.g. we get some context help (though a bit crude) for Pyside
"for free".

Change-Id: I1b6d91ad6f46bfd12e242b1aec9f4fcadae23403
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-02-15 14:06:50 +00:00
David Schulz
279a11f46b Utils: Fix comment of convertPosition
amends 931ec39f64

Change-Id: I3a9255b2a1406d6032a42f61c2e403a2b080c372
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-19 08:44:48 +00:00
Ivan Donchevskii
3f613d25a1 Clang: Move text cursor utility methods into ClangCodeModel
These 3 are only used in ClangCodeModel.

Change-Id: Id7c2cead40473bcb746e4b105aa36cb7d51a2740
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-18 09:13:35 +00:00
Ivan Donchevskii
f8e6ba916c Clang: Fix abandoning the parentheses for function
Was introduced in 0f96f735f0 because the the incorrect
move to the '&' character.

Task-number: QTCREATORBUG-21305
Change-Id: I55d79e68795f55b758aa95072fca10bc00d49037
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-17 07:31:05 +00:00
Ivan Donchevskii
cafd5ced1a Clang: Significantly improve ClangFormat plugin usability
What's new:
1. New LibFormat option is used to prevent lines shrink,
   which allows to drop most of tricks used before for that purpose.
2. Cached UTF-8 source code is used to improve performance
3. Improved error handling.
4. Slightly improved UI.

Change-Id: I4605200fa103167369a40650b2e1ad2c61e8133b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-17 07:16:04 +00:00
David Schulz
d61d29cf16 Introduce a basic client for the language server protocol
The language server protocol is used to transport language specific
information needed to efficiently edit source files. For example
completion, go to operations and symbol information. These information
are transferred via JSON-RPC. The complete definition can be found under
https://microsoft.github.io/language-server-protocol/specification.

This language server protocol support consists of two major parts, the
C++ representation of the language server protocol, and the client part
for the communication with an external language server.

The TypeScript definitions of the protocol interfaces are transferred to
C++ classes. Those classes have getter and setter for every interface
value. Optional values from the protocol are represented by
Utils::optional<ValueType>. The JSON objects that are used to transfer
the data between client and server are hidden by a specialized
JsonObject class derived from QJsonObject. Additionally this JsonObject
provides a validity check that is capable of creating a detailed error
message for malformed, or at least unexpected JSON representation of the
protocol.

The client is the interface between Qt Creator and language server
functionality, like completion, diagnostics, document and workspace
synchronization. The base client converts the data that is sent from/to
the server between the raw byte array and the corresponding C++ objects.
The transportat layer is defined in a specialized base client (this
initial change will only support stdio language server). The running
clients are handled inside the language client manager, which is also
used to connect global and exclusive Qt Creator functionality to the
clients.

Task-number: QTCREATORBUG-20284
Change-Id: I8e123e20c3f14ff7055c505319696d5096fe1704
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-03 08:00:46 +00:00
Ivan Donchevskii
0f96f735f0 Clang: Provide all overloads for function definition completion
When we complete a function definition with the parameter list
it is important to have multiple entries to select.

Change-Id: I25e94b58cfe4831387d66eecdec74712addb7ec5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-02 12:47:17 +00:00
Orgad Shaneh
7cee991c70 Utils: Remove superfluous qualifications
Change-Id: I36e17dac0cff87f82f0ddaf97bc613389110f218
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-19 08:21:29 +00:00
Ivan Donchevskii
a91956f300 Utils: Move common positionInText function to Utils::Text
Change-Id: I5d74a73058ca457b0fb3f13eaf945f224d5699fb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-06-19 09:20:53 +00:00
Marco Bubke
e0ea602f6c Clang: Use LineColumn instead of explicit integers for line and column
With OptionalLineColumn we don't need any bool return parameter any more.

Change-Id: I6f57f221c1bfdf08a92a87a7d71ea0eecf83dbcf
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-17 12:22:30 +00:00
Ivan Donchevskii
80a472740d TextEditor: move convenience from texteditor to utils
Allows to use this header without texteditor dependency.

Change-Id: I706f42799c3ea42473a716fa9ef9f3cfbef6fdd4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-22 12:59:35 +00:00