File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,9 @@ export function activate(context: ExtensionContext) {
7676 } else if ( ! fs . existsSync ( disableDottyIDEFile ) ) {
7777
7878 if ( ! vscode . workspace . workspaceFolders ) {
79- if ( vscode . window . activeTextEditor ) {
80- setWorkspaceAndReload ( vscode . window . activeTextEditor . document )
79+ const editor = vscode . window . activeTextEditor
80+ if ( editor && editor . document . uri . fsPath && editor . document . uri . fsPath . length > 0 ) {
81+ setWorkspaceAndReload ( editor . document )
8182 }
8283 } else {
8384 let configuredProject : Thenable < void > = Promise . resolve ( )
@@ -116,7 +117,16 @@ export function activate(context: ExtensionContext) {
116117function setWorkspaceAndReload ( document : vscode . TextDocument ) {
117118 const documentPath = path . parse ( document . uri . fsPath ) . dir
118119 const workspaceRoot = findWorkspaceRoot ( documentPath ) || documentPath
119- vscode . workspace . updateWorkspaceFolders ( 0 , null , { uri : vscode . Uri . file ( workspaceRoot ) } )
120+
121+ vscode . window . showInformationMessage (
122+ `It looks like '${ workspaceRoot } ' is the root of your Scala workspace. ` +
123+ 'Would you like to open it?' ,
124+ 'Yes' , 'No'
125+ ) . then ( ( value : String | undefined ) => {
126+ if ( value === 'Yes' ) {
127+ vscode . workspace . updateWorkspaceFolders ( 0 , null , { uri : vscode . Uri . file ( workspaceRoot ) } )
128+ }
129+ } )
120130}
121131
122132/**
You can’t perform that action at this time.
0 commit comments