LanguageClient: Improve formatting

Use Utils::ChangeSet and TextEditor::RefactoringChanges to apply the
text edits that are reported from language server to format the current
file.

Change-Id: Id2f490b6e2791f676ebc751219bfbbf9e178f120
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-01-29 13:53:20 +01:00
parent 2d92ae391a
commit 15b0a902e9
6 changed files with 32 additions and 22 deletions

View File

@@ -29,6 +29,7 @@
#include <languageserverprotocol/languagefeatures.h>
#include <texteditor/refactoroverlay.h>
#include <utils/changeset.h>
namespace Core { class IEditor; }
@@ -41,6 +42,8 @@ namespace LanguageClient {
class Client;
Utils::ChangeSet editsToChangeSet(const QList<LanguageServerProtocol::TextEdit> &edits,
const QTextDocument *doc);
bool applyWorkspaceEdit(const LanguageServerProtocol::WorkspaceEdit &edit);
bool applyTextDocumentEdit(const LanguageServerProtocol::TextDocumentEdit &edit);
bool applyTextEdits(const LanguageServerProtocol::DocumentUri &uri,