Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

VS replaces tabs by spaces 09 Jul 2020 17:23 #15153

  • ic2


  • Posts: 1075
  • I often see that my tabs in VS like in front of comments change into spaces, e.g.

    IF x==1 <tab><tab><tab><tab> // Here my comment
    (All <tab> become groups of 4 spaces)

    I switched
    Text Editor > Advanced and "Use adaptive formatting off
    and have Keep tabs, smart Indent set everywhere.

    Reproducible: It (at least) ALWAYS happens when I copy a line (also in C#).

    Is there any way to prevent this "space replacement"?

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 17:25 #15154

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Dick,

    Is that on a regular prg file, or in a file associated with a form? I just now received a similar report for form related prg files, which I confirmed.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 17:36 #15156

    • ic2


  • Posts: 1075
  • Hi Chris,

    I always see it on regular code, like .prg or .cs files.

    I've seen it mentioned in the Microsoft sites as well (also with "when will this ever be solved") but not so much lately. And as Robert didn't directly recognize it I thought I was maybe missing some setting (or at least: that's what I hope :)

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 17:47 #15157

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Dick,

    That's strange, have never seen something like that. Can you please post a link to such a report about c#? Not seeing it myself in neither X# or c#, but this might give a hint on how to reproduce it.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 18:05 #15158

    • ic2


  • Posts: 1075
  • Hello Chris,

    developercommunity.visualstudio.com/cont...ced-with-spaces.html

    Here it is posted with the Adaptive formatting (what where they thinking when they programmed this...) as solution, but that doesn't help.

    developercommunity.visualstudio.com/cont...-instead-of-tab.html

    Do you actually retain tabs when you copy and then paste a line ? For me all tabs are directly replaced with spaces in the pasted line.

    Here's the search URL (5 pages with this problem)

    developercommunity.visualstudio.com/sear...rted+instead+of+tabs

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 19:01 #15160

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Dick,

    Yeah, it works fine for me...maybe VS is trying to be nice to me to make me start using it :) :) :)

    Seriously, I have never seen that... Does anybody else see this behavior guys? Any hint in order to reproduce it would be very much appreciated...
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 19:13 #15161

    • FFF


  • Posts: 1177
  • ic2 wrote: Do you actually retain tabs when you copy and then paste a line ? For me all tabs are directly replaced with spaces in the pasted line.

    Hi Dick,
    for you i started VS17, no customization at all, and tried on a simple winforms app. First, i have no clue, how to make whitespace visible, but i think one sees here, that my two starting tabs are retained.


    (OT: This "ScreenToGif" is a cool thing!)
    Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)
    Attachments:

    Please Log in or Create an account to join the conversation.

    Last edit: by FFF.

    VS replaces tabs by spaces 09 Jul 2020 19:36 #15162

    • ic2


  • Posts: 1075
  • Hello Karl, Chris,

    That seems to work fine for you indeed Karl.But I've no idea what setting I have different.

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 19:48 #15163

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • FFF wrote: (OT: This "ScreenToGif" is a cool thing!)


    Very cool indeed! Which app did you use?
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 09 Jul 2020 20:45 #15164

    • FFF


  • Posts: 1177
  • Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 10 Jul 2020 10:53 #15169

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Thanks Karl!!!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 14 Jul 2020 17:19 #15213

    • ic2


  • Posts: 1075
  • I've also posted this using VS Help/Send Feedback, Report a problem. It can then be seen in:

    developercommunity.visualstudio.com/cont...abs-with-spaces.html

    The general way Visual Studio staff handles these issues is that hardly ever an issue is solved; in the best case the issue is closed to be a duplicate of an issue which is not solved either as they did here. They refer to github.com/dotnet/roslyn/issues/24031 where it is posted for the VS 2017 version and still not solved in 2019.

    However, Karl showed it works for him and it also works for Kees with whom I checked all my settings. I still have no idea what causes the difference.

    If they had capable people working at Microsoft (like the X# team works) there should be someone who could tell: we checked in the code what
    could cause tabs to be replaced with spaces, if you change this and this it should be solved.

    Unfortunately they don't have capable people working at Microsoft. So I keep using VS with a problem which could probably be solved but it is unknown how. As if working with Visual Studio isn't already punishment enough without the tabs->spaces replacement :evil:

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 24 Aug 2021 14:24 #19426

    • KeesIC2
    • KeesIC2's Avatar


  • Posts: 20
  • Hi all,

    I have found that the Visual Studio (2019 with all updates installed) designer changes tabs to spaces. Each tab is replaced by one space. If I open for example a Winforms application "test" by double clicking on "test.prg" the designer is opened. Then I choose View->Code and verify that there are tabs. Then I choose View->Designer, I change something (just moving a button to a new position is enough) and save. When I go back to View->Code all the tabs have been replaced by spaces. Selecting everything and choosing Edit->Advanced->Tabify Selected Lines corrects it but only at the start of the lines. Tabs elsewhere in the line are not corrected. This is not the only way the designer can screw up your code. I have had code completely disappear, or code duplicate just by going to the designer and back. It is a complete mystery to me how such a giant company like Microsoft with practically unlimited financial resources cannot even get these simple things right.

    Kees.

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 24 Aug 2021 15:54 #19429

    • robert
    • robert's Avatar


  • Posts: 2308
  • Kees,
    How much I would like to blame Microsoft for this, I must admit that the code generation here is not done by Microsoft but but an X# component.
    I will see why this component does not use the correct settings for the code generation and fix this.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 24 Aug 2021 18:36 #19433

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Kees and Dick, just to let you know, I remember you reported some time ago this problem with the editor changing tabs to spaces, but we could not reproduce it. Looks like what was missing when trying to reproduce it, was that info that this change happens in a file that represents a form, after making a change in the designer.

    Now the problem is easily reproducable and actually it looks like exactly like an issue I had also reported myself last month ( github.com/X-Sharp/XSharpPublic/issues/438 ), which I had thought only had to do with indentation. But apparently it's a general tabs/spaces problem where the form designer is involved. So thanks for the new info on this which was really helpful!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 25 Aug 2021 11:41 #19435

    • ic2


  • Posts: 1075
  • Hello Chris,

    My "spaces replacement" problem is actually different than that of Kees. It also happens in C#. I've made a bit of progress. If I copy a method containing tabs (for the comments) and paste it, all the tabs are replaced with spaces. This also happens when VS reformats, e.g. when I add a closing } to a C# block.

    But, what I found out recently, if I directly press Ctrl Z once, the tabs are back, without losing my pasted code or closing }.

    It seems there's an unwanted step in VS doing that, but not for everyone and I have no idea why. I've reported that in the discussion on developercommunity.visualstudio.com/t/vi...nstead-of-tab/847853 (expand Show 15 comments at the bottom). There's actually a product manager at Microsoft in charge of the Adaptive White Space feature in Visual Studio, Dante Gagne, and as this feature is so totally not working one wonders how any improvements can ever take place when this manager himself writes about this crippled functionality the reply below. Not sure if this has anything to do with what you describe or I see happening, however. It does show once more that I am certainly not the only one complaining about VS ("tons of feedback")

    Dick

    Hey Folks. I’m the PM here at Microsoft in charge of the Adaptive White Space feature in Visual Studio. Basically, we’ve gotten tons of feedback from folks who copy/paste code into a variety of codebases and get into trouble when their settings conflict with the standards of the document. I can’t begin to count how many people have said “Come on, the document uses nothing but tabs, why can’t Visual Studio figure that out and use tabs?”

    Here are a few comments:

    First, PLEASE feel free to continue to send more feedback. We don’t currently have an option to disable adaptive white space, but if folks feel that’s important, we can add it.
    Second, if you look at the bottom right of the editor window, you’ll see that we’ve brought Line, Character, Whitespace and Line Endings closer to the document. These will tell you if Visual Studio thinks the document is a document with spaces or tabs and that’s what it will use for that document. You can also click that indicator and tell it which one you want to use. It will update all of the whitespace in the document to whichever you prefer and use that as a standard from then on.
    Third, if you use .editorconfig in your code repo, we will ALWAYS honor those settings. It’s not a requirement to use .editorconfig, but anyone who is particular interested in maintaining a coding style should know that our of the VS guiding principles is to never believe we’re “smart enough” to override .editorconfig.

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 25 Aug 2021 16:53 #19439

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Wow, I think I'd better not comment on that...
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 07 Sep 2021 23:05 #19528

    • ic2


  • Posts: 1075
  • I have one more comment. The "Microsoft manager Adaptive white spaces" Dante Gagne didnt' react anymore (too busy with white spaces I am afraid while my problem is tab related, I definitely have to find Microsofts "Senior Manager Visual Studio Unwanted Spaces" somewhere I think).

    So I posted a new issue on the forum, more precisely the Mac forum because my Report Issues option is missing and even when I manually edit the menu to put it back somewhere, it shows but greyed out, and yes, I am logged in. Even after a full menu & settings reset to default. One of the many great surprises of VS. Here it is:

    developercommunity2.visualstudio.com/t/O...tting-Visual/1518561

    To my surprise a MSFT, Andew Hall, reacted by describing + adding a screenshot of just what goes wrong.

    That sounds like progress, although he didn't write how to prevent it and he hasn't reacted since this weekend.

    Andrew is Senior Program Manager on the Visual Studio Debugger team. He probably isn't even acquainted with the Microsoft Senior or Junior Manager Unwanted Spaces, or it still looking for that manager to ask why on earth this happens on, apparently, his system as well.

    Dick

    Please Log in or Create an account to join the conversation.

    Last edit: by ic2.

    VS replaces tabs by spaces 08 Sep 2021 01:02 #19529

    • Chris
    • Chris's Avatar


  • Posts: 2667
  • Hi Dick,

    Maybe right now the problem is already fixed by the Senior Developer of the Adaptive White Space feature in Visual Studio, but the Project Manager of the Adaptive White Space feature in Visual Studio has assigned it to the Senior and Junior members of the Principal Testing team for the Adaptive White Space feature in Visual Studio who haven't confirmed the fix yet, or maybe are still waiting for the Project Manager of the Help file contents of the Adaptive White Space feature in Visual Studio to assign it to one of the members of the team so that it is probably documented how this feature works.

    Sorry, I know I said I shouldn't comment, but I could not resist anymore :)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 08 Sep 2021 10:25 #19532

    • ic2


  • Posts: 1075
  • Hello Chris,

    This is very funny to read. But I am afraid that's how it works at Microsoft (or other large software companies in the world).

    Dick

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1
    • 2