New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce automated language setting of untitled file on paste #90492
Comments
(Experimental duplicate detection) |
@akbyrd I'm not clear why you need to set language mode explicitly to plain text right after opening a new file. Perhaps you have set But assuming that step is necessary, can you simply defer doing it until after pasting? I'm not disagreeing with your request for this new behaviour to be switchable. Just trying to understand if you can work around it without having an extra step to do. |
I don't have to set the language to plain text right after opening. I'm using that step to demonstrate that the new feature will alter something I explicitly set, which it should never do. My untitled files already default to plain text because Perhaps this alternate repro will demonstrate the problem more clearly:
|
The current heuristic in insiders (changed slightly from stable) is as follows:
I think the only solution here is to provide a setting because I find it rather weird that configuring the language mode to "plain text" if it is already "plain text" should have any impact? Curious if insiders improves this situation for you given the change we did. You can give our preview releases a try from: https://code.visualstudio.com/insiders/ |
Oh sorry, I just found a bug in insiders (fixed via 7e0133d). To see the behaviour I describe in action you need to paste into anywhere that is not line 1 and not column 1. The change I pushed makes this easier to not apply the mode unless you truly paste into line 1 and column 1. |
How does this work when I select all and paste? This is something I frequently do and I assume that counts as pasting into 1:1. The heuristic fails here.
I don't follow what you mean here. In my second repro above I only demonstrate setting to plain text from some other language that was automatically set when pasting. At no point do I set it to plain text while it is already plain text. I think this issue should be separate from the other that you closed. This issue is a bug. You can't just run around changing the settings I want. A heuristic simply isn't enough. There's a difference between "the editor tried to automatically infer what I want" and "I explicitly set this thing". It's fine to override the former, but not the latter. You need to track "did the user explicitly set a language?" and disable the heuristic. You can introduce an option to disable it entirely (and in my case that happens to be good enough) but that's a workaround for UX that absolutely should not exist. |
I pushed a change that will disable this feature of setting the mode automatically upon paste in more cases. Verification:
|
The new feature that automatically sets the language of an untitled editor is blowing up my language setting even after I set it explicitly.
Repro
Open a new file
Explicitly set it to plain text
Paste text from another editor
Notice it changes the language mode
I use plain text editors constantly and this is frustrating.
The text was updated successfully, but these errors were encountered: