@@ -58,6 +58,7 @@ import {
58
58
OtherStudioAction ,
59
59
contextSourceControlMenu ,
60
60
mainSourceControlMenu ,
61
+ StudioActions ,
61
62
} from "./commands/studio" ;
62
63
import { addServerNamespaceToWorkspace , pickServerAndNamespace } from "./commands/addServerNamespaceToWorkspace" ;
63
64
import { jumpToTagAndOffset , openErrorLocation } from "./commands/jumpToTagAndOffset" ;
@@ -153,6 +154,7 @@ import {
153
154
} from "./utils/documentIndex" ;
154
155
import { WorkspaceNode , NodeBase } from "./explorer/nodes" ;
155
156
import { showPlanWebview } from "./commands/showPlanPanel" ;
157
+ import { isfsConfig } from "./utils/FileProviderUtil" ;
156
158
157
159
const packageJson = vscode . extensions . getExtension ( extensionId ) . packageJSON ;
158
160
const extensionVersion = packageJson . version ;
@@ -708,6 +710,25 @@ async function systemModeWarning(wsFolders: readonly vscode.WorkspaceFolder[]):
708
710
}
709
711
}
710
712
713
+ /**
714
+ * Fire the `OpenedDocument` UserAction for any workspace folders
715
+ * that are showing the contents of a server-side project.
716
+ * This must be done because technically a project is a "document".
717
+ */
718
+ async function fireOpenProjectUserAction ( wsFolders : readonly vscode . WorkspaceFolder [ ] ) : Promise < void > {
719
+ if ( ! wsFolders || wsFolders . length == 0 ) return ;
720
+ for ( const wsFolder of wsFolders ) {
721
+ if ( notIsfs ( wsFolder . uri ) ) return ;
722
+ const { project } = isfsConfig ( wsFolder . uri ) ;
723
+ if ( ! project ) return ;
724
+ const api = new AtelierAPI ( wsFolder . uri ) ;
725
+ if ( ! api . active ) return ;
726
+ new StudioActions ( ) . fireProjectUserAction ( api , project , OtherStudioAction . OpenedDocument ) . catch ( ( ) => {
727
+ // Swallow error because showing it is more disruptive than using a potentially outdated project definition
728
+ } ) ;
729
+ }
730
+ }
731
+
711
732
/**
712
733
* Set when clause context keys so the ObjectScript Explorer and
713
734
* Projects Explorer views are correctly shown or hidden depending
@@ -941,6 +962,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
941
962
// Warn about SystemMode
942
963
systemModeWarning ( vscode . workspace . workspaceFolders ) ;
943
964
965
+ // Fire OpenedDocument UserAction for folders showing the contents of a server-side project
966
+ fireOpenProjectUserAction ( vscode . workspace . workspaceFolders ) ;
967
+
944
968
iscIcon = vscode . Uri . joinPath ( context . extensionUri , "images" , "fileIcon.svg" ) ;
945
969
946
970
// Index documents in all local workspace folders
@@ -1531,6 +1555,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
1531
1555
for ( const r of e . removed ) removeIndexOfWorkspaceFolder ( r ) ;
1532
1556
// Show or hide explorer views as needed
1533
1557
setExplorerContextKeys ( ) ;
1558
+ // Fire OpenedDocument UserAction for added folders showing the contents of a server-side project
1559
+ fireOpenProjectUserAction ( e . added ) ;
1534
1560
} ) ,
1535
1561
vscode . commands . registerCommand ( "vscode-objectscript.importXMLFiles" , importXMLFiles ) ,
1536
1562
vscode . commands . registerCommand ( "vscode-objectscript.exportToXMLFile" , exportDocumentsToXMLFile ) ,
0 commit comments