-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
snippet pasting does not honor the indenting mode #4284
Comments
Is this different from VS2013's handling? Can you let us know what options you have set to non-default values, and what your expected behavior is? |
Thanks. We'll take a look, but as far as we know, you're the only C# developer in the world who uses Indent Style = none 😄. |
Hi Pilchie, no, in fact I don't use Indent Style = none :) My "real" problem is issue #4351 , VS2015 RTM has made the current smart indenting totally unusable for me. I'm considering moving to style=block , but with style=block I found this issue. I just put this issue with style=none instead of style=block because it was more obvious. (the problem is present in both modes) |
Another customer scenario to verify is that “trivia” (whitespace/comments/preprocessor directives) is not formatted as well. Expected
Actual:
|
Hi, any news on this issue? This has not been fixed in update 1. Additionally there's another problem that not only macros expanded have the incorrect indentation, but also reformat the following lines. Using my snippet for comments: Press tab to expand the snippet Everything messed up. Proven that autoformatting is broken unless you adhere to VS2015 forced formatting standards, wouldn't be wise to add an option to totally disable autoformatting? I end up using more time reformatting code in VS2015 than actually typing it, to the point that I'm editing code in VS2012 and switching to VS2015 to compile for windows UWP. |
I came across this today and appears indentation is still not working with Visual Studio 2019. |
we would likely take a contribution here. But it's unlikely that we would invest in this ourselves in the near future. |
This issue is potentially related to #37292. Basically what I think is happening is when the IDE generates some code into the buffer, like during snippet application or pressing enter inside { } (I forgot which feature is responsible for this), but we don't respect the line endings and indentation set in the TextView. For example if you have a file that uses LF as line endings and you apply a snippet there you will get CRLF where the IDE inserted a line break: |
Ah, I see, it just hardcodes Environment.NewLine instead of getting the line break character from the Editor settings: |
No, it's not that easy, it does call formatting after that, so needs further investigation on why the formatting doesn't use the right line break and indentation. |
The interesting stack here is:
|
This line returns crlf: |
I come across this issue all the time, would appreciate it if it was fixed. So much time wasted fixing formatting. |
Is this the same issue that causes in a LF/Tabs-set file, the following to create a mixed/mixed file?
Edit: note that this doesn't happen if an .editorconfig file specifies LF/Tabs, so with the editorconfig I'm fine. Seems a little curious that VS detects one but inserts the other, but not a big problem if so easily overridden by the config file. |
closing out as we are not investing in legacy snippets. |
Hi,
when pasting a snippet when using VS2015 RTM, the snippet is formatted as if indenting mode would be set smart no matter what indenting mode is selected. (not happenning with snippets which starts with '#', but I suppose it's because of my current configuration)
To reproduce, use block indenting and type this code
using System;
namespace ns
{
$
}
put cursor at (and delete) $, then type any snippet (i.e. wde )
p.s. sorry if this does not belong to this project, I'm quite lost with visual studio
The text was updated successfully, but these errors were encountered: