mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 17:17:42 +03:00
Enable semantic highlighting by default.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "appconfig.hpp"
|
||||
#include "ecode.hpp"
|
||||
#include "plugins/pluginmanager.hpp"
|
||||
#include "version.hpp"
|
||||
#include <eepp/network/uri.hpp>
|
||||
#include <eepp/system/filesystem.hpp>
|
||||
#include <eepp/system/md5.hpp>
|
||||
@@ -77,6 +78,7 @@ void AppConfig::load( const std::string& confPath, std::string& keybindingsPath,
|
||||
windowState.displayIndex = iniState.getValueI( "window", "display_index", 0 );
|
||||
windowState.position.x = iniState.getValueI( "window", "x", -1 );
|
||||
windowState.position.y = iniState.getValueI( "window", "y", -1 );
|
||||
windowState.lastRunVersion = iniState.getValueU( "editor", "last_run_version", 0 );
|
||||
editor.showLineNumbers = ini.getValueB( "editor", "show_line_numbers", true );
|
||||
editor.showWhiteSpaces = ini.getValueB( "editor", "show_white_spaces", true );
|
||||
editor.showLineEndings = ini.getValueB( "editor", "show_line_endings", false );
|
||||
@@ -210,6 +212,7 @@ void AppConfig::save( const std::vector<std::string>& recentFiles,
|
||||
iniState.setValue( "files", "recentfiles", String::join( urlEncode( recentFiles ), ';' ) );
|
||||
iniState.setValue( "folders", "recentfolders",
|
||||
String::join( urlEncode( recentFolders ), ';' ) );
|
||||
iniState.setValueU( "editor", "last_run_version", ecode::Version::getVersionNum() );
|
||||
ini.setValueB( "editor", "show_line_numbers", editor.showLineNumbers );
|
||||
ini.setValueB( "editor", "show_white_spaces", editor.showWhiteSpaces );
|
||||
ini.setValueB( "editor", "show_indentation_guides", editor.showIndentationGuides );
|
||||
@@ -550,4 +553,8 @@ void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* ed
|
||||
}
|
||||
}
|
||||
|
||||
bool AppConfig::isNewVersion() const {
|
||||
return windowState.lastRunVersion != ecode::Version::getVersionNum();
|
||||
}
|
||||
|
||||
} // namespace ecode
|
||||
|
||||
@@ -48,6 +48,7 @@ struct WindowStateConfig {
|
||||
std::string statusBarPartition;
|
||||
int displayIndex{ 0 };
|
||||
Vector2i position{ -1, -1 };
|
||||
Uint32 lastRunVersion{ 0 };
|
||||
};
|
||||
|
||||
struct CodeEditorConfig {
|
||||
@@ -175,6 +176,8 @@ class AppConfig {
|
||||
WorkspaceConfig workspace;
|
||||
LanguagesExtensions languagesExtensions;
|
||||
|
||||
bool isNewVersion() const;
|
||||
|
||||
void load( const std::string& confPath, std::string& keybindingsPath,
|
||||
std::string& initColorScheme, std::vector<std::string>& recentFiles,
|
||||
std::vector<std::string>& recentFolders, const std::string& resPath,
|
||||
|
||||
@@ -406,10 +406,16 @@ void App::runCommand( const std::string& command ) {
|
||||
}
|
||||
}
|
||||
|
||||
void App::onPluginEnabled( UICodeEditorPlugin* plugin ) {
|
||||
if ( mSplitter )
|
||||
void App::onPluginEnabled( Plugin* plugin ) {
|
||||
if ( mSplitter ) {
|
||||
mSplitter->forEachEditor(
|
||||
[plugin]( UICodeEditor* editor ) { editor->registerPlugin( plugin ); } );
|
||||
}
|
||||
|
||||
if ( firstFrame && mConfig.isNewVersion() ) {
|
||||
plugin->onVersionUpgrade( mConfig.windowState.lastRunVersion,
|
||||
ecode::Version::getVersionNum() );
|
||||
}
|
||||
}
|
||||
|
||||
void App::initPluginManager() {
|
||||
@@ -423,13 +429,14 @@ void App::initPluginManager() {
|
||||
cb( tab->getOwnedWidget()->asType<UICodeEditor>(), path );
|
||||
}
|
||||
} );
|
||||
mPluginManager->onPluginEnabled = [this]( UICodeEditorPlugin* plugin ) {
|
||||
mPluginManager->onPluginEnabled = [this]( Plugin* plugin ) {
|
||||
if ( nullptr == mUISceneNode || plugin->isReady() ) {
|
||||
onPluginEnabled( plugin );
|
||||
} else {
|
||||
// If plugin loads asynchronously and is not ready, delay the plugin enabled callback
|
||||
plugin->addOnReadyCallback( [this]( UICodeEditorPlugin* plugin, const Uint32& cbId ) {
|
||||
mUISceneNode->runOnMainThread( [&, plugin]() { onPluginEnabled( plugin ); } );
|
||||
mUISceneNode->runOnMainThread(
|
||||
[&, plugin]() { onPluginEnabled( static_cast<Plugin*>( plugin ) ); } );
|
||||
plugin->removeReadyCallback( cbId );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ class App : public UICodeEditorSplitter::Client {
|
||||
|
||||
void initPluginManager();
|
||||
|
||||
void onPluginEnabled( UICodeEditorPlugin* plugin );
|
||||
void onPluginEnabled( Plugin* plugin );
|
||||
|
||||
void checkForUpdatesResponse( Http::Response response, bool fromStartup );
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ fuzzyMatchSymbols( const std::vector<const AutoCompletePlugin::SymbolsList*>& sy
|
||||
return matches;
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* AutoCompletePlugin::New( PluginManager* pluginManager ) {
|
||||
Plugin* AutoCompletePlugin::New( PluginManager* pluginManager ) {
|
||||
return eeNew( AutoCompletePlugin, ( pluginManager ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class AutoCompletePlugin : public Plugin {
|
||||
{ 0, 2, 2 } };
|
||||
}
|
||||
|
||||
static UICodeEditorPlugin* New( PluginManager* pluginManager );
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
|
||||
virtual ~AutoCompletePlugin();
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace ecode {
|
||||
#define FORMATTER_THREADED 0
|
||||
#endif
|
||||
|
||||
UICodeEditorPlugin* FormatterPlugin::New( PluginManager* pluginManager ) {
|
||||
Plugin* FormatterPlugin::New( PluginManager* pluginManager ) {
|
||||
return eeNew( FormatterPlugin, ( pluginManager, false ) );
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* FormatterPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
Plugin* FormatterPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
return eeNew( FormatterPlugin, ( pluginManager, true ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ class FormatterPlugin : public Plugin {
|
||||
FormatterPlugin::New, { 0, 2, 3 }, FormatterPlugin::NewSync };
|
||||
}
|
||||
|
||||
static UICodeEditorPlugin* New( PluginManager* pluginManager );
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
|
||||
static UICodeEditorPlugin* NewSync( PluginManager* pluginManager );
|
||||
static Plugin* NewSync( PluginManager* pluginManager );
|
||||
|
||||
virtual ~FormatterPlugin();
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ using json = nlohmann::json;
|
||||
|
||||
namespace ecode {
|
||||
|
||||
UICodeEditorPlugin* GitPlugin::New( PluginManager* pluginManager ) {
|
||||
Plugin* GitPlugin::New( PluginManager* pluginManager ) {
|
||||
return eeNew( GitPlugin, ( pluginManager, false ) );
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* GitPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
Plugin* GitPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
return eeNew( GitPlugin, ( pluginManager, true ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ class GitPlugin : public PluginBase {
|
||||
return { "git", "Git", "Git integration", GitPlugin::New, { 0, 0, 1 }, GitPlugin::NewSync };
|
||||
}
|
||||
|
||||
static UICodeEditorPlugin* New( PluginManager* pluginManager );
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
|
||||
static UICodeEditorPlugin* NewSync( PluginManager* pluginManager );
|
||||
static Plugin* NewSync( PluginManager* pluginManager );
|
||||
|
||||
virtual ~GitPlugin();
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace ecode {
|
||||
#define LINTER_THREADED 0
|
||||
#endif
|
||||
|
||||
UICodeEditorPlugin* LinterPlugin::New( PluginManager* pluginManager ) {
|
||||
Plugin* LinterPlugin::New( PluginManager* pluginManager ) {
|
||||
return eeNew( LinterPlugin, ( pluginManager, false ) );
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* LinterPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
Plugin* LinterPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
return eeNew( LinterPlugin, ( pluginManager, true ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ class LinterPlugin : public Plugin {
|
||||
LinterPlugin::NewSync };
|
||||
}
|
||||
|
||||
static UICodeEditorPlugin* New( PluginManager* pluginManager );
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
|
||||
static UICodeEditorPlugin* NewSync( PluginManager* pluginManager );
|
||||
static Plugin* NewSync( PluginManager* pluginManager );
|
||||
|
||||
virtual ~LinterPlugin();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "lspclientplugin.hpp"
|
||||
#include "../../version.hpp"
|
||||
#include <eepp/system/filesystem.hpp>
|
||||
#include <eepp/system/lock.hpp>
|
||||
#include <eepp/system/luapattern.hpp>
|
||||
@@ -116,11 +117,11 @@ class LSPCodeActionModel : public Model {
|
||||
std::vector<LSPCodeAction> mCodeActions;
|
||||
};
|
||||
|
||||
UICodeEditorPlugin* LSPClientPlugin::New( PluginManager* pluginManager ) {
|
||||
Plugin* LSPClientPlugin::New( PluginManager* pluginManager ) {
|
||||
return eeNew( LSPClientPlugin, ( pluginManager, false ) );
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* LSPClientPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
Plugin* LSPClientPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
return eeNew( LSPClientPlugin, ( pluginManager, true ) );
|
||||
}
|
||||
|
||||
@@ -871,7 +872,7 @@ void LSPClientPlugin::loadLSPConfig( std::vector<LSPDefinition>& lsps, const std
|
||||
config["server_close_after_idle_time"] = mClientManager.getLSPDecayTime().toString();
|
||||
|
||||
if ( config.contains( "semantic_highlighting" ) )
|
||||
mSemanticHighlighting = config.value( "semantic_highlighting", false );
|
||||
mSemanticHighlighting = config.value( "semantic_highlighting", true );
|
||||
else if ( updateConfigFile )
|
||||
config["semantic_highlighting"] = mSemanticHighlighting;
|
||||
|
||||
@@ -1543,6 +1544,12 @@ void LSPClientPlugin::setHoverDelay( const Time& hoverDelay ) {
|
||||
mHoverDelay = hoverDelay;
|
||||
}
|
||||
|
||||
void LSPClientPlugin::onVersionUpgrade( Uint32 oldVersion, Uint32 currentVersion ) {
|
||||
if ( oldVersion <= ECODE_VERSIONNUM( 0, 5, 0 ) ) {
|
||||
mSemanticHighlighting = true;
|
||||
}
|
||||
}
|
||||
|
||||
const LSPClientServerManager& LSPClientPlugin::getClientManager() const {
|
||||
return mClientManager;
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ class LSPClientPlugin : public Plugin {
|
||||
LSPClientPlugin::New, { 0, 2, 3 }, LSPClientPlugin::NewSync };
|
||||
}
|
||||
|
||||
static UICodeEditorPlugin* New( PluginManager* pluginManager );
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
|
||||
static UICodeEditorPlugin* NewSync( PluginManager* pluginManager );
|
||||
static Plugin* NewSync( PluginManager* pluginManager );
|
||||
|
||||
virtual ~LSPClientPlugin();
|
||||
|
||||
@@ -91,6 +91,8 @@ class LSPClientPlugin : public Plugin {
|
||||
|
||||
void setTrimLogs( bool trimLogs );
|
||||
|
||||
void onVersionUpgrade( Uint32 oldVersion, Uint32 currentVersion );
|
||||
|
||||
protected:
|
||||
friend class LSPDocumentClient;
|
||||
friend class LSPClientServer;
|
||||
@@ -108,7 +110,7 @@ class LSPClientPlugin : public Plugin {
|
||||
bool mOldDontAutoHideOnMouseMove{ false };
|
||||
bool mOldUsingCustomStyling{ false };
|
||||
bool mSymbolInfoShowing{ false };
|
||||
bool mSemanticHighlighting{ false };
|
||||
bool mSemanticHighlighting{ true };
|
||||
bool mSilence{ false };
|
||||
bool mTrimLogs{ false };
|
||||
UnorderedMap<std::string, std::string> mKeyBindings; /* cmd, shortcut */
|
||||
|
||||
@@ -40,6 +40,8 @@ class Plugin : public UICodeEditorPlugin {
|
||||
|
||||
String i18n( const std::string& key, const String& def ) const;
|
||||
|
||||
virtual void onVersionUpgrade( Uint32 oldVersion, Uint32 currentVersion ) {}
|
||||
|
||||
protected:
|
||||
PluginManager* mManager{ nullptr };
|
||||
std::shared_ptr<ThreadPool> mThreadPool;
|
||||
|
||||
@@ -38,7 +38,7 @@ void PluginManager::setUIThemeReloaded() {
|
||||
sendBroadcast( PluginMessageType::UIThemeReloaded, PluginMessageFormat::Empty, nullptr );
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* ecode::PluginManager::get( const std::string& id ) {
|
||||
Plugin* ecode::PluginManager::get( const std::string& id ) {
|
||||
auto findIt = mPlugins.find( id );
|
||||
if ( findIt != mPlugins.end() )
|
||||
return findIt->second;
|
||||
@@ -47,13 +47,13 @@ UICodeEditorPlugin* ecode::PluginManager::get( const std::string& id ) {
|
||||
|
||||
bool PluginManager::setEnabled( const std::string& id, bool enable, bool sync ) {
|
||||
mPluginsEnabled[id] = enable;
|
||||
UICodeEditorPlugin* plugin = get( id );
|
||||
Plugin* plugin = get( id );
|
||||
if ( enable && plugin == nullptr && hasDefinition( id ) ) {
|
||||
Log::debug( "PluginManager: loading plugin %s", mDefinitions[id].name.c_str() );
|
||||
UICodeEditorPlugin* newPlugin = sync && mDefinitions[id].creatorSyncFn
|
||||
Plugin* newPlugin = sync && mDefinitions[id].creatorSyncFn
|
||||
? mDefinitions[id].creatorSyncFn( this )
|
||||
: mDefinitions[id].creatorFn( this );
|
||||
mPlugins.insert( std::pair<std::string, UICodeEditorPlugin*>( id, newPlugin ) );
|
||||
mPlugins.insert( std::pair<std::string, Plugin*>( id, newPlugin ) );
|
||||
if ( onPluginEnabled )
|
||||
onPluginEnabled( newPlugin );
|
||||
return true;
|
||||
@@ -170,7 +170,7 @@ PluginRequestHandle PluginManager::sendRequest( PluginMessageType type, PluginMe
|
||||
return PluginRequestHandle::empty();
|
||||
}
|
||||
|
||||
PluginRequestHandle PluginManager::sendRequest( UICodeEditorPlugin* pluginWho,
|
||||
PluginRequestHandle PluginManager::sendRequest( Plugin* pluginWho,
|
||||
PluginMessageType type, PluginMessageFormat format,
|
||||
const void* data ) {
|
||||
if ( mClosing )
|
||||
@@ -190,7 +190,7 @@ PluginRequestHandle PluginManager::sendRequest( UICodeEditorPlugin* pluginWho,
|
||||
return PluginRequestHandle::empty();
|
||||
}
|
||||
|
||||
void PluginManager::sendResponse( UICodeEditorPlugin* pluginWho, PluginMessageType type,
|
||||
void PluginManager::sendResponse( Plugin* pluginWho, PluginMessageType type,
|
||||
PluginMessageFormat format, const void* data,
|
||||
const PluginIDType& responseID ) {
|
||||
if ( mClosing )
|
||||
@@ -205,7 +205,7 @@ void PluginManager::sendResponse( UICodeEditorPlugin* pluginWho, PluginMessageTy
|
||||
plugin.second( { type, format, data, responseID } );
|
||||
}
|
||||
|
||||
void PluginManager::sendBroadcast( UICodeEditorPlugin* pluginWho, PluginMessageType type,
|
||||
void PluginManager::sendBroadcast( Plugin* pluginWho, PluginMessageType type,
|
||||
PluginMessageFormat format, const void* data ) {
|
||||
if ( mClosing )
|
||||
return;
|
||||
@@ -252,11 +252,11 @@ void PluginManager::setPluginReloadEnabled( bool pluginReloadEnabled ) {
|
||||
}
|
||||
|
||||
void PluginManager::subscribeMessages(
|
||||
UICodeEditorPlugin* plugin, std::function<PluginRequestHandle( const PluginMessage& )> cb ) {
|
||||
Plugin* plugin, std::function<PluginRequestHandle( const PluginMessage& )> cb ) {
|
||||
subscribeMessages( plugin->getId(), cb );
|
||||
}
|
||||
|
||||
void PluginManager::unsubscribeMessages( UICodeEditorPlugin* plugin ) {
|
||||
void PluginManager::unsubscribeMessages( Plugin* plugin ) {
|
||||
unsubscribeMessages( plugin->getId() );
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PluginManager;
|
||||
class Plugin;
|
||||
class FileSystemListener;
|
||||
|
||||
typedef std::function<UICodeEditorPlugin*( PluginManager* pluginManager )> PluginCreatorFn;
|
||||
typedef std::function<Plugin*( PluginManager* pluginManager )> PluginCreatorFn;
|
||||
|
||||
#ifdef minor
|
||||
#undef minor
|
||||
@@ -271,7 +271,7 @@ class PluginManager {
|
||||
|
||||
void setUIThemeReloaded();
|
||||
|
||||
UICodeEditorPlugin* get( const std::string& id );
|
||||
Plugin* get( const std::string& id );
|
||||
|
||||
bool setEnabled( const std::string& id, bool enable, bool sync = false );
|
||||
|
||||
@@ -291,7 +291,7 @@ class PluginManager {
|
||||
|
||||
const std::shared_ptr<ThreadPool>& getThreadPool() const;
|
||||
|
||||
std::function<void( UICodeEditorPlugin* )> onPluginEnabled;
|
||||
std::function<void( Plugin* )> onPluginEnabled;
|
||||
|
||||
const std::map<std::string, PluginDefinition>& getDefinitions() const;
|
||||
|
||||
@@ -308,23 +308,23 @@ class PluginManager {
|
||||
PluginRequestHandle sendRequest( PluginMessageType type, PluginMessageFormat format,
|
||||
const void* data );
|
||||
|
||||
PluginRequestHandle sendRequest( UICodeEditorPlugin* pluginWho, PluginMessageType type,
|
||||
PluginRequestHandle sendRequest( Plugin* pluginWho, PluginMessageType type,
|
||||
PluginMessageFormat format, const void* data );
|
||||
|
||||
void sendResponse( UICodeEditorPlugin* pluginWho, PluginMessageType type,
|
||||
void sendResponse( Plugin* pluginWho, PluginMessageType type,
|
||||
PluginMessageFormat format, const void* data,
|
||||
const PluginIDType& responseID );
|
||||
|
||||
void sendBroadcast( UICodeEditorPlugin* pluginWho, PluginMessageType, PluginMessageFormat,
|
||||
void sendBroadcast( Plugin* pluginWho, PluginMessageType, PluginMessageFormat,
|
||||
const void* data );
|
||||
|
||||
void sendBroadcast( const PluginMessageType& notification, const PluginMessageFormat& format,
|
||||
void* data );
|
||||
|
||||
void subscribeMessages( UICodeEditorPlugin* plugin,
|
||||
void subscribeMessages( Plugin* plugin,
|
||||
std::function<PluginRequestHandle( const PluginMessage& )> cb );
|
||||
|
||||
void unsubscribeMessages( UICodeEditorPlugin* plugin );
|
||||
void unsubscribeMessages( Plugin* plugin );
|
||||
|
||||
void subscribeMessages( const std::string& uniqueComponentId,
|
||||
std::function<PluginRequestHandle( const PluginMessage& )> cb );
|
||||
@@ -350,7 +350,7 @@ class PluginManager {
|
||||
std::string mResourcesPath;
|
||||
std::string mPluginsPath;
|
||||
std::string mWorkspaceFolder;
|
||||
std::map<std::string, UICodeEditorPlugin*> mPlugins;
|
||||
std::map<std::string, Plugin*> mPlugins;
|
||||
std::map<std::string, bool> mPluginsEnabled;
|
||||
std::map<std::string, PluginDefinition> mDefinitions;
|
||||
std::shared_ptr<ThreadPool> mThreadPool;
|
||||
|
||||
@@ -13,11 +13,11 @@ using json = nlohmann::json;
|
||||
|
||||
namespace ecode {
|
||||
|
||||
UICodeEditorPlugin* XMLToolsPlugin::New( PluginManager* pluginManager ) {
|
||||
Plugin* XMLToolsPlugin::New( PluginManager* pluginManager ) {
|
||||
return eeNew( XMLToolsPlugin, ( pluginManager, false ) );
|
||||
}
|
||||
|
||||
UICodeEditorPlugin* XMLToolsPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
Plugin* XMLToolsPlugin::NewSync( PluginManager* pluginManager ) {
|
||||
return eeNew( XMLToolsPlugin, ( pluginManager, true ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ class XMLToolsPlugin : public PluginBase {
|
||||
XMLToolsPlugin::NewSync };
|
||||
}
|
||||
|
||||
static UICodeEditorPlugin* New( PluginManager* pluginManager );
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
|
||||
static UICodeEditorPlugin* NewSync( PluginManager* pluginManager );
|
||||
static Plugin* NewSync( PluginManager* pluginManager );
|
||||
|
||||
virtual ~XMLToolsPlugin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user