Skip to content

Commit 13e0eba

Browse files
authored
Merge feature/stepfunctions-yaml-support #1456
2 parents 9184876 + c6dae3e commit 13e0eba

20 files changed

+1181
-173
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Adds ASL YAML linting and visualization support."
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Adds Amazon States Language (YAML) format to the ASL Language Server. Adds option to choose YAML format when creating new Step Functions state machine from a template."
4+
}

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"request": "attach",
2525
"port": 6009,
2626
"restart": true,
27-
"outFiles": ["${workspaceRoot}/dist/src/stepFunctions/amazonStatesLanguage/server.js"]
27+
"outFiles": ["${workspaceRoot}/dist/src/stepFunctions/asl/**.js"]
2828
},
2929
{
3030
"name": "Attach to SSM Document Language Server",

media/libs/vue.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 167 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"onCommand:aws.aboutToolkit",
5959
"onCommand:aws.cloudWatchLogs.viewLogStream",
6060
"onLanguage:asl",
61+
"onLanguage:asl-yaml",
6162
"onLanguage:ssm-json",
6263
"onLanguage:ssm-yaml",
6364
"onCommand:aws.ssmDocument.createLocalDocument",
@@ -739,7 +740,7 @@
739740
"editor/title": [
740741
{
741742
"command": "aws.previewStateMachine",
742-
"when": "editorLangId == asl && !isCloud9",
743+
"when": "(editorLangId == asl || editorLangId == asl-yaml) && !isCloud9",
743744
"group": "navigation"
744745
},
745746
{
@@ -1418,6 +1419,16 @@
14181419
"Amazon States Language"
14191420
]
14201421
},
1422+
{
1423+
"id": "asl-yaml",
1424+
"aliases": [
1425+
"Amazon States Language (YAML)"
1426+
],
1427+
"extensions": [
1428+
".asl.yaml",
1429+
".asl.yml"
1430+
]
1431+
},
14211432
{
14221433
"id": "ssm-json",
14231434
"extensions": [
@@ -1443,7 +1454,7 @@
14431454
"command": "aws.previewStateMachine",
14441455
"key": "ctrl+shift+v",
14451456
"mac": "cmd+shift+v",
1446-
"when": "editorTextFocus && editorLangId == asl && !isCloud9"
1457+
"when": "editorTextFocus && (editorLangId == asl || editorLangId == asl-yaml) && !isCloud9"
14471458
}
14481459
],
14491460
"grammars": [
@@ -1452,6 +1463,11 @@
14521463
"scopeName": "source.asl",
14531464
"path": "./syntaxes/ASL.tmLanguage"
14541465
},
1466+
{
1467+
"language": "asl-yaml",
1468+
"scopeName": "source.asl.yaml",
1469+
"path": "./syntaxes/asl-yaml.tmLanguage.json"
1470+
},
14551471
{
14561472
"language": "ssm-json",
14571473
"scopeName": "source.ssmjson",
@@ -1515,8 +1531,8 @@
15151531
"@types/mime-types": "^2.1.0",
15161532
"@types/mocha": "^7.0.2",
15171533
"@types/node": "^10.14.22",
1518-
"@types/request": "^2.47.1",
15191534
"@types/readline-sync": "^1.4.3",
1535+
"@types/request": "^2.47.1",
15201536
"@types/semver": "^5.5.0",
15211537
"@types/sinon": "^7.0.13",
15221538
"@types/tcp-port-used": "^1.0.0",
@@ -1552,6 +1568,7 @@
15521568
"ts-mockito": "^2.5.0",
15531569
"ts-node": "^9.0.0",
15541570
"tslint": "^6.1.3",
1571+
"umd-compat-loader": "^2.1.2",
15551572
"vsce": "^1.81.1",
15561573
"vscode-nls-dev": "^3.3.1",
15571574
"vscode-test": "^1.4.0",
@@ -1560,7 +1577,7 @@
15601577
},
15611578
"dependencies": {
15621579
"adm-zip": "^0.4.13",
1563-
"amazon-states-language-service": "^1.4.1",
1580+
"amazon-states-language-service": "^1.6.3",
15641581
"async-lock": "^1.1.3",
15651582
"aws-sdk": "^2.581.0",
15661583
"aws-ssm-document-language-service": "^1.0.0",

package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@
321321
"AWS.message.prompt.credentials.definition.help": "Would you like some information related to defining credentials?",
322322
"AWS.message.prompt.credentials.definition.tryAgain": "The credentials do not appear to be valid. Check the AWS Toolkit Logs for details. Would you like to try again?",
323323
"AWS.message.prompt.selectLocalLambda.placeholder": "Select a lambda function",
324+
"AWS.message.prompt.selectStateMachineTemplate.placeholder": "Select a starter template",
325+
"AWS.message.prompt.selectStateMachineTemplateFormat.placeholder": "Select template format",
324326
"AWS.message.prompt.quickStart.toastMessage": "You are now using AWS Toolkit version {0}",
325327
"AWS.message.prompt.region.hide.title": "Select a region to hide from the AWS Explorer",
326328
"AWS.message.prompt.region.show.title": "Select a region to show in the AWS Explorer",

src/integrationTest/stepFunctions/visualizeStateMachine.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async function waitUntilWebviewIsVisible(webviewPanel: vscode.WebviewPanel | und
9696
}
9797

9898
describe('visualizeStateMachine', async () => {
99-
before(async function () {
99+
before(async function() {
100100
this.timeout(600000)
101101
})
102102

@@ -148,7 +148,7 @@ describe('visualizeStateMachine', async () => {
148148
})
149149

150150
it('correctly displays content when given a sample state machine in yaml', async () => {
151-
const fileName = 'mysamplestatemachine.yaml'
151+
const fileName = 'mysamplestatemachine.asl.yaml'
152152
const textEditor = await openATextEditorWithText(samleStateMachineYaml, fileName)
153153

154154
const result = await vscode.commands.executeCommand<vscode.WebviewPanel>('aws.previewStateMachine')

src/stepFunctions/activation.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,23 @@ function initializeCodeLens(context: vscode.ExtensionContext) {
110110
command: 'aws.previewStateMachine',
111111
title: localize('AWS.stepFunctions.render', 'Render graph'),
112112
}
113-
114-
const publishCommand: vscode.Command = {
115-
command: 'aws.stepfunctions.publishStateMachine',
116-
title: localize('AWS.stepFunctions.publish', 'Publish to Step Functions'),
117-
}
118-
119113
const renderCodeLens = new vscode.CodeLens(topOfDocument, renderCommand)
120-
const publishCodeLens = new vscode.CodeLens(topOfDocument, publishCommand)
121114

122-
return [publishCodeLens, renderCodeLens]
115+
if (document.languageId === 'asl') {
116+
const publishCommand: vscode.Command = {
117+
command: 'aws.stepfunctions.publishStateMachine',
118+
title: localize('AWS.stepFunctions.publish', 'Publish to Step Functions'),
119+
}
120+
const publishCodeLens = new vscode.CodeLens(topOfDocument, publishCommand)
121+
122+
return [publishCodeLens, renderCodeLens]
123+
} else {
124+
return [renderCodeLens]
125+
}
123126
}
124127
}
125128

126-
const docSelector = {
127-
language: 'asl',
128-
}
129+
const docSelector = [{ language: 'asl' }, { language: 'asl-yaml' }]
129130

130131
const codeLensProviderDisposable = vscode.languages.registerCodeLensProvider(
131132
docSelector,

0 commit comments

Comments
 (0)