Skip to content

Commit

Permalink
Merge feature/stepfunctions-yaml-support #1456
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk3 authored Jan 7, 2021
2 parents 9184876 + c6dae3e commit 13e0eba
Show file tree
Hide file tree
Showing 20 changed files with 1,181 additions and 173 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Adds ASL YAML linting and visualization support."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"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."
}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"request": "attach",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceRoot}/dist/src/stepFunctions/amazonStatesLanguage/server.js"]
"outFiles": ["${workspaceRoot}/dist/src/stepFunctions/asl/**.js"]
},
{
"name": "Attach to SSM Document Language Server",
Expand Down
6 changes: 3 additions & 3 deletions media/libs/vue.min.js

Large diffs are not rendered by default.

171 changes: 167 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"onCommand:aws.aboutToolkit",
"onCommand:aws.cloudWatchLogs.viewLogStream",
"onLanguage:asl",
"onLanguage:asl-yaml",
"onLanguage:ssm-json",
"onLanguage:ssm-yaml",
"onCommand:aws.ssmDocument.createLocalDocument",
Expand Down Expand Up @@ -739,7 +740,7 @@
"editor/title": [
{
"command": "aws.previewStateMachine",
"when": "editorLangId == asl && !isCloud9",
"when": "(editorLangId == asl || editorLangId == asl-yaml) && !isCloud9",
"group": "navigation"
},
{
Expand Down Expand Up @@ -1418,6 +1419,16 @@
"Amazon States Language"
]
},
{
"id": "asl-yaml",
"aliases": [
"Amazon States Language (YAML)"
],
"extensions": [
".asl.yaml",
".asl.yml"
]
},
{
"id": "ssm-json",
"extensions": [
Expand All @@ -1443,7 +1454,7 @@
"command": "aws.previewStateMachine",
"key": "ctrl+shift+v",
"mac": "cmd+shift+v",
"when": "editorTextFocus && editorLangId == asl && !isCloud9"
"when": "editorTextFocus && (editorLangId == asl || editorLangId == asl-yaml) && !isCloud9"
}
],
"grammars": [
Expand All @@ -1452,6 +1463,11 @@
"scopeName": "source.asl",
"path": "./syntaxes/ASL.tmLanguage"
},
{
"language": "asl-yaml",
"scopeName": "source.asl.yaml",
"path": "./syntaxes/asl-yaml.tmLanguage.json"
},
{
"language": "ssm-json",
"scopeName": "source.ssmjson",
Expand Down Expand Up @@ -1515,8 +1531,8 @@
"@types/mime-types": "^2.1.0",
"@types/mocha": "^7.0.2",
"@types/node": "^10.14.22",
"@types/request": "^2.47.1",
"@types/readline-sync": "^1.4.3",
"@types/request": "^2.47.1",
"@types/semver": "^5.5.0",
"@types/sinon": "^7.0.13",
"@types/tcp-port-used": "^1.0.0",
Expand Down Expand Up @@ -1552,6 +1568,7 @@
"ts-mockito": "^2.5.0",
"ts-node": "^9.0.0",
"tslint": "^6.1.3",
"umd-compat-loader": "^2.1.2",
"vsce": "^1.81.1",
"vscode-nls-dev": "^3.3.1",
"vscode-test": "^1.4.0",
Expand All @@ -1560,7 +1577,7 @@
},
"dependencies": {
"adm-zip": "^0.4.13",
"amazon-states-language-service": "^1.4.1",
"amazon-states-language-service": "^1.6.3",
"async-lock": "^1.1.3",
"aws-sdk": "^2.581.0",
"aws-ssm-document-language-service": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@
"AWS.message.prompt.credentials.definition.help": "Would you like some information related to defining credentials?",
"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?",
"AWS.message.prompt.selectLocalLambda.placeholder": "Select a lambda function",
"AWS.message.prompt.selectStateMachineTemplate.placeholder": "Select a starter template",
"AWS.message.prompt.selectStateMachineTemplateFormat.placeholder": "Select template format",
"AWS.message.prompt.quickStart.toastMessage": "You are now using AWS Toolkit version {0}",
"AWS.message.prompt.region.hide.title": "Select a region to hide from the AWS Explorer",
"AWS.message.prompt.region.show.title": "Select a region to show in the AWS Explorer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function waitUntilWebviewIsVisible(webviewPanel: vscode.WebviewPanel | und
}

describe('visualizeStateMachine', async () => {
before(async function () {
before(async function() {
this.timeout(600000)
})

Expand Down Expand Up @@ -148,7 +148,7 @@ describe('visualizeStateMachine', async () => {
})

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

const result = await vscode.commands.executeCommand<vscode.WebviewPanel>('aws.previewStateMachine')
Expand Down
23 changes: 12 additions & 11 deletions src/stepFunctions/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,23 @@ function initializeCodeLens(context: vscode.ExtensionContext) {
command: 'aws.previewStateMachine',
title: localize('AWS.stepFunctions.render', 'Render graph'),
}

const publishCommand: vscode.Command = {
command: 'aws.stepfunctions.publishStateMachine',
title: localize('AWS.stepFunctions.publish', 'Publish to Step Functions'),
}

const renderCodeLens = new vscode.CodeLens(topOfDocument, renderCommand)
const publishCodeLens = new vscode.CodeLens(topOfDocument, publishCommand)

return [publishCodeLens, renderCodeLens]
if (document.languageId === 'asl') {
const publishCommand: vscode.Command = {
command: 'aws.stepfunctions.publishStateMachine',
title: localize('AWS.stepFunctions.publish', 'Publish to Step Functions'),
}
const publishCodeLens = new vscode.CodeLens(topOfDocument, publishCommand)

return [publishCodeLens, renderCodeLens]
} else {
return [renderCodeLens]
}
}
}

const docSelector = {
language: 'asl',
}
const docSelector = [{ language: 'asl' }, { language: 'asl-yaml' }]

const codeLensProviderDisposable = vscode.languages.registerCodeLensProvider(
docSelector,
Expand Down
Loading

0 comments on commit 13e0eba

Please sign in to comment.