diff --git a/include/eepp/ui/models/model.hpp b/include/eepp/ui/models/model.hpp index da2a68172..b07ec73da 100644 --- a/include/eepp/ui/models/model.hpp +++ b/include/eepp/ui/models/model.hpp @@ -92,7 +92,7 @@ class EE_API Model { void setOnUpdate( const std::function& onUpdate ); - void invalidate(); + void invalidate( unsigned int flags = Model::UpdateFlag::InvalidateAllIndexes ); protected: Model(){}; diff --git a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp index 89cc1016a..43325912e 100644 --- a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp +++ b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp @@ -149,8 +149,45 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { { "^#!.*[ /]lua" } } ); // JavaScript - add( { "Javascript", - { "%.js$", "%.json$", "%.cson$", "%.ts$", "%.tsx$" }, + add( { "JavaScript", + { "%.js$", "%.json$", "%.cson$" }, + { + { { "//.-\n" }, "comment" }, + { { "/%*", "%*/" }, "comment" }, + { { "\"", "\"", "\\" }, "string" }, + { { "'", "'", "\\" }, "string" }, + { { "`", "`", "\\" }, "string" }, + { { "0x[%da-fA-F]+" }, "number" }, + { { "-?%d+[%d%.eE]*" }, "number" }, + { { "-?%.?%d+" }, "number" }, + { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, + { { "[%a_][%w_]*%s*%f[(]" }, "function" }, + { { "[%a_][%w_]*" }, "symbol" }, + }, + { { "arguments", "keyword2" }, { "async", "keyword" }, { "await", "keyword" }, + { "break", "keyword" }, { "case", "keyword" }, { "catch", "keyword" }, + { "class", "keyword" }, { "const", "keyword" }, { "continue", "keyword" }, + { "debugger", "keyword" }, { "default", "keyword" }, { "delete", "keyword" }, + { "do", "keyword" }, { "else", "keyword" }, { "export", "keyword" }, + { "extends", "keyword" }, { "false", "literal" }, { "finally", "keyword" }, + { "for", "keyword" }, { "function", "keyword" }, { "get", "keyword" }, + { "if", "keyword" }, { "import", "keyword" }, { "in", "keyword" }, + { "Infinity", "keyword2" }, { "instanceof", "keyword" }, { "let", "keyword" }, + { "NaN", "keyword2" }, { "new", "keyword" }, { "null", "literal" }, + { "return", "keyword" }, { "set", "keyword" }, { "super", "keyword" }, + { "static", "keyword" }, { "switch", "keyword" }, { "this", "keyword2" }, + { "throw", "keyword" }, { "true", "literal" }, { "try", "keyword" }, + { "typeof", "keyword" }, { "undefined", "literal" }, { "var", "keyword" }, + { "void", "keyword" }, { "while", "keyword" }, { "with", "keyword" }, + { "yield", "keyword" }, { "implements", "keyword" }, { "Array", "keyword2" }, + { "any", "keyword" }, { "from", "keyword" }, { "public", "keyword" }, + { "private", "keyword" }, { "declare", "keyword" }, { "namespace", "keyword" }, + { "protected", "keyword" }, { "enum", "keyword" } }, + "//" } ); + + // TypeScript + add( { "TypeScript", + { "%.ts$", "%.tsx$", "%.d.ts$" }, { { { "//.-\n" }, "comment" }, { { "/%*", "%*/" }, "comment" }, diff --git a/src/eepp/ui/models/model.cpp b/src/eepp/ui/models/model.cpp index 222677c7d..313eeafa7 100644 --- a/src/eepp/ui/models/model.cpp +++ b/src/eepp/ui/models/model.cpp @@ -45,8 +45,8 @@ void Model::setOnUpdate( const std::function& onUpdate ) { mOnUpdate = onUpdate; } -void Model::invalidate() { - onModelUpdate(); +void Model::invalidate( unsigned int flags ) { + onModelUpdate( flags ); } ModelIndex Model::sibling( int row, int column, const ModelIndex& parent ) const { diff --git a/src/tools/codeeditor/filesystemlistener.cpp b/src/tools/codeeditor/filesystemlistener.cpp index 1a2e336e8..593622bab 100644 --- a/src/tools/codeeditor/filesystemlistener.cpp +++ b/src/tools/codeeditor/filesystemlistener.cpp @@ -13,8 +13,10 @@ void FileSystemListener::handleFileAction( efsw::WatchID, const std::string& dir case efsw::Actions::Add: case efsw::Actions::Delete: case efsw::Actions::Moved: { - auto* node = - mFileSystemModel.get()->getNodeFromPath( file.getDirectoryPath(), true, false ); + auto* node = mFileSystemModel.get()->getNodeFromPath( + file.isDirectory() ? FileSystem::removeLastFolderFromPath( file.getDirectoryPath() ) + : file.getDirectoryPath(), + true, false ); if ( node && ( !mFileSystemModel.get()->getDisplayConfig().ignoreHidden || !file.isHidden() ) ) { node->invalidate();