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 @@ -68,8 +68,9 @@ export function activate(context: ExtensionContext) {
68
68
} else if ( ! fs . existsSync ( disableDottyIDEFile ) ) {
69
69
70
70
if ( ! vscode . workspace . workspaceFolders ) {
71
- if ( vscode . window . activeTextEditor ) {
72
- setWorkspaceAndReload ( vscode . window . activeTextEditor . document )
71
+ const editor = vscode . window . activeTextEditor
72
+ if ( editor && editor . document . uri . fsPath && editor . document . uri . fsPath . length > 0 ) {
73
+ setWorkspaceAndReload ( editor . document )
73
74
}
74
75
} else {
75
76
let configuredProject : Thenable < void > = Promise . resolve ( )
@@ -108,7 +109,16 @@ export function activate(context: ExtensionContext) {
108
109
function setWorkspaceAndReload ( document : vscode . TextDocument ) {
109
110
const documentPath = path . parse ( document . uri . fsPath ) . dir
110
111
const workspaceRoot = findWorkspaceRoot ( documentPath ) || documentPath
111
- vscode . workspace . updateWorkspaceFolders ( 0 , null , { uri : vscode . Uri . file ( workspaceRoot ) } )
112
+
113
+ vscode . window . showInformationMessage (
114
+ `It looks like '${ workspaceRoot } ' is the root of your workspace. ` +
115
+ 'Would you like to open it?' ,
116
+ 'Yes' , 'No'
117
+ ) . then ( ( value : String | undefined ) => {
118
+ if ( value === 'Yes' ) {
119
+ vscode . workspace . updateWorkspaceFolders ( 0 , null , { uri : vscode . Uri . file ( workspaceRoot ) } )
120
+ }
121
+ } )
112
122
}
113
123
114
124
/**
You can’t perform that action at this time.
0 commit comments