| 1227 | // Stash operations |
| 1228 | |
| 1229 | void GitPlugin::onRegister( UICodeEditor* editor ) { |
| 1230 | PluginBase::onRegister( editor ); |
| 1231 | |
| 1232 | for ( auto& kb : mKeyBindings ) { |
| 1233 | if ( !kb.second.empty() ) |
| 1234 | editor->getKeyBindings().addKeybindString( kb.second, kb.first ); |
| 1235 | } |
| 1236 | |
| 1237 | if ( !editor->hasDocument() ) |
| 1238 | return; |
| 1239 | |
| 1240 | auto& doc = editor->getDocument(); |
| 1241 | doc.setCommand( "git-blame", [this]( TextDocument::Client* client ) { |
| 1242 | blame( static_cast<UICodeEditor*>( client ) ); |
| 1243 | } ); |
| 1244 | doc.setCommand( "show-source-control-tab", [this]() { |
| 1245 | if ( mTab ) |
| 1246 | mTab->setTabSelected(); |
| 1247 | } ); |
| 1248 | doc.setCommand( "git-pull", [this] { pull( projectPath() ); } ); |
| 1249 | doc.setCommand( "git-push", [this] { push( projectPath() ); } ); |
| 1250 | doc.setCommand( "git-fetch", [this] { fetch( projectPath() ); } ); |
| 1251 | doc.setCommand( "git-commit", [this] { commit( projectPath() ); } ); |
| 1252 | } |
| 1253 | |
| 1254 | void GitPlugin::onUnregister( UICodeEditor* editor ) { |
| 1255 | PluginBase::onUnregister( editor ); |
nothing calls this directly
no test coverage detected