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

Commit502591a

Browse files
committed
fix bug with fileFormats
1 parentbe36c53 commit502591a

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

‎src/actions/tutorialConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import*asGfrom'typings/graphql'
22
import*asvscodefrom'vscode'
33
import*asgitfrom'../services/git'
4+
importlangaugeMapfrom'../editor/languageMap'
45

56
interfaceTutorialConfigParams{
67
config:G.TutorialConfig,
78
alreadyConfigured?:boolean
89
onComplete?():void
910
}
1011

12+
1113
consttutorialConfig=async({config, alreadyConfigured,}:TutorialConfigParams)=>{
1214
if(!alreadyConfigured){
1315
// setup git, add remote
@@ -19,8 +21,7 @@ const tutorialConfig = async ({config, alreadyConfigured, }: TutorialConfigParam
1921

2022
// setup onSave hook
2123
vscode.workspace.onDidSaveTextDocument((document:vscode.TextDocument)=>{
22-
constfileFormat:string=document.languageId.toUpperCase()
23-
//@ts-ignore warning on enums when validating a file format match
24+
constfileFormat:G.FileFormat=langaugeMap[document.languageId]
2425
if(document.uri.scheme==='file'&&config.fileFormats.includes(fileFormat)){
2526
vscode.commands.executeCommand('coderoad.run_test')
2627
}

‎src/editor/languageMap.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import*asGfrom'typings/graphql'
2+
// sourced from https://code.visualstudio.com/docs/languages/identifiers
3+
constlanguageMap:{
4+
[lang:string]:G.FileFormat
5+
}={
6+
// go: 'GO',
7+
javascript:'JS',
8+
javascriptreact:'JSX',
9+
json:'JSON',
10+
// less: 'LESS',
11+
// lua: 'LUA',
12+
// php: 'PHP',
13+
// python: 'PY',
14+
// ruby: 'RB',
15+
// sass: 'SASS',
16+
// scss: 'SCSS',
17+
// sql: 'SQL',
18+
typescript:'TS',
19+
typescriptreact:'TSX',
20+
// yaml: 'YAML'
21+
}
22+
23+
exportdefaultlanguageMap

‎web-app/src/services/apollo/queries/tutorial.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default gql`
1313
data {
1414
config {
1515
testRunner
16-
codingLanguages
16+
fileFormats
1717
repo {
1818
uri
1919
branch

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp