Python: move language client functionality out of utils

There will be more lsp specific functionality so moving it into its own
space is reasonable.

Change-Id: Ic87d437182d68673b53f662c804707138fef5b6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-12-13 14:19:30 +01:00
parent 1ba6faeea0
commit 49ac087955
9 changed files with 547 additions and 477 deletions

View File

@@ -27,50 +27,12 @@
#include <utils/fileutils.h>
#include <QHash>
#include <QObject>
namespace Core { class IDocument; }
namespace LanguageClient {
class Client;
class StdIOSettings;
}
namespace TextEditor { class TextDocument; }
namespace Python {
namespace Internal {
enum class ReplType { Unmodified, Import, ImportToplevel };
void openPythonRepl(const Utils::FilePath &file, ReplType type);
struct PythonLanguageServerState;
class PyLSConfigureAssistant : public QObject
{
Q_OBJECT
public:
static PyLSConfigureAssistant *instance();
static const LanguageClient::StdIOSettings *languageServerForPython(
const Utils::FilePath &python);
static void documentOpened(Core::IDocument *document);
static void updateEditorInfoBars(const Utils::FilePath &python, LanguageClient::Client *client);
void openDocumentWithPython(const Utils::FilePath &python, TextEditor::TextDocument *document);
private:
explicit PyLSConfigureAssistant(QObject *parent);
void handlePyLSState(const Utils::FilePath &python,
const PythonLanguageServerState &state,
TextEditor::TextDocument *document);
void resetEditorInfoBar(TextEditor::TextDocument *document);
void installPythonLanguageServer(const Utils::FilePath &python,
QPointer<TextEditor::TextDocument> document);
QHash<Utils::FilePath, QList<TextEditor::TextDocument *>> m_infoBarEntries;
};
Utils::FilePath detectPython(const Utils::FilePath &documentPath);
} // namespace Internal
} // namespace Python