11import * as vscode from 'vscode' ;
2+ import { Repository } from '../@types/git' ;
23import { editorGroupNameMap , ViewColumnKey , ViewType } from '../definitions' ;
34import GitService , { RepositoryInfo } from '../utils/GitService' ;
45import EditorView from '../webviews/EditorView' ;
@@ -14,7 +15,7 @@ export default class EditorController {
1415 private _git : GitService
1516 ) { }
1617
17- openInTheMainView ( ) {
18+ async openInTheMainView ( repo : Repository ) {
1819 const config = vscode . workspace . getConfiguration ( 'commit-message-editor' ) ;
1920
2021 if ( this . _primaryEditorPanel ) {
@@ -49,7 +50,19 @@ export default class EditorController {
4950
5051 this . _ui = new UiApi ( this . _primaryEditorPanel . webview ) ;
5152 this . _ui . sendSCMInputBoxValue ( this . _git . getSCMInputBoxMessage ( ) ) ;
52- this . _ui . sendRepositoryInfo ( this . _getRepositoryInfo ( ) ) ;
53+
54+ if ( repo && repo . rootUri ) {
55+ const repoPath = repo . rootUri . path ;
56+ const commits = await this . _git . getRecentCommitMessagesByPath ( repoPath ) ;
57+
58+ this . _ui . sendRepositoryInfo ( {
59+ numberOfRepositories : this . _git . getNumberOfRepositories ( ) ,
60+ selectedRepositoryPath : repoPath ,
61+ } ) ;
62+ this . _ui . sendRecentCommits ( commits ) ;
63+ } else {
64+ this . _ui . sendRepositoryInfo ( this . _getRepositoryInfo ( ) ) ;
65+ }
5366
5467 this . _initReceivedMessageListener ( ) ;
5568 this . _git . onRepositoryDidChange ( this . _handleRepositoryDidChangeBound ) ;
0 commit comments