microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.46k stars 29.36k forks source link

Bash syntax highlighting in yml files in VSCode #207338

Closed martyzee closed 6 months ago

martyzee commented 8 months ago

Type: Bug

When using a bash step in a pipeline job, the syntax highlighting is unpredictable and sometimes just doesn’t work.

image image image

VS Code version: Code 1.85.1 (Universal) (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:06.308Z) OS version: Darwin x64 22.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2200)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 4, 5| |Memory (System)|16.00GB (0.10GB free)| |Process Argv|--crash-reporter-id 6c111b17-ec67-4a51-9adb-d3dc8085e9f3| |Screen Reader|no| |VM|0%|
Extensions (8) Extension|Author (truncated)|Version ---|---|--- terraform|4op|0.2.5 jsoncrack-vscode|Ayk|2.0.2 restore-terminals|Eth|1.1.8 vscode-docker|ms-|1.29.0 remote-containers|ms-|0.327.0 stannum-shellscript-syntax|sta|0.0.3 json2yaml|tux|0.2.0 errorlens|use|3.16.0
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 accentitlementsc:30887149 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 pydisww1:30959800 cppperfcontrol:30979541 d34g3935:30971562 bg6jg535:30979843 78248357:30976999 ccp2r6:30958158 dsvsc020:30976470 ```
vscodenpa commented 8 months ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.87.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

alexr00 commented 8 months ago

@martyzee can you share a copy+pastable cope snippet that I can use to reproduce the issue?

martyzee commented 8 months ago

@martyzee can you share a copy+pastable cope snippet that I can use to reproduce the issue?

stages:
  - stage: CheckPolicies
    pool:
      name: Default
    jobs:
      - job: CheckPolicies
        steps:
          - bash: |
              set -euo pipefail
              var=14 # this is an inline comment
              echo "echo statement"
              echo

              # this is a big comment
              # this is a big comment
              # this is a big comment
              for file in myfilename
              do
                echo do stuff
              done
stages:
  - stage: CheckPolicies
    pool:
      name: Default
    jobs:
      - job: CheckPolicies
      "
        steps:
          - bash: |
              set -euo pipefail
              var=14 # this is an inline comment
              echo "echo statement"
              echo

              # this is a big comment
              # this is a big comment
              # this is a big comment
              for file in myfilename
              do
                echo do stuff
              done
stages:
  - stage: CheckPolicies
    pool:
      name: Default
    jobs:
      - job: CheckPolicies
      {
        steps:
          - bash: |
              set -euo pipefail
              var=14 # this is an inline comment
              echo "echo statement"
              echo

              # this is a big comment
              # this is a big comment
              # this is a big comment
              for file in myfilename
              do
                echo do stuff
              done
RedCMD commented 8 months ago

{ is the start of flow-mapping which does allow comments (under prototype) image

and " just breaks strings in a weird way

martyzee commented 8 months ago

{ is the start of flow-mapping which does allow comments (under prototype)

and " just breaks strings in a weird way

I purely used those characters as an example of what the comments should look like, not in any way functional.

RedCMD commented 8 months ago

currently there's no special support for bash

you would like bash added as an embedded language?

alexr00 commented 8 months ago

Thanks for samples @martyzee and thanks for the analysis @RedCMD!

vscodenpa commented 8 months ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

martyzee commented 8 months ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Is this technically not a bug?

martyzee commented 8 months ago

currently there's no special support for bash

you would like bash added as an embedded language?

@RedCMD can you upvote please?

vscodenpa commented 6 months ago

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

vscodenpa commented 6 months ago

:slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!