@@ -65,6 +65,7 @@ function M.new(id, mediator)
6565 user = (Config .chat and Config .chat .headers and Config .chat .headers .user ) or " > " ,
6666 assistant = (Config .chat and Config .chat .headers and Config .chat .headers .assistant ) or " " ,
6767 }
68+ instance ._welcome_message_applied = false
6869
6970 require (" eca.observer" ).subscribe (" sidebar-" .. id , function (message )
7071 instance :handle_chat_content (message )
@@ -192,6 +193,7 @@ function M:reset()
192193 self ._selected_code = nil
193194 self ._todos = {}
194195 self ._current_status = " "
196+ self ._welcome_message_applied = false
195197end
196198
197199function M :new_chat ()
@@ -747,6 +749,7 @@ function M:_handle_state_updated(state)
747749
748750 if state .config or state .tools then
749751 self :_update_config_display ()
752+ self :_update_welcome_content ()
750753 end
751754end
752755
@@ -869,26 +872,7 @@ function M:_set_welcome_content()
869872 self ._force_welcome = false
870873 end
871874
872- local lines = {
873- " # 🤖 ECA - Editor Code Assistant" ,
874- " " ,
875- " > **Welcome to ECA!** Your AI-powered code assistant is ready to help." ,
876- " " ,
877- " ## 🚀 Getting Started" ,
878- " " ,
879- " - **Chat**: Type your message in the input field at the bottom and press `Ctrl+S` to send" ,
880- " - **Multiline**: Use `Enter` for new lines, `Ctrl+S` to send" ,
881- " - **Context**: Use `@` to mention files or directories" ,
882- " - **Context**: Use `:EcaAddFile` to add files, `:EcaListContexts` to view, `:EcaClearContexts` to clear" ,
883- " - **Selection**: Use `:EcaAddSelection` to add code selection" ,
884- " - **RepoMap**: Use `:EcaAddRepoMap` to add repository structure context" ,
885- " " ,
886- " ---" ,
887- " " ,
888- }
889-
890- Logger .debug (" Setting welcome content for new chat" )
891- vim .api .nvim_buf_set_lines (chat .bufnr , 0 , - 1 , false , lines )
875+ self :_update_welcome_content ()
892876
893877 -- Auto-add repoMap context if enabled and not already present
894878 if Config .options .context .auto_repo_map then
@@ -1224,6 +1208,41 @@ function M:_update_usage_info()
12241208 )
12251209end
12261210
1211+ function M :_update_welcome_content ()
1212+ if self ._welcome_applied then
1213+ return
1214+ end
1215+
1216+ local chat = self .containers .chat
1217+ if not chat or not vim .api .nvim_buf_is_valid (chat .bufnr ) then
1218+ return
1219+ end
1220+
1221+ local cfg = (Config .chat and Config .chat .welcome ) or {}
1222+ local cfg_msg = (cfg .message and cfg .message ~= " " and cfg .message ) or nil
1223+ local welcome_message = cfg_msg or (self .mediator and self .mediator :welcome_message () or nil )
1224+
1225+ local lines = { " Waiting for welcome message from ECA server..." }
1226+
1227+ if welcome_message and welcome_message ~= " " then
1228+ lines = Utils .split_lines (welcome_message )
1229+
1230+ local tips = cfg .tips or {}
1231+
1232+ if # tips > 0 then
1233+ for _ , tip in ipairs (tips ) do
1234+ table.insert (lines , tip )
1235+ end
1236+ end
1237+
1238+ self ._welcome_applied = true
1239+ end
1240+
1241+ table.insert (lines , " " )
1242+ Logger .debug (" Setting welcome content for chat (welcome applied: " .. tostring (self ._welcome_applied ) .. " )" )
1243+ vim .api .nvim_buf_set_lines (chat .bufnr , 0 , - 1 , false , lines )
1244+ end
1245+
12271246function M :_render_header (container_name , header_text )
12281247 if not Config .windows .sidebar_header .enabled then
12291248 return {}
0 commit comments