ecode: Added XML Tools plugin, currently provides highlight of matching xml tags and auto edit of xml tag name. Some minor fixes are still pending.

This commit is contained in:
Martín Lucas Golini
2023-07-09 23:09:59 -03:00
parent 95e938264f
commit c2e8a55bfa
11 changed files with 613 additions and 105 deletions

View File

@@ -36,6 +36,26 @@ class BoolScopedOp {
bool& boolRef;
};
class BoolScopedOpOptional {
public:
explicit BoolScopedOpOptional( bool cond, bool& boolRef ) : cond( cond ), boolRef( boolRef ) {}
explicit BoolScopedOpOptional( bool cond, bool& boolRef, bool initialVal ) :
cond( cond ), boolRef( boolRef ) {
if ( cond )
boolRef = initialVal;
}
~BoolScopedOpOptional() {
if ( cond )
boolRef = !boolRef;
}
private:
bool cond;
bool& boolRef;
};
}} // namespace EE::System
#endif // EE_SYSTEM_SCOPEDOP_HPP

View File

@@ -556,13 +556,13 @@ class EE_API TextDocument {
SyntaxHighlighter* getHighlighter() const;
TextRange getWordRangeInPosition( const TextPosition& pos );
TextRange getWordRangeInPosition( const TextPosition& pos, bool basedOnHighlighter = true );
TextRange getWordRangeInPosition();
TextRange getWordRangeInPosition( bool basedOnHighlighter = true );
String getWordInPosition( const TextPosition& pos );
String getWordInPosition( const TextPosition& pos, bool basedOnHighlighter = true );
String getWordInPosition();
String getWordInPosition( bool basedOnHighlighter = true );
bool mightBeBinary() const;
@@ -578,6 +578,10 @@ class EE_API TextDocument {
void stopActiveFindAll();
bool isDoingTextInput() const;
bool isInsertingText() const;
protected:
friend class UndoStack;
@@ -609,6 +613,7 @@ class EE_API TextDocument {
bool mHAsCpp{ false };
bool mLastCursorChangeWasInteresting{ false };
bool mDoingTextInput{ false };
bool mInsertingText{ false };
std::vector<std::pair<String::StringBaseType, String::StringBaseType>> mAutoCloseBracketsPairs;
Uint32 mIndentWidth{ 4 };
IndentType mIndentType{ IndentType::IndentTabs };

View File

@@ -71,6 +71,22 @@ class EE_API TextRange {
return mStart >= other.mStart && mEnd >= other.mEnd;
}
TextRange operator+( const TextRange& other ) const {
return TextRange( mStart + other.mStart, mEnd + other.mEnd );
}
TextRange operator+=( const TextRange& other ) const {
return TextRange( mStart + other.mStart, mEnd + other.mEnd );
}
TextRange operator-( const TextRange& other ) const {
return TextRange( mStart - other.mStart, mEnd - other.mEnd );
}
TextRange operator-=( const TextRange& other ) const {
return TextRange( mStart - other.mStart, mEnd - other.mEnd );
}
bool contains( const TextPosition& position ) const {
if ( !( position.line() > mStart.line() ||
( position.line() == mStart.line() && position.column() >= mStart.column() ) ) )