From: "k0kubun (Takashi Kokubun)" Date: 2022-07-21T16:41:03+00:00 Subject: [ruby-core:109290] [Ruby master Misc#18891] Expand tabs in C code Issue #18891 has been updated by k0kubun (Takashi Kokubun). > Unfortunately you can't set it at the global level because git blame fails if the file does not exist, and that would cause issues when working on other repos Right, I noticed that behavior after writing the comment but forgot to update the comment about it. I corrected the comment to not use `--global`, which would write `.git/config`. Given that you could always use `~/.gitconfig` or `.git/config` for your original git configuration, I guess it's fair to just commit `.gitconfig` to the repository. I'll add that once I merge it. > I would also recommend setting these two configs which can help in case the ignored revisions end up hiding the origin of a line: blame.markUnblamableLines and blame.markIgnoredLines. Good to know. I guess the change of this time doesn't introduce new lines, but I'll consider adding that when I see something weird that can be solved by that. ---------------------------------------- Misc #18891: Expand tabs in C code https://bugs.ruby-lang.org/issues/18891#change-98426 * Author: k0kubun (Takashi Kokubun) * Status: Assigned * Priority: Normal ---------------------------------------- # Problem There's no way to handle tab/space-mixed indentation of CRuby's C code properly in VSCode. It impacts the productivity of the VSCode users a lot, including myself. # Suggested solutions I implemented option 2 out of the following options at https://github.com/ruby/ruby/pull/6094. 1. You tell me how to do that in VSCode. * In VSCode, there seems to be no native feature to show tabs as 8 spaces while still indenting with 4 spaces. At least https://github.com/microsoft/vscode/issues/42740 is still open. * @alanwu built https://github.com/XrXr/vscode-tabs-are-two-indents exactly for this purpose, but even with the extension, it still seems to wrongly detect an indentation level on new lines. 2. **Expand all tabs in most of the C code at once and add the commit to `.git-blame-ignore-revs`** * pros: GitHub and `git blame --ignore-revs-file` support it. Unlike option 3, commit logs and `.git-blame-ignore-revs` can be short. * cons: It might be a bit difficult to find out which C files shouldn't be a target. Bare `git blame` could be inconvenient. 3. Allow expanding all tabs in each C file as we want and manage the list of such commits in `.git-blame-ignore-revs` * pros: GitHub and `git blame --ignore-revs-file` support it. You don't introduce unnecessary changes to files you don't care about. * cons: We might see too many commits for this in the commit history. Bare `git blame` could be inconvenient for such files. 4. Discourage contributions to CRuby from VSCode users. (proposed by @graywolf) # Drawbacks The expected drawbacks of doing option 2 are: * Existing patches on hard-tab lines may conflict. * Backporting patches on hard-tab lines made after this commit to revisions before this commit may conflict. I assume that resolving such conflicts wouldn't be too difficult and this problem will not last forever. # Out of scope I'm not interested in discussing the adoption of clang-format. It would change a lot of things that are not related to the problem. # Past discussion https://bugs.ruby-lang.org/issues/16112 touched this topic before, but we haven't discussed `--ignore-revs-file` so much. I also didn't know VSCode still can't deal with it in 2022 (as I've been using Vim). -- https://bugs.ruby-lang.org/ Unsubscribe: