File tree 1 file changed +13
-3
lines changed
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) {
76
76
} else if ( ! fs . existsSync ( disableDottyIDEFile ) ) {
77
77
78
78
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 )
81
82
}
82
83
} else {
83
84
let configuredProject : Thenable < void > = Promise . resolve ( )
@@ -116,7 +117,16 @@ export function activate(context: ExtensionContext) {
116
117
function setWorkspaceAndReload ( document : vscode . TextDocument ) {
117
118
const documentPath = path . parse ( document . uri . fsPath ) . dir
118
119
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
+ } )
120
130
}
121
131
122
132
/**
You can’t perform that action at this time.
0 commit comments