live-share icon indicating copy to clipboard operation
live-share copied to clipboard

Indentation is removed for guests when they try to type if auto-save and trim trailing whitespace are enabled

Open MaddyGuthridge opened this issue 2 years ago • 1 comments

Describe what happened: I (the host) have the settings "files.autoSave": "afterDelay" and "files.trimTrailingWhitespace": true enabled.

Whenever a guest tries to type, any indentation on the line they are typing is removed as soon as they begin typing, meaning they need to manually fix indentation for every line of code that they type.

What was your system configuration? Product and Version [VS/VSCode]: 1.77.3 OS Version[macOS/Windows]: Fedora 37 Live Share Extension Version: v1.0.5864 Target Platform or Language [e.g. Node.js]: C

Steps to Reproduce / Scenario:

  1. Have host enable "files.autoSave": "afterDelay" and "files.trimTrailingWhitespace": true in their settings
  2. Have a guest attempt to type a line that is indented
  3. Observe that their indentation is lost as soon as they begin typing

This seems like a rehashing of #1186, but I am creating a new issue due to the age of the old one (close to 5 years). I am unwilling to disable auto-save, since that is a workflow-breaker for me, and it seems like a workaround rather than a solution.

MaddyGuthridge avatar May 07 '23 12:05 MaddyGuthridge

I had the same experience. My colleague and I both had autosave enabled. The host has autosave set to "after-delay", I (gust) had autosave "onFocusChange".

If I type a space, then pause (eg to think, or let copilot generate code), the host's machine autosaves, removing the space(s), and resetting my cursor to a different position.

This causes lots of errors depending on when it happens and what I'm doing, but some examples:

  • accidentally type two words without a space (syntax error)
  • moves my cursor to the start of a line (have to reindent - but then it does it again)
  • copilot stops inferring
  • pops me out of Vim mode's insert mode

It makes VSCode basically unusable.

It would seem that VSCode should only autosave for the author of an edit perhaps?

pbiggar avatar Aug 11 '23 21:08 pbiggar