Skip to content

Commit

Permalink
add: snippets and clarify configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
lightumcc committed Nov 3, 2023
1 parent 82c3c7d commit 266bd35
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 159 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cpc-interpreter-extension",
"displayName": "CAIE Pseudocode",
"description": "A VSCode language support extension of CAIE PseudoCode",
"version": "0.0.5",
"version": "0.0.6",
"publisher": "CreatechStudioShanghaiInc",
"icon": "icon.png",
"main": "./src/extension.ts",
Expand Down Expand Up @@ -40,6 +40,12 @@
"path": "./syntaxes/cpc.tmLanguage.json"
}
],
"snippets": [
{
"language": "cpc",
"path": "./src/snippets.json"
}
],
"taskDefinitions": [
{
"type": "cpc"
Expand Down Expand Up @@ -88,7 +94,7 @@
"myCpcConfig.interpreterPath": {
"type": "string",
"default": "cpc",
"description": "Path to the CPC interpreter"
"description": "Path to the CPC interpreter, Please reboot VSCode after changing this setting."
}
}
}
Expand Down
157 changes: 0 additions & 157 deletions snippets/cpc.json

This file was deleted.

85 changes: 85 additions & 0 deletions src/snippets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"For Loop": {
"prefix": [
"FOR"
],
"body": [
"FOR ${3:element} <- ${1:start} TO ${2:end}",
"\t$0",
"NEXT $3"
],
"description": "A for loop."
},
"If": {
"prefix": [
"IF"
],
"body": [
"IF ${1:condition} THEN",
"\t$0",
"ENDIF"
],
"description": "An if statement"
},
"For Loop With Step": {
"prefix": [
"FORSTEP"
],
"body": [
"FOR ${4:element} <- ${1:start} TO ${2:end} STEP ${3:step}",
"\t$0",
"NEXT $4"
],
"description": "A for loop with step."
},
"While": {
"prefix": [
"WHILE"
],
"body": [
"WHILE ${1:condition} DO",
"\t$0",
"ENDWHILE"
],
"description": "A while loop."
},
"Repeat": {
"prefix": [
"REPEAT"
],
"body": [
"REPEAT",
"\t$0",
"UNTIL ${1:condition}"
],
"description": "A repeat-until loop."
},
"Declare": {
"prefix": [
"DECLARE"
],
"body": [
"DECLARE ${1:identifier} : ${2:type}"
],
"description": "Declare a variable."
},
"Declare Array": {
"prefix": [
"DECLAREARRAY"
],
"body": [
"DECLARE ${1:identifier} : ARRAY[${3:dimensions}] OF ${2:type}"
],
"description": "Declare an array."
},
"Declare Set": {
"prefix": [
"DECLARESET"
],
"body": [
"DECLARE ${1:identifier} : SET OF ${2:type}"
],
"description": "Declare an set."
}

}

0 comments on commit 266bd35

Please sign in to comment.