gpt4 book ai didi

Why does c-electric-semi&comma indent incorrectly when using eglot?(为什么在使用eglot时c-Electric-Semi&逗号缩进不正确?)

转载 作者:bug小助手 更新时间:2023-10-24 21:20:38 28 4
gpt4 key购买 nike



I'm switching to eglot from lsp-mode, and I'm getting an unexpected indentation in C# code. I have a minimal editorconfig file that just sets indent_size to 2. Things seem fine until I hit a semicolon, at which point the current line and the next line both get indented further than they should. Here's a before:

我正在从lsp模式切换到eglot,并且在C#代码中得到了意外的缩进。我有一个最小的编辑配置文件,只需将INTENT_SIZE设置为2。在我遇到分号之前,一切似乎都很好,在分号处,当前行和下一行的缩进都超出了应有的范围。这是之前的一段话:


public static class Stuff
{
public static T DoAThing<T>(T obj)
{
Console.WriteLine(obj)
}
}

And here's what happens when I hit ;:

以下是当我点击时会发生的事情:


public static class Stuff
{
public static T DoAThing<T>(T obj)
{
Console.WriteLine(obj);
}
}

Looking at the help for ;, I see that it's bound to c-electric-semi&comma, but it seems like setting c-syntactic-indentation to nil doesn't actually prevent the indentation, which is counter to what the documentation says.

看一下;的帮助,我发现它绑定到c-Electric-Semi和逗号,但似乎将c-语法-缩进设置为nil实际上并没有阻止缩进,这与文档所说的相反。


更多回答
优秀答案推荐

For anyone who has this problem in the future, c-electric-semi&comma was a red herring. The problem was that omnisharp-roslyn wasn't configured to respect editorconfig settings. The way to do that is to go to ~/.omnisharp/omnisharp.json and make sure that you've got this enabled:

对于任何将来有这个问题的人来说,c-Electric-Semi&Comma是一个转移视线的问题。问题是,omnisharp-Roslyn没有配置为尊重编辑配置设置。方法是转到~/.omnisharp/omnisharp.json,并确保您已启用此功能:


{
"FormattingOptions": {
"enableEditorConfigSupport": true
}
}

更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com