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

Commit35acc03

Browse files
committed
config option to disable autosave
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parenta33089a commit35acc03

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

‎src/actions/tutorialConfig.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as TT from 'typings/tutorial'
33
import*asvscodefrom'vscode'
44
import{COMMANDS}from'../editor/commands'
55
import*asgitfrom'../services/git'
6+
import{DISABLE_AUTOSAVE}from'../environment'
67

78
interfaceTutorialConfigParams{
89
config:TT.TutorialConfig
@@ -53,21 +54,23 @@ const tutorialConfig = async ({ config, alreadyConfigured }: TutorialConfigParam
5354

5455
awaitvscode.commands.executeCommand(COMMANDS.CONFIG_TEST_RUNNER,config.testRunner)
5556

56-
// verify if file test should run based on document saved
57-
constshouldRunTest=(document:vscode.TextDocument):boolean=>{
58-
// must be a file
59-
if(document.uri.scheme!=='file'){
60-
returnfalse
57+
if(!DISABLE_AUTOSAVE){
58+
// verify if file test should run based on document saved
59+
constshouldRunTest=(document:vscode.TextDocument):boolean=>{
60+
// must be a file
61+
if(document.uri.scheme!=='file'){
62+
returnfalse
63+
}
64+
returntrue
6165
}
62-
returntrue
63-
}
6466

65-
// setup onSave hook
66-
vscode.workspace.onDidSaveTextDocument((document:vscode.TextDocument)=>{
67-
if(shouldRunTest(document)){
68-
vscode.commands.executeCommand(COMMANDS.RUN_TEST)
69-
}
70-
})
67+
// setup onSave hook
68+
vscode.workspace.onDidSaveTextDocument((document:vscode.TextDocument)=>{
69+
if(shouldRunTest(document)){
70+
vscode.commands.executeCommand(COMMANDS.RUN_TEST)
71+
}
72+
})
73+
}
7174
}
7275

7376
exportdefaulttutorialConfig

‎src/environment.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ if (!supportedOS.includes(OS_PLATFORM)) {
3535
}
3636

3737
exportconstTUTORIAL_URL:string|null=process.env.CODEROAD_TUTORIAL_URL||null
38+
39+
exportconstDISABLE_AUTOSAVE=process.env.CODEROAD_DISABLE_AUTOSAVE
40+
?process.env.CODEROAD_DISABLE_AUTOSAVE.toLowerCase()==='true'
41+
:false

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp