@@ -41,6 +41,7 @@ type AutocompleteRequest = {
4141 input : InputSnapshot ;
4242 getCurrentInput : ( ) => InputSnapshot ;
4343 getWorkspaceData : ( ) => WorkspaceData | undefined ;
44+ refreshWorkspaceData : ( ) => void ;
4445 applyCompletion : ( selection : CompletionPickItem ) => void ;
4546} ;
4647
@@ -64,6 +65,7 @@ export class RTermLang {
6465 input,
6566 getCurrentInput,
6667 getWorkspaceData,
68+ refreshWorkspaceData,
6769 applyCompletion,
6870 } : AutocompleteRequest ) : Promise < void > {
6971 if ( this . completionInProgress ) {
@@ -81,6 +83,14 @@ export class RTermLang {
8183
8284 this . completionInProgress = true ;
8385 try {
86+ const shouldRequestWorkspaceData = this . shouldRequestWorkspaceData ( context ) ;
87+ const workspaceDataRequest = shouldRequestWorkspaceData
88+ ? this . options . requestWorkspaceData ?.( )
89+ : undefined ;
90+ if ( ! shouldRequestWorkspaceData ) {
91+ refreshWorkspaceData ( ) ;
92+ }
93+
8494 await this . ensureConsoleLspStarted ( ) ;
8595
8696 const latestInput = getCurrentInput ( ) ;
@@ -91,8 +101,8 @@ export class RTermLang {
91101 return ;
92102 }
93103
94- const sessionData = this . shouldRequestWorkspaceData ( context )
95- ? ( await this . options . requestWorkspaceData ?. ( ) ) ?? getWorkspaceData ( )
104+ const sessionData = shouldRequestWorkspaceData
105+ ? ( await workspaceDataRequest ) ?? getWorkspaceData ( )
96106 : getWorkspaceData ( ) ;
97107 const doc = this . getOrUpdateCompletionDocument ( latestInput . text ) ;
98108 if ( ! doc ) {
0 commit comments