小编j6t*_*j6t的帖子

如何重命名 git 工作树

鉴于我已经跑了

$ git worktree add ~/worktrees/a
$ cd ~/worktrees/a
$ git status
On branch a
Run Code Online (Sandbox Code Playgroud)

我想将工作树和分支的名称从 更改ab

git git-worktree

12
推荐指数
1
解决办法
5216
查看次数

VS Code 缩进宽度为 4,但制表符宽度仍然为 8,怎么办?

我有一个旧的代码库,它使用奇怪的缩进样式。它使用制表符宽度 8,但缩进 4 个槽口,尽可能用制表符替换 8 个空格。

代码应如下所示:

____if (foo) {
TAB---->if (bar) {
TAB---->____something();
TAB---->}
____}
Run Code Online (Sandbox Code Playgroud)

我已经安装了EditorConfig for Visual Studio Code扩展,并且我的.editorconfig有:

root = true

[*]
insert_final_newline = true
indent_size = 4
tab_width = 8
Run Code Online (Sandbox Code Playgroud)

但现有的代码如下所示:

____if (foo) {
TAB>if (bar) {
TAB>____something();
TAB>}
____}
Run Code Online (Sandbox Code Playgroud)

当我添加 时indent_style = tab,现有代码看起来再次正确,但是当我键入新代码时,我得到以下结果:

____if (foo) {   // after hitting Enter on this line the next line is indented too far:
TAB---->____something
____}
Run Code Online (Sandbox Code Playgroud)

如何实现所需的显示和缩进行为?

visual-studio-code editorconfig

5
推荐指数
1
解决办法
1272
查看次数

关键字 'for' 后带有省略号的 for 语句有什么作用?

我见过这个代码

template <class... TYPES>
constexpr void tuple<TYPES...>::swap(tuple& other)
    noexcept((is_nothrow_swappable_v<TYPES> and ...))
{
    for...(constexpr size_t N : view::iota(size_t(0), sizeof...(TYPES))) {
        swap(get<N>(*this), get<N>(other));
    }
}
Run Code Online (Sandbox Code Playgroud)

构造体有for...什么作用?

c++ for-loop

4
推荐指数
1
解决办法
166
查看次数