microsoft / vscode

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

VSCode is inserting tabs in yaml instead of spaces #192983

Closed danielo515 closed 9 months ago

danielo515 commented 9 months ago

Type: Bug

I tried changing all possible settings related to spaces/tabs and the specific ones for yaml, but VSCode keeps inserting tabs as indentation instread of spaces. This is very annoying because all the formatters that I've tried are not able to replace tabs by spaces, so I'm forced to do it manually. Even when copying from a yaml file that is correctly formatted into another yaml file that is in the same editor the spaces are converted to tabs, which is supper annoying.

VS Code version: Code 1.82.0 (8b617bd08fd9e3fc94d14adb8d358b56e3f72314, 2023-09-06T22:09:41.364Z) OS version: Darwin x64 22.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2900)| |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)|2, 3, 3| |Memory (System)|32.00GB (1.14GB free)| |Process Argv|--crash-reporter-id 3bf10e6d-54c9-4df4-8aaa-781f2b9fc1b9 --crash-reporter-id 3bf10e6d-54c9-4df4-8aaa-781f2b9fc1b9 --crash-reporter-id 3bf10e6d-54c9-4df4-8aaa-781f2b9fc1b9| |Screen Reader|no| |VM|0%|
Extensions (133) Extension|Author (truncated)|Version ---|---|--- yaml2json|ahe|0.0.5 project-manager|ale|12.7.0 auto-add-brackets|ali|0.12.2 jest-snippets|and|1.9.1 gitstash|art|5.2.0 find-and-transform|Art|4.8.3 material-ui|Aru|1.0.0 tailwind-docs|aus|2.1.0 vscode-django|bat|1.11.0 solidjs|ber|3.0.7 unique-lines|bib|1.0.0 file-browser|bod|0.2.11 vscode-tailwindcss|bra|0.10.0 better-toml|bun|0.3.2 rescript-vscode|che|1.20.0 npm-intellisense|chr|1.4.4 path-intellisense|chr|2.8.4 keymapceditor-vsc|Cia|0.7.7 vscode-devtools-for-chrome|cod|0.0.7 systemd-unit-file|coo|1.0.6 mermaid-graphical-editor|cor|0.2.6 doxdocgen|csc|1.4.0 vscode-svgviewer|css|2.0.0 python-snippets|cst|0.1.2 danielo-node-snippets|dan|1.8.13 danielo-vsc-tools|dan|1.0.3 vscode-eslint|dba|2.4.2 javascript-ejs-support|Dig|1.3.3 vs-code-snippet-generator|dku|1.1.0 githistory|don|0.6.20 python-extension-pack|don|1.7.0 jest-test-language-support|dpl|1.30.2 es7-react-js-snippets|dsz|4.4.3 gitlens|eam|14.3.0 EditorConfig|Edi|0.16.4 vscode-powertools|ego|0.64.0 prettier-vscode|esb|10.1.0 esy-vscode|esy|0.0.2 vscode-search-open-all-results|fab|1.0.3 vimL|fal|0.0.3 auto-complete-tag|for|0.1.0 auto-rename-tag|for|0.1.10 vscode-extension-react-ts-snippets|fun|1.2.0 monkey-c|ghi|0.4.0 lintlens|ghm|7.5.0 copilot|Git|1.111.404 vscode-github-actions|git|0.26.2 vscode-pull-request-github|Git|0.72.0 go|gol|0.39.1 vscode-graphql|Gra|0.8.17 vscode-graphql-syntax|Gra|1.2.2 align-mode|Gru|0.0.21 vscode-nginx-conf-hint|han|0.3.0 githd|hui|2.3.3 customize-ui|ioc|0.1.65 monkey-patch|ioc|0.1.23 fuzzy-search|jac|0.0.3 search-editor-apply-changes|jak|0.1.1 better-cpp-syntax|jef|1.17.2 haxe-blocks|jer|0.1.1 svg|joc|1.5.3 styled-components-snippets|jon|0.10.0 open-in-vim|jon|0.7.0 tw5-syntax|jos|1.0.4 vscode-styled-components|jpo|1.6.6 magit|kah|0.6.45 vscode-home-assistant|kee|1.39.0 vsc-python-indent|Kev|1.18.0 lix|lix|1.3.0 materialdesignicons-intellisense|luk|4.1.0 vscode-styled-components-snippets|lXS|1.0.2 MagicPython|mag|1.1.0 vscode-wrap-console-log|mid|1.7.2 dotenv|mik|1.0.1 vscode-docker|ms-|1.26.0 vscode-dotnet-runtime|ms-|1.7.2 python|ms-|2023.16.0 vscode-pylance|ms-|2023.9.10 remote-containers|ms-|0.309.0 remote-ssh|ms-|0.106.4 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.81.3 vscode-remote-extensionpack|ms-|0.24.0 cpptools-extension-pack|ms-|1.3.0 remote-explorer|ms-|0.4.1 remote-server|ms-|1.4.3 vscode-typescript-next|ms-|5.3.20230912 vsliveshare|ms-|1.0.5883 vsliveshare-pack|ms-|0.4.0 vscode-purty|mva|0.6.0 vshaxe|nad|2.29.1 autodocstring|njp|0.6.1 ocaml-platform|oca|1.13.0 indent-rainbow|ode|8.3.1 docthis|oou|0.8.2 python-string-sql|ptw|1.1.0 geo-data-viewer|Ran|2.6.0 ansible|red|2.7.98 vscode-commons|red|0.0.6 vscode-yaml|red|1.14.0 partial-diff|ryu|1.4.3 jinjahtml|sam|0.20.0 vscode-javascript-booster|sbu|14.0.1 bash-beautify|sha|0.1.1 vscode-fileutils|sle|3.10.3 code-spell-checker|str|3.0.1 code-spell-checker-spanish|str|2.2.0 iconfont-preview|stx|0.0.5 vscode-stylelint|sty|1.2.4 svelte-vscode|sve|107.10.1 control-snippets|svi|1.9.1 json-schema-validator|tbe|0.1.0 open-spec-file|the|0.0.6 shellcheck|tim|0.34.0 errorlens|use|3.13.0 remove-empty-lines|use|1.0.1 highlight-matching-tag|vin|0.11.0 intellicode-api-usage-examples|Vis|0.2.8 template-strings|vit|0.0.6 vscode-icons|vsc|12.5.0 mui-snippets|vsc|1.0.1 vim|vsc|1.26.0 haxe-checkstyle|vsh|1.8.3 vspacecode|VSp|0.10.14 whichkey|VSp|0.11.3 literally-html|web|0.1.3 vscode-file-extra|wil|3.1.0 glean|wix|5.2.2 change-case|wma|1.0.0 disable-eslint-rule|Woo|0.0.5 markdown-all-in-one|yzh|3.5.1 vscode-open-in-github|ziy|1.3.6 es6-string-javascript|zjc|1.0.1 (2 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 py29gd2263cf:30792227 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 vscccc:30803845 282f8724:30602487 f6dab269:30613381 showlangstatbar:30737416 962ge761:30831758 a2ce3375:30757347 24365598:30736109 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 asynctok:30821568 dsvsc013:30795093 dsvsc014:30804076 diffeditorv2:30821572 dsvsc015:30829745 ```
VSCodeTriageBot commented 9 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.82.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

aeschli commented 9 months ago

That's strange as for yaml we have configured to use spaces by default. That's part of the yaml extension settings. Can you share the example file?

danielo515 commented 9 months ago

I don't think the file is anything special, but here it is:

on:
    push:
        branches:
            - master

permissions:
    contents: write
    pull-requests: write

name: Release
jobs:
    release:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout Repo
              uses: actions/checkout@v3

            - name: Install Dependencies
              run: npm ci

            - name: Build
              run: npm run build

            - name: Release Please
              uses: google-github-actions/release-please-action@v3
              id: release
              with:
                  command: manifest
                  token: ${{secrets.GITHUB_TOKEN}}
            - name: Upload Release Assets
              if: ${{ steps.release.outputs.release_created }}
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                  TAG_NAME: ${{ steps.release.outputs.tag_name }}
              run: |
                  gh release upload $TAG_NAME main.js manifest.json styles.css

Here is also a video showing the issue:

https://github.com/microsoft/vscode/assets/2270425/4b92ff82-5ebe-4ae5-b6da-fab4637501a7

It is detecting the schema as github actions yaml, not sure if that is making a difference. I also have prettier installed, but there should be no yaml formatter in hearth that does this, since tabs are forbidden in yaml.

aeschli commented 9 months ago

What I'd be interested to know is what the status bar indicates. Using your example it shows me Spaces: 2. Pressing enter on line 26 inserts spaces for me. If the status bar shows Tabs, this is either what the editor detected based on the whitespaces in the editor, or a setting that overrides the default. Extensions can override the default, so please test with no extensions and all settings disabled. The easiest to to do that is to create a new (temporary) settings profile

VSCodeTriageBot commented 9 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!