mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 18:16:31 +03:00
ecode: Tentative fix for a segfaul when accesing an LSP Server that isn't running anymore.
85 lines
2.2 KiB
C++
85 lines
2.2 KiB
C++
#ifndef ECODE_LSPDOCUMENTCLIENT_HPP
|
|
#define ECODE_LSPDOCUMENTCLIENT_HPP
|
|
|
|
#include "lspprotocol.hpp"
|
|
#include <eepp/system/clock.hpp>
|
|
#include <eepp/ui/doc/syntaxhighlighter.hpp>
|
|
#include <eepp/ui/doc/textdocument.hpp>
|
|
|
|
using namespace EE;
|
|
using namespace EE::System;
|
|
using namespace EE::UI;
|
|
using namespace EE::UI::Doc;
|
|
|
|
namespace EE { namespace UI {
|
|
class UISceneNode;
|
|
}} // namespace EE::UI
|
|
|
|
namespace ecode {
|
|
|
|
class LSPClientServer;
|
|
class LSPClientServerManager;
|
|
|
|
class LSPDocumentClient : public TextDocument::Client {
|
|
public:
|
|
LSPDocumentClient( LSPClientServer* server, TextDocument* doc );
|
|
|
|
~LSPDocumentClient();
|
|
|
|
virtual void onDocumentLoaded( TextDocument* );
|
|
virtual void onDocumentTextChanged( const DocumentContentChange& change );
|
|
virtual void onDocumentUndoRedo( const TextDocument::UndoRedo& eventType );
|
|
virtual void onDocumentCursorChange( const TextPosition& );
|
|
virtual void onDocumentSelectionChange( const TextRange& );
|
|
virtual void onDocumentLineCountChange( const size_t& lastCount, const size_t& newCount );
|
|
virtual void onDocumentLineChanged( const Int64& lineIndex );
|
|
virtual void onDocumentSaved( TextDocument* );
|
|
virtual void onDocumentClosed( TextDocument* );
|
|
virtual void onDocumentDirtyOnFileSystem( TextDocument* );
|
|
virtual void onDocumentMoved( TextDocument* );
|
|
virtual void onDocumentReloaded( TextDocument* );
|
|
|
|
void notifyOpen();
|
|
|
|
TextDocument* getDoc() const;
|
|
|
|
LSPClientServer* getServer() const;
|
|
|
|
int getVersion() const;
|
|
|
|
void onServerInitialized();
|
|
|
|
protected:
|
|
LSPClientServer* mServer{ nullptr };
|
|
LSPClientServerManager* mServerManager{ nullptr };
|
|
TextDocument* mDoc{ nullptr };
|
|
String::HashType mTag{ 0 };
|
|
String::HashType mTagSemanticTokens{ 0 };
|
|
int mVersion{ 0 };
|
|
std::string mSemanticeResultId;
|
|
LSPSemanticTokensDelta mSemanticTokens;
|
|
bool mRunningSemanticTokens{ false };
|
|
bool mShutdown{ false };
|
|
bool mFirstHighlight{ true };
|
|
|
|
void refreshTag();
|
|
|
|
UISceneNode* getUISceneNode();
|
|
|
|
void requestSymbols();
|
|
|
|
void requestSymbolsDelayed();
|
|
|
|
void requestSemanticHighlighting();
|
|
|
|
void requestSemanticHighlightingDelayed();
|
|
|
|
void processTokens( const LSPSemanticTokensDelta& tokens );
|
|
|
|
void highlight();
|
|
};
|
|
|
|
} // namespace ecode
|
|
|
|
#endif // ECODE_LSPDOCUMENTCLIENT_HPP
|