Commit Graph
23 Commits
Author SHA1 Message Date
eric scipleandGitHub 26f3969cde Add escape hatch completions to switch structural forms (#271)
When completing an empty value position (e.g., `runs-on: |`), add special
completions that let users switch to alternative structural forms:

- "(switch to list)" - restructures to `key:\n  - `
- "(switch to mapping)" - restructures to `key:\n  `

These help users escape "dead end" situations where the current form has
no valid completions but alternative forms are available in the schema.
2025-12-29 12:54:53 -06:00
eric scipleandGitHub 61a6fc54f2 Use detail field for one-of qualifiers instead of label (#266)
- Move qualifiers (list, full syntax) from label to detail field
- Remove filterText since labels are now clean
- Update distinctValues to preserve variants with different details
- Standard LSP pattern: detail shown after label in completion UI
2025-12-29 10:45:46 -06:00
eric scipleandGitHub efd53330a3 Remove invalid autocomplete options for committed structural types (#265)
Recent autocomplete improvements (typing activation, completion chaining, schema
variant surfacing) now guide users to discover the full schema naturally. This
change removes the legacy behavior that showed invalid options and silently
transformed YAML upon insertion.

Key changes:
- Filter one-of completion options based on the token's actual structural type
- When user commits to scalar (non-empty string), only show scalar options
- When user commits to mapping/sequence, only show those options
- Skip null-only scalars in Key mode to prevent clobbering string constants
- Scalar event completions (e.g., check_run at 'on: |') now insert inline

This ensures that when a user explicitly chooses a simplified form, they only
see values valid for that form, creating a cleaner and more predictable
autocomplete experience.
2025-12-23 10:25:49 -06:00
eric scipleandGitHub 9bb4c76612 Expand one-of keys to multiple completion items (#261)
* Expand one-of keys to multiple completion items

Some workflow fields accept multiple YAML structures (scalar, sequence, or
mapping), but completions previously only showed a single option—leaving users
unaware of the full schema flexibility. This change surfaces structural options
and inserts the correct YAML scaffolding so users land in the right place to
keep typing.

Example: runs-on

Completing runs-on now shows three options:
- runs-on         → Ready for a string like ubuntu-latest
- runs-on (list)  → Ready to add runner labels
- runs-on (full syntax) → Ready for labels:, group:, etc.

Notes:
- Qualifiers (list) and (full syntax) only appear when multiple structural types exist
- Scalar completions use the plain key name
- Qualified variants use filterText matching the base key

* Sort expanded one-of completions: scalar, list, full syntax
2025-12-22 10:49:49 -06:00
eric scipleandGitHub 656a821a94 ESM migration: Add .js extensions for node16 moduleResolution (#257)
Migrate expressions, workflow-parser, and languageservice packages to use
proper ESM imports with .js extensions that work with node16 moduleResolution.

Changes:
- Update tsconfig.build.json in each package to use module: node16 and
  moduleResolution: node16
- Add .js extensions to all relative import paths (Option B approach)
- Fix yaml internal type imports in workflow-parser by defining local types
- Add skipLibCheck to handle @types/node compatibility issues
- Add TypeScript 5.8.3 override in root package.json
- Add ESM migration plan documentation

The languageserver package is deferred due to test hang issues that need
further investigation.

Related #154 - Upgrade moduleResolution from node to node16 or nodenext
Related #110 - Published ESM code has imports without file extensions
Related #64 - expressions: ERR_MODULE_NOT_FOUND attempting to run example
Related #146 - Can not import @actions/workflow-parser

Test results:
- expressions: 1068 tests passed
- workflow-parser: 292 tests passed
- languageservice: 452 tests passed

* docs: update ESM migration plan with findings

- Update languageserver blocker: vscode-languageserver v8.0.2 lacks ESM
  exports (not a test hang issue)
- Document that Option B (manual .js extensions) was chosen over Option A
  due to ts-jest compatibility issues
- Add workaround for yaml package internal types (LinePos, NodeBase)
- Update migration status table with accurate reason for deferral
- Add skipLibCheck note for @types/node compatibility
2025-12-18 13:35:48 -06:00
eric scipleandGitHub 4181cb3c90 Fix expression completion in multi-line if block scalars (#238)
Fixed the cursor offset calculation for multi-line strings. The original
code unconditionally added +1 for a newline separator, but when the cursor
is on the first content line, there are no lines before it, so adding +1
produced an off-by-one error.

Fixes: vscode-github-actions#81
2025-12-08 09:20:50 -06:00
Christopher Schleiden 4f7d03ed0c Correctly indent completion options 2023-08-04 11:19:42 -07:00
Christopher SchleidenandChristopher Schleiden b82ddcdb42 Update import paths
String replacement from `@github/actions-` to `@actions/`
2023-03-23 09:57:18 -07:00
Josh Gross 8e03b387a2 Cache transformed workflows separately 2023-03-21 15:52:25 -04:00
Josh Gross 9ef34c7e41 Lint the language service package 2023-03-20 13:33:58 -04:00
Josh Gross 8942a05502 Handle undefined templates in workflow template cache 2023-03-17 13:23:43 -04:00
Jacob WallraffandGitHub e3973298fa Merge pull request #172 from github/thyeggman/cache-workflow-results
Cache parsed workflow and template results
2023-03-08 09:18:44 -08:00
Beth Brennan 20170641a5 Pass existingValues consistently 2023-03-07 15:36:47 -05:00
Beth BrennanandGitHub 2683e2e2a8 Merge branch 'main' into elbrenn/secret-complete 2023-03-07 15:23:50 -05:00
Jacob Wallraff 572b193c25 Merge branch 'main' into thyeggman/cache-workflow-results 2023-03-06 15:22:28 -08:00
Jacob Wallraff 6aaeefb9c2 Remove unused code and address feedback 2023-03-06 11:33:28 -08:00
Jacob Wallraff 2fc36cc6a1 Fix imports and format 2023-03-03 12:49:25 -08:00
Jacob Wallraff 5a199d4c52 Rename methods 2023-03-03 12:39:40 -08:00
Jacob Wallraff ffcd06c8c5 Move caching to language service 2023-03-03 12:28:29 -08:00
Laura YuandGitHub 31badfab56 Add trailing colon check for completion (#171) 2023-03-03 11:02:32 -08:00
Jacob Wallraff f2f377c21c Simple caching for parsed workflow and template 2023-03-02 16:43:23 -08:00
Beth Brennan 381d04730e Complete reusable workflow secrets, handle placeholder key 2023-03-01 12:57:36 -05:00
Christopher Schleiden 2a3d63551f Rename folders 2023-02-22 15:52:40 -08:00