diff --git a/actions-expressions/package.json b/actions-expressions/package.json index ae2aa42..3bf7cd4 100755 --- a/actions-expressions/package.json +++ b/actions-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-expressions", - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "type": "module", "source": "./src/index.ts", diff --git a/actions-languageserver/package.json b/actions-languageserver/package.json index c9ea4f2..77e9a72 100644 --- a/actions-languageserver/package.json +++ b/actions-languageserver/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageserver", - "version": "0.1.127", + "version": "0.1.129", "description": "Language server for GitHub Actions", "license": "MIT", "type": "module", @@ -38,8 +38,8 @@ "watch": "tsc --build tsconfig.build.json --watch" }, "dependencies": { - "@github/actions-languageservice": "^0.1.127", - "@github/actions-workflow-parser": "^0.1.127", + "@github/actions-languageservice": "^0.1.129", + "@github/actions-workflow-parser": "^0.1.129", "@octokit/rest": "^19.0.7", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7", diff --git a/actions-languageservice/package.json b/actions-languageservice/package.json index b6c4525..a0bf5f7 100644 --- a/actions-languageservice/package.json +++ b/actions-languageservice/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-languageservice", - "version": "0.1.127", + "version": "0.1.129", "description": "Language service for GitHub Actions", "license": "MIT", "type": "module", @@ -38,8 +38,8 @@ "watch": "tsc --build tsconfig.build.json --watch" }, "dependencies": { - "@github/actions-expressions": "^0.1.127", - "@github/actions-workflow-parser": "^0.1.127", + "@github/actions-expressions": "^0.1.129", + "@github/actions-workflow-parser": "^0.1.129", "vscode-languageserver-textdocument": "^1.0.7", "vscode-languageserver-types": "^3.17.2", "yaml": "^2.1.1" diff --git a/actions-languageservice/src/complete.expressions.test.ts b/actions-languageservice/src/complete.expressions.test.ts index e9a0acf..7817beb 100644 --- a/actions-languageservice/src/complete.expressions.test.ts +++ b/actions-languageservice/src/complete.expressions.test.ts @@ -278,6 +278,13 @@ jobs: expect(result.map(x => x.label)).toEqual(["event"]); }); + it("auto-complete complex partial", async () => { + const input = 'run-name: "run ${{ github.ev| }} run"'; + const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig); + + expect(result.map(x => x.label)).toEqual(["event"]); + }); + it("using default context provider", async () => { const input = "on: push\njobs:\n build:\n runs-on: ubuntu-latest\n environment:\n url: ${{ runner.| }}\n steps:\n - run: echo"; diff --git a/actions-languageservice/src/complete.ts b/actions-languageservice/src/complete.ts index 8fd5eb6..c12bacd 100644 --- a/actions-languageservice/src/complete.ts +++ b/actions-languageservice/src/complete.ts @@ -217,20 +217,18 @@ function getExpressionCompletionItems( context: DescriptionDictionary, pos: Position ): CompletionItem[] { - let expressionInput = ""; let currentInput = ""; - let relCharOffset: number = 0; if (isBasicExpression(token)) { - expressionInput = currentInput = token.expression; - relCharOffset = getRelCharOffset(token.range!, expressionInput, pos); + currentInput = token.source || token.expression; } else { const stringToken = token.assertString("Expected string token for expression completion"); currentInput = stringToken.source || stringToken.value; - relCharOffset = getRelCharOffset(stringToken.range!, currentInput, pos); - expressionInput = (getExpressionInput(currentInput, relCharOffset) || "").trim(); } + const relCharOffset = getRelCharOffset(token.range!, currentInput, pos); + const expressionInput = (getExpressionInput(currentInput, relCharOffset) || "").trim(); + try { return completeExpression(expressionInput, context, [], validatorFunctions).map(item => mapExpressionCompletionItem(item, currentInput[relCharOffset]) diff --git a/actions-workflow-parser/package.json b/actions-workflow-parser/package.json index f3191b2..22815df 100644 --- a/actions-workflow-parser/package.json +++ b/actions-workflow-parser/package.json @@ -1,6 +1,6 @@ { "name": "@github/actions-workflow-parser", - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "type": "module", "source": "./src/index.ts", @@ -40,7 +40,7 @@ "watch": "tsc --build tsconfig.build.json --watch" }, "dependencies": { - "@github/actions-expressions": "^0.1.127", + "@github/actions-expressions": "^0.1.129", "cronstrue": "^2.21.0", "yaml": "^2.0.0-8" }, diff --git a/actions-workflow-parser/src/templates/template-reader.ts b/actions-workflow-parser/src/templates/template-reader.ts index cdc3e4c..e44a263 100644 --- a/actions-workflow-parser/src/templates/template-reader.ts +++ b/actions-workflow-parser/src/templates/template-reader.ts @@ -606,9 +606,9 @@ class TemplateReader { this._fileId, token.range, `format('${format.join("")}'${args.join("")})`, - token.definitionInfo, + definitionInfo, expressionTokens, - undefined + raw ); } diff --git a/browser-playground/package.json b/browser-playground/package.json index 6d16a2c..1d9dffa 100644 --- a/browser-playground/package.json +++ b/browser-playground/package.json @@ -1,12 +1,12 @@ { "name": "browser-playground", - "version": "0.1.127", + "version": "0.1.129", "description": "", "private": true, "main": "index.js", "type": "module", "dependencies": { - "@github/actions-languageserver": "^0.1.127", + "@github/actions-languageserver": "^0.1.129", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", diff --git a/lerna.json b/lerna.json index 8e03793..9948b66 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.1.127" + "version": "0.1.129" } diff --git a/package-lock.json b/package-lock.json index cbf4201..52e0112 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ }, "actions-expressions": { "name": "@github/actions-expressions", - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "devDependencies": { "@types/jest": "^29.0.3", @@ -34,11 +34,11 @@ }, "actions-languageserver": { "name": "@github/actions-languageserver", - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "dependencies": { - "@github/actions-languageservice": "^0.1.127", - "@github/actions-workflow-parser": "^0.1.127", + "@github/actions-languageservice": "^0.1.129", + "@github/actions-workflow-parser": "^0.1.129", "@octokit/rest": "^19.0.7", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.7", @@ -59,11 +59,11 @@ }, "actions-languageservice": { "name": "@github/actions-languageservice", - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "dependencies": { - "@github/actions-expressions": "^0.1.127", - "@github/actions-workflow-parser": "^0.1.127", + "@github/actions-expressions": "^0.1.129", + "@github/actions-workflow-parser": "^0.1.129", "vscode-languageserver-textdocument": "^1.0.7", "vscode-languageserver-types": "^3.17.2", "yaml": "^2.1.1" @@ -82,10 +82,10 @@ }, "actions-workflow-parser": { "name": "@github/actions-workflow-parser", - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "dependencies": { - "@github/actions-expressions": "^0.1.127", + "@github/actions-expressions": "^0.1.129", "cronstrue": "^2.21.0", "yaml": "^2.0.0-8" }, @@ -105,10 +105,10 @@ } }, "browser-playground": { - "version": "0.1.127", + "version": "0.1.129", "license": "MIT", "dependencies": { - "@github/actions-languageserver": "^0.1.127", + "@github/actions-languageserver": "^0.1.129", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2", "monaco-languageclient": "^4.0.3", @@ -14570,8 +14570,8 @@ "@github/actions-languageserver": { "version": "file:actions-languageserver", "requires": { - "@github/actions-languageservice": "^0.1.127", - "@github/actions-workflow-parser": "^0.1.127", + "@github/actions-languageservice": "^0.1.129", + "@github/actions-workflow-parser": "^0.1.129", "@octokit/rest": "^19.0.7", "@types/jest": "^29.0.3", "fetch-mock": "^9.11.0", @@ -14588,8 +14588,8 @@ "@github/actions-languageservice": { "version": "file:actions-languageservice", "requires": { - "@github/actions-expressions": "^0.1.127", - "@github/actions-workflow-parser": "^0.1.127", + "@github/actions-expressions": "^0.1.129", + "@github/actions-workflow-parser": "^0.1.129", "@types/jest": "^29.0.3", "jest": "^29.0.3", "prettier": "^2.8.3", @@ -14604,7 +14604,7 @@ "@github/actions-workflow-parser": { "version": "file:actions-workflow-parser", "requires": { - "@github/actions-expressions": "^0.1.127", + "@github/actions-expressions": "^0.1.129", "@types/jest": "^29.0.3", "@typescript-eslint/eslint-plugin": "^5.40.0", "@typescript-eslint/parser": "^5.40.0", @@ -17562,7 +17562,7 @@ "browser-playground": { "version": "file:browser-playground", "requires": { - "@github/actions-languageserver": "^0.1.127", + "@github/actions-languageserver": "^0.1.129", "css-loader": "^6.7.2", "monaco-editor-webpack-plugin": "^7.0.1", "monaco-editor-workers": "^0.34.2",