File tree Expand file tree Collapse file tree 4 files changed +19
-14
lines changed
extensions/intellij/src/main
kotlin/com/github/continuedev/continueintellijextension/actions/menu/file
gui/src/components/mainInput/TipTapEditor Expand file tree Collapse file tree 4 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -78,5 +78,8 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
7878 exitEditMode : [ undefined , void ] ;
7979 focusEdit : [ undefined , void ] ;
8080 generateRule : [ undefined , void ] ;
81- mentionFile : [ { fullFilePath : string ; shortFilePath : string } , void ] ;
81+ mentionFileOrDirectory : [
82+ { type : "file" | "folder" ; fullPath : string ; name : string } ,
83+ void ,
84+ ] ;
8285} ;
Original file line number Diff line number Diff line change @@ -7,24 +7,26 @@ import com.intellij.openapi.actionSystem.AnActionEvent
77import com.intellij.openapi.actionSystem.CommonDataKeys
88import com.intellij.openapi.vfs.VirtualFile
99
10- class MentionFileInChatAction : AnAction () {
10+ class MentionFileOrFolderInChatAction : AnAction () {
1111 override fun actionPerformed (e : AnActionEvent ) {
1212 val continuePluginService = getContinuePluginService(e.project) ? : return
1313 val virtualFile = e.getFile() ? : return
1414
15+ val type = if (virtualFile.isDirectory) " folder" else " file"
1516 val params = mapOf (
16- " fullFilePath" to virtualFile.url,
17- " shortFilePath" to virtualFile.name,
17+ " type" to type,
18+ " fullPath" to virtualFile.url,
19+ " name" to virtualFile.name,
1820 )
1921
20- continuePluginService.sendToWebview(" mentionFile " , params)
22+ continuePluginService.sendToWebview(" mentionFileOrDirectory " , params)
2123 }
2224
2325 override fun update (e : AnActionEvent ) {
2426 val file = e.getFile()
2527 val files = e.getFiles()
2628
27- val isAvailable = file != null && ! file.isDirectory && files.size == 1
29+ val isAvailable = file != null && files.size == 1
2830
2931 e.presentation.isVisible = isAvailable
3032 }
Original file line number Diff line number Diff line change 182182 <override-text place =" GoToAction" text =" Continue: Add Highlighted Code to Context and Clear Chat" />
183183 </action >
184184 <group id =" ContinueProjectViewPopUpMenuGroup" popup =" true" text =" Continue" >
185- <action id =" com.github.continuedev.continueintellijextension.actions.menu.file.MentionFileInChatAction "
186- class =" com.github.continuedev.continueintellijextension.actions.menu.file.MentionFileInChatAction "
187- text =" Mention File in the Chat" >
185+ <action id =" com.github.continuedev.continueintellijextension.actions.menu.file.MentionFileOrFolderInChatAction "
186+ class =" com.github.continuedev.continueintellijextension.actions.menu.file.MentionFileOrFolderInChatAction "
187+ text =" Mention in the Chat" >
188188 </action >
189189
190190 <add-to-group group-id =" ProjectViewPopupMenu" anchor =" last" />
Original file line number Diff line number Diff line change @@ -200,18 +200,18 @@ export function useMainEditorWebviewListeners({
200200 ) ;
201201
202202 useWebviewListener (
203- "mentionFile " ,
203+ "mentionFileOrDirectory " ,
204204 async ( data ) => {
205205 if ( ! editor ) return ;
206206 editor
207207 . chain ( )
208208 . insertContent ( {
209209 type : "mention" ,
210210 attrs : {
211- id : data . fullFilePath ,
212- query : data . fullFilePath ,
213- itemType : "file" ,
214- label : data . shortFilePath ,
211+ id : data . fullPath ,
212+ query : data . fullPath ,
213+ itemType : data . type ,
214+ label : data . name ,
215215 } ,
216216 } )
217217 . insertContent ( " " )
You can’t perform that action at this time.
0 commit comments