microsoft / vscode

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

VSCode changes position of cursor while typing #133591

Closed noahweasley closed 2 years ago

noahweasley commented 2 years ago

Issue Type: Bug

When typing in VSCode editor, when I click on the 'Enter' key, to move to the next line, the cursor appears on my preferred editor column and row (according to my default formatter indentation), but it later moves to the far left of that specific row in which I am typing.

For example, when the cursor is on column 10 of row 70, the cursor moves to column 0 of row 70 (assuming the first column of the editor is on column 0). VSCode also seems to move my cursor when I type other characters, as if it were performing 'Format on type' as I type. It interferes with everything I am doing and I sometimes make silly mistakes while typing. I ran Extension Bisect on VSCode and at first, the bug was gone. Extension Bisect finished but didn't fix the problem

VS Code version: Code 1.60.1 (83bd43bc519d15e50c4272c6cf5c1479df196a4d, 2021-09-10T17:07:10.714Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Celeron(R) CPU N2820 @ 2.13GHz (2 x 2133)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: disabled_off
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|3.90GB (0.62GB free)| |Process Argv|--crash-reporter-id e449c0a5-8a40-43cc-92a2-0401cdf8de4d| |Screen Reader|no| |VM|0%|
Extensions (154) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|2.1.0 html-snippets|abu|0.2.1 add-reference|adr|1.0.2 asp-net-core-snippet-pack|adr|1.51.0 asp-net-core-switcher|adr|2.0.2 libman|adr|1.0.1 namespace|adr|1.1.2 terminal-commands|adr|1.0.5 user-secrets|adr|2.0.1 node-essentials|afr|1.1.0 vscode-javascript-snippet-pack|aka|0.1.6 shaderlabvscodefree|aml|1.2.8 vscode-custom-css|be5|6.0.1 vscode-icontheme-nomo-dark|be5|1.3.6 vscode-node-readme|ben|3.0.2 color-info|bie|0.7.0 csharp-extentions-pack|bou|0.3.0 vscode-tailwindcss|bra|0.6.14 vscode-standardjs|che|1.4.1 node-snippets|chr|1.3.2 npm-intellisense|chr|1.4.0 path-intellisense|chr|2.4.0 js-codeformer|cms|1.26.0 jsrefactor|cms|3.0.1 gitignore|cod|0.7.0 bracket-pair-colorizer-2|Coe|0.2.1 contentful-modelscreator-csharp|Con|1.1.0 supersharp|cra|0.1.4 vscode-office|cwe|2.4.1 vscode-typora|cwe|2.2.0 csharp-grammar-extended|dan|1.1.1 vscode-markdownlint|Dav|0.44.1 vscode-eslint|dba|2.1.25 vscode-quick-select|dba|0.2.9 vscode-dotnet-auto-attach|Den|1.1.1 vscode-npm-source|dku|1.0.0 netcore-editorconfiggenerator|dog|0.1.1 netcore-extension-pack|dog|1.5.2 netcore-snippets|dog|3.15.2 typescript-notebook|don|2.0.3 xml|Dot|2.5.1 csharpsnippets|duf|4.0.0 gitlens|eam|11.6.0 vscode-html-css|ecm|1.10.2 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.22 vscode-nupkg|eri|1.0.1 prettier-vscode|esb|9.0.0 vs-sharper|ese|0.2.0 extbundles-csharp|Fel|2.0.1 vscode-firefox-debug|fir|2.9.4 auto-close-tag|for|0.5.12 auto-rename-tag|for|0.1.8 code-runner|for|0.11.5 dotnet|for|0.0.4 dotnet-test-explorer|for|0.7.7 vscode-mysql|for|0.4.1 auto-using|Fud|0.7.15 vscode-pull-request-github|Git|0.30.0 vscode-import-formatter|hen|0.1.8 beautify|Hoo|1.5.0 discord-vscode|icr|5.7.0 ilspy-vscode|ics|0.11.2 powershellprotools|iro|5.28.1 nuget-reverse-package-search|jes|0.1.68 dotnet-core-essentials|Jil|1.0.0 vscode-nuget-package-manager|jmr|1.1.6 csharpsortusings|jon|0.0.3 vscode-csharp-snippets|jor|1.1.0 roslynator|jos|3.2.2 vscodeilviewer|jos|0.0.1 vscode-random|jre|1.10.0 theme-by-language|jsa|1.2.0 docomment|k--|0.1.20 unity-code-snippets|kle|1.3.0 csharpextensions|kre|1.4.3 csharp-colors|log|0.1.8 vscode-JS-CSS-HTML-formatter|lon|0.2.3 easy-timer|Lor|1.0.0 vscode-lottie|lot|1.0.3 azure-serverless-tools|mar|0.0.1 vscode-pdf|mat|0.0.6 fluent-icons|mig|0.0.12 dotenv|mik|1.0.1 csharp-new-class|mik|0.2.0 vscode-azurefunctions|ms-|1.5.1 vscode-azureresourcegroups|ms-|0.4.0 vscode-azurestorage|ms-|0.12.0 vscode-azureterraform|ms-|0.3.2 vscode-cosmosdb|ms-|0.18.1 csharp|ms-|1.23.15 dotnet-interactive-vscode|ms-|1.0.2462010 vscode-dotnet-runtime|ms-|1.2.0 vscode-kubernetes-tools|ms-|1.3.3 mssql|ms-|1.10.1 jupyter|ms-|2021.8.2041215044 jupyter-keymap|ms-|1.0.0 azure-account|ms-|0.9.8 js-debug-nightly|ms-|2021.9.2017 notepadplusplus-keybindings|ms-|1.0.7 powershell|ms-|2021.9.0 powershell-preview|ms-|2021.9.1 vs-keybindings|ms-|0.2.1 vscode-typescript-next|ms-|4.5.20210921 vscode-typescript-tslint-plugin|ms-|1.3.3 vsliveshare|ms-|1.0.4836 vsliveshare-audio|ms-|0.1.91 vsliveshare-pack|ms-|0.4.0 sqltools|mtx|0.23.0 sqltools-driver-sqlite|mtx|0.2.0 short-js-doc|mya|0.2.0 dotnet-extension-pack|nie|1.2.5 vscode-jest|Ort|4.1.2 vscode-nuget-gallery|pat|0.0.24 vscode-versionlens|pfl|1.0.9 material-product-icons|PKi|1.1.1 vscode-css-peek|pra|4.2.0 code-butler|pro|1.3.0 quicktype|qui|12.0.46 nuget-extensions-vscode|ran|0.1.2 fabric8-analytics|red|0.3.3 vscode-commons|red|0.0.6 vscode-yaml|red|0.22.0 classynaming|ref|1.2.0 c-sharp-utilities|rev|0.3.2 csharp-snippet-productivity|ric|1.2.7 format-html-in-php|rif|1.7.0 LiveServer|rit|5.6.1 csharp-helper|roa|0.0.14 vscode-xml-complete|rog|0.3.0 copy-text|sal|0.4.9 vscode-javascript-booster|sbu|14.0.1 html5-boilerplate|sid|1.1.1 prettier-vscode|Sim|2.0.7 shader|sle|1.1.5 csharp-code-snippets|Som|0.0.1 autoimport|ste|1.5.4 tabnine-vscode|Tab|3.4.27 vs-code-node-require|tgr|1.10.2 html-preview-vscode|tht|0.2.5 msbuild-project-tools|tin|0.3.15 vscode-fontawesome-gallery|tom|0.0.5 unity-debug|Uni|3.0.2 vscodeintellicode|Vis|1.2.14 vscode-icons|vsc|11.6.0 quokka-vscode|Wal|1.0.401 iis-express|war|1.4.0 vscode-todo-highlight|way|1.0.4 vscode-import-cost|wix|2.15.0 JavaScriptSnippets|xab|1.8.0 highlight-trailing-white-spaces|yba|0.0.2 material-theme|zhu|3.11.4 html-css-class-completion|Zig|1.20.0 vscode-proto3|zxh|0.5.4 (7 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 pythonvspyt700cf:30270857 pythonvspyt602:30300191 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vstes516:30244333 pythonvspyt639:30300192 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 pythonvsuse255:30340121 vscod805cf:30301675 pythonvspyt200:30340761 vscextlangct:30333562 binariesv615:30325510 vsccppwt:30364497 pythonvssor306:30344512 bridge0708:30335490 pygetstartedc2:30360494 dockerwalkthrucf:30369616 bridge0723:30353136 pythonrunftest32cf:30365367 pythonf5test824:30361777 javagetstartedc:30364665 pythonvspyt187:30365361 pydsgsc2:30361791 vssid140cf:30363604 vssur157:30367808 ```
alexdima commented 2 years ago

@noahweasley Does this issue reproduce in a simple plain text file?

noahweasley commented 2 years ago

@alexdima It occurs in any kind of file. I tried it on Javascript, C#, HTML and CSS, so am guessing it would still produce the same output

noahweasley commented 2 years ago

I ran Extension Bisect once more. Immediately it disabled 5 extensions only and the problem disappeared, I immediately uninstalled the 5 extensions. I restarted VSCode and it worked fine. But the question now is Why didn't Extension Bisect work the last time?. VSCode reported that the problem might be from VSCode itself. So I was confused.

alexdima commented 2 years ago

Why didn't Extension Bisect work the last time?.

Extension Bisect works every time the same. It picks half the extensions, disables them, then asks you if the problem reproduces or not. If your repro steps are not 100% consistent (i.e. the issue reproduces only 4 out of 5 attempts), then the answers you provide to Extension Bisect are not 100% accurate. Extension Bisect will simply follow your Yes/No answers.