Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita23644e

Browse files
committed
add no workspace validation checks
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentde69287 commita23644e

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

‎errors/NoWorkspaceFolder.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
###Open a Workspace Folder
2+
3+
CodeRoad requires a workspace folder to run. Open a new workspace and re-launch CodeRoad.

‎src/channel/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { openWorkspace, checkWorkspaceEmpty } from '../services/workspace'
1414
import{readFile}from'fs'
1515
import{join}from'path'
1616
import{promisify}from'util'
17+
importenvironmentfrom'environment'
1718

1819
constreadFileAsync=promisify(readFile)
1920

@@ -176,7 +177,18 @@ class Channel implements Channel {
176177
vscode.commands.executeCommand(COMMANDS.SET_CURRENT_STEP,action.payload)
177178
return
178179
case'EDITOR_VALIDATE_SETUP':
179-
// 1. check workspace is selected
180+
// check if a workspace is open
181+
constnoActiveWorksapce=!environment.WORKSPACE_ROOT.length
182+
if(noActiveWorksapce){
183+
consterror:E.ErrorMessage={
184+
type:'NoWorkspaceFound',
185+
message:'',
186+
}
187+
this.send({type:'VALIDATE_SETUP_FAILED',payload:{ error}})
188+
return
189+
}
190+
191+
// check workspace is selected
180192
constisEmptyWorkspace=awaitcheckWorkspaceEmpty()
181193
if(!isEmptyWorkspace){
182194
consterror:E.ErrorMessage={
@@ -196,7 +208,7 @@ class Channel implements Channel {
196208
this.send({type:'VALIDATE_SETUP_FAILED',payload:{ error}})
197209
return
198210
}
199-
//2.check Git is installed.
211+
// check Git is installed.
200212
// Should wait for workspace before running otherwise requires access to root folder
201213
constisGitInstalled=awaitversion('git')
202214
if(!isGitInstalled){

‎src/services/workspace/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getWorkspaceRoot = (): string => {
2525
constworkspaceRoots:vscode.WorkspaceFolder[]|undefined=vscode.workspace.workspaceFolders
2626
if(!workspaceRoots||!workspaceRoots.length){
2727
// no workspace root
28-
return'NO_WORKSPACE_FOUND'
28+
return''
2929
}
3030
// a user may have multiple workspace folders
3131
// for simplicity, assume the first is the active workspace

‎typings/error.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ export type ErrorMessageView = 'FULL_PAGE' | 'NOTIFY' | 'NONE'
22

33
exporttypeErrorMessageType=
44
|'UnknownError'
5+
|'NoWorkspaceFound'
56
|'GitNotFound'
7+
|'WorkspaceNotEmpty'
68
|'FailedToConnectToGitRepo'
79
|'GitProjectAlreadyExists'
810
|'GitRemoteAlreadyExists'
9-
|'WorkspaceNotEmpty'
1011

1112
exporttypeErrorAction={
1213
label:string

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp