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

Commit15f619c

Browse files
committed
workspace folder error page
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parenta23644e commit15f619c

File tree

7 files changed

+26
-27
lines changed

7 files changed

+26
-27
lines changed
File renamed without changes.

‎package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"coderoad",
3-
"version":"0.2.1",
3+
"version":"0.2.2",
44
"description":"Play interactive coding tutorials in your editor",
55
"keywords": [
66
"tutorial",
@@ -26,7 +26,6 @@
2626
"scripts": {
2727
"build":"./scripts/build.sh",
2828
"postinstall":"node ./node_modules/vscode/bin/install",
29-
"publish":"vsce publish -p $PERSONAL_ACCESS_TOKEN --packagePath ./releases/coderoad-$npm_package_version.vsix --baseContentUrl https://github.com/coderoad/coderoad-vscode/blob/master --baseImagesUrl https://github.com/coderoad/coderoad-vscode/blob/master",
3029
"lint":"eslint src/**/*ts",
3130
"package":"./scripts/package.sh",
3231
"storybook":"cd web-app && npm run storybook",

‎src/channel/index.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +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'
17+
importenvironmentfrom'../environment'
1818

1919
constreadFileAsync=promisify(readFile)
2020

@@ -49,6 +49,22 @@ class Channel implements Channel {
4949

5050
switch(actionType){
5151
case'EDITOR_ENV_GET':
52+
// check if a workspace is open, otherwise nothing works
53+
constnoActiveWorksapce=!environment.WORKSPACE_ROOT.length
54+
if(noActiveWorksapce){
55+
consterror:E.ErrorMessage={
56+
type:'NoWorkspaceFound',
57+
message:'',
58+
actions:[
59+
{
60+
label:'Open Workspace',
61+
transition:'REQUEST_WORKSPACE',
62+
},
63+
],
64+
}
65+
this.send({type:'NO_WORKSPACE',payload:{ error}})
66+
return
67+
}
5268
this.send({
5369
type:'ENV_LOAD',
5470
payload:{
@@ -177,17 +193,6 @@ class Channel implements Channel {
177193
vscode.commands.executeCommand(COMMANDS.SET_CURRENT_STEP,action.payload)
178194
return
179195
case'EDITOR_VALIDATE_SETUP':
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-
191196
// check workspace is selected
192197
constisEmptyWorkspace=awaitcheckWorkspaceEmpty()
193198
if(!isEmptyWorkspace){

‎src/editor/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import*asvscodefrom'vscode'
2-
importnotifyfrom'../services/notify'
32
import{createCommands}from'./commands'
43

54
classEditor{

‎src/services/notify/index.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎web-app/src/services/state/machine.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,18 @@ export const createMachine = (options: any) => {
3535
states:{
3636
Startup:{
3737
onEntry:['loadEnv'],
38+
onExit:['clearError'],
3839
on:{
3940
ENV_LOAD:{
4041
target:'LoadStoredTutorial',
4142
actions:['setEnv'],
4243
},
44+
NO_WORKSPACE:{
45+
actions:['setError'],
46+
},
47+
REQUEST_WORKSPACE:{
48+
actions:'requestWorkspaceSelect',
49+
},
4350
},
4451
},
4552
LoadStoredTutorial:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp