However, you may not always want to have it enabled, because this could potentially hide formatting issues in non-legacy files. The new virtual formatter can help with that, too. So, in the end, we don’t really have an optimal solution. Should we apply code formatting and later revert it? This is surely a common thing to forget. Should we reformat such files to comply with the latest style settings? Most often, developers try to keep changes to a minimum for the sake of a clean VCS history and – more importantly – keep merge conflicts to a minimum.īut not reformatting them would give us bad readability. Many of us have seen these code files that were created 12 years ago, but that still receive some fixes every now and then. In the following paragraphs, we will look into them! Reading Legacy Code Depending on your preferences, Here you can choose from the options never, only when caret is near (before the first non-whitespace character), or always: Problems beyond AccessibilityĮven if accessibility is not an issue for your team or you personally, there are certainly a number of situations, where the “static” code formatting can become an issue and decrease productivity. Try it out and check Enable Virtual Formatter under Environment | Inlay Hints | General:Īfter customizing the (virtual) whitespace settings, a file that previously looked very messy due to mixed tabs and spaces, will then look fully normalized and aligned correctly:įrom the aforementioned options page, you can also decide whether to show real whitespaces on top of virtual ones. Starting with ReSharper 2022.2, you can choose your personal code style, even if the team uses another. Not all tools let you configure the indentation width or even behave a bit differently once you throw tabs at them. So why is that? As Tim Corey points out – and that might be true for a lot of us – it’s about habit and how comfortable we feel. But even though the importance of accessibility is understood almost irrevocably, many developers still prefer spaces over tabs. This is very crucial for visually impaired people who often rely on bigger fonts and wider monitors and thus need to adapt their tab width. When you use tabs, each developer can have their own personal indentation settings. That is for the simple reason that they increase the accessibility of your codebase.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |