mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
ecode: Linter plugin, show only the first line of the error with error lens.
This commit is contained in:
@@ -825,7 +825,9 @@ class EE_API String {
|
||||
const bool& pushEmptyString = false,
|
||||
const bool& keepDelim = false ) const;
|
||||
|
||||
std::pair<bool, int> fuzzyMatch( const String& pattern );
|
||||
static std::string getFirstLine( const std::string& string );
|
||||
|
||||
String getFirstLine();
|
||||
|
||||
private:
|
||||
friend EE_API bool operator==( const String& left, const String& right );
|
||||
|
||||
@@ -367,6 +367,20 @@ std::vector<String> String::split( const StringBaseType& delim, const bool& push
|
||||
return String::split( *this, delim, pushEmptyString, keepDelim );
|
||||
}
|
||||
|
||||
std::string String::getFirstLine( const std::string& string ) {
|
||||
auto pos = string.find_first_of( '\n' );
|
||||
if ( pos == std::string::npos )
|
||||
return string;
|
||||
return string.substr( 0, pos );
|
||||
}
|
||||
|
||||
String String::getFirstLine() {
|
||||
auto pos = find_first_of( '\n' );
|
||||
if ( pos == String::InvalidPos )
|
||||
return *this;
|
||||
return substr( 0, pos );
|
||||
}
|
||||
|
||||
std::vector<std::string> String::split( const std::string& str, const std::string& delims,
|
||||
const std::string& delimsPreserve, const std::string& quote,
|
||||
const bool& removeQuotes ) {
|
||||
|
||||
@@ -705,7 +705,8 @@ void LinterPlugin::drawAfterLineText( UICodeEditor* editor, const Int64& index,
|
||||
continue;
|
||||
|
||||
Primitives p;
|
||||
line.setString( match.text );
|
||||
auto nlPos = match.text.find_first_of( '\n' );
|
||||
line.setString( nlPos != std::string::npos ? match.text.substr( 0, nlPos ) : match.text );
|
||||
Float txtWidth = line.getTextWidth();
|
||||
Float distWidth = realSpace - txtWidth;
|
||||
if ( txtWidth > spaceWidth )
|
||||
|
||||
@@ -138,8 +138,7 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
|
||||
args::ValueFlag<std::string> fontPath( parser, "fontpath", "Font path", { 'f', "font" } );
|
||||
args::ValueFlag<std::string> fallbackFontPathF( parser, "fallback-fontpath",
|
||||
"Fallback Font path", { "fallback-font" } );
|
||||
args::ValueFlag<Float> fontSize( parser, "fontsize", "Font size (in dp)", { 's', "fontsize" },
|
||||
11 );
|
||||
args::ValueFlag<Float> fontSize( parser, "fontsize", "Font size (in dp)", { "fontsize" }, 11 );
|
||||
args::ValueFlag<Float> width( parser, "winwidth", "Window width (in dp)", { "width" }, 1280 );
|
||||
args::ValueFlag<Float> height( parser, "winheight", "Window height (in dp)", { "height" },
|
||||
720 );
|
||||
|
||||
Reference in New Issue
Block a user