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) {
6868 } else if ( ! fs . existsSync ( disableDottyIDEFile ) ) {
6969
7070 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 )
7374 }
7475 } else {
7576 let configuredProject : Thenable < void > = Promise . resolve ( )
@@ -108,7 +109,16 @@ export function activate(context: ExtensionContext) {
108109function setWorkspaceAndReload ( document : vscode . TextDocument ) {
109110 const documentPath = path . parse ( document . uri . fsPath ) . dir
110111 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+ } )
112122}
113123
114124/**
You can’t perform that action at this time.
0 commit comments