github / github/vscode-github-actions
Indentation switches from 2 to 4 spaces if a step uses `env:` or `with:`
- 主要语言
- TypeScript
- 星标
- 660
- 派生
- 213
- PR 合并指标
- 30 天内没有已合并 PR
描述
**Describe the bug**
If a job contains a step which uses `env:` or `with:` then the indentation on subsequent lines switches from 2 spaces to 4 spaces. The issue seems to only persist for the rest of the given job and resets in the next one.
**To Reproduce**
1. Start out with this file
```yaml
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Step 1
run: echo "step 1"
#- name: Step 2
- name: Step 3
uses: actions/checkout@v2
with:
foo: bar
#- name: Step 4
- name: Step 5
uses: echo "step 5"
env:
foo: bar
#- name: Step 6
- name: Step 7
run: echo "step 7"
```
3. Uncomment step 2, go to the end of the line, press enter then tab, start to type `run:`
5. The resulting text should be aligned with `name` from the line above it
6. Uncomment step 4, go to the end of the line, press enter then tab, start to type `run:`
7. The resulting text will not be aligned with `name` from the line above it, instead it will be indented an extra 2 characters
8. Uncomment step 6, go to the end of the line, press enter then tab, start to type `run:`
9. The resulting text will not be aligned with `name` from the line above it, instead it will be indented an extra 2 characters
**Expected behavior**
The second line of step's 4 and 6 to be aligned with the line above it.
**Screenshots**
https://github.com/github/vscode-github-actions/assets/831974/7c202f2d-a1f3-4097-9735-5cc474eb625c
**Extension Version**
`v0.25.8`
**Additional context**
1. The issue goes away if you switch the file's language from `github-actions-workflow` to `yaml`
2. Adding the following to my vscode settings file doesn't help:
```json
"[github-actions-workflow]": {
"editor.tabSize": 2,
"editor.insertSpaces": true,
},
```
3. The issue happens with and without GitHub Copilot running
贡献指南
调研方向
在 VS Code 中使用 github-actions-workflow 语言模式和报告中所示的 YAML 工作流重现该问题,尤其是包含 env: 或 with: 的步骤。比较在这些映射之后按 Enter 和 Tab 时的缩进。完成标准是后续步骤属性仍与前面的 name 行保持对齐,就像文件使用 yaml 语言模式时一样。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100