File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ class EffektRunCodeLensProvider implements vscode.CodeLensProvider {
117117}
118118
119119export async function activate ( context : vscode . ExtensionContext ) {
120+ if ( ! ( await checkWorkspacePreconditions ( ) ) ) {
121+ return ;
122+ }
123+
120124 effektManager = new EffektManager ( ) ;
121125 try {
122126 // If Effekt is installed (no matter which version), start the language server
@@ -143,6 +147,30 @@ export async function activate(context: vscode.ExtensionContext) {
143147 }
144148}
145149
150+ export async function checkWorkspacePreconditions ( ) : Promise < boolean > {
151+ const isWindows = process . platform === 'win32' ;
152+ const folders = vscode . workspace . workspaceFolders ?? [ ] ;
153+ const hasSpaces = folders . some ( ( f ) => f . uri . fsPath . includes ( ' ' ) ) ;
154+
155+ if ( isWindows && hasSpaces ) {
156+ const issueUrl = 'https://github.com/effekt-lang/effekt-vscode/issues/30' ;
157+ const learnMore = 'Learn more' ;
158+
159+ const choice = await vscode . window . showErrorMessage (
160+ 'Effekt: Running in a path that contains spaces is currently not supported. Please move your workspace to a path without spaces.' ,
161+ { modal : true } ,
162+ learnMore ,
163+ ) ;
164+
165+ if ( choice === learnMore ) {
166+ await vscode . env . openExternal ( vscode . Uri . parse ( issueUrl ) ) ;
167+ }
168+ return false ;
169+ }
170+
171+ return true ;
172+ }
173+
146174async function ensureEffektIsAvailable ( ) {
147175 await effektManager . locateEffektExecutable ( ) ;
148176}
You can’t perform that action at this time.
0 commit comments