由于某些原因,我需要处理一些无法更改的相当长的类名,并且我还需要处理严格的最大行长度 100 个字符。到目前为止,一切都还不错,但现在我遇到了 VS Code 不想分割方法签名的问题:
public class Clients {
public SoapJmsRequestReply<GetBusinessPartnerDataRequestType, GetBusinessPartnerDataResponseType> getBusinessPartnerDataClient() {
/* blabla */
}
}
>
已达到 100 的限制,因此我无法缩短方法名称以获得可接受的行长度。我们的 linter 接受的是:
public class Clients {
public SoapJmsRequestReply<GetBusinessPartnerDataRequestType, GetBusinessPartnerDataResponseType>
getBusinessPartnerDataClient() {
/* blabla */
}
}
但是 VS Code 的格式化程序不想保持这种状态,并将其格式化回第一个示例。样式表 xml 中是否有配置可以实现此换行?
最佳答案
尝试将 editor.wordWrap
和 editor.wordWrapColumn
设置为您的 settings.json
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 100
关于Java 方法签名未按配置的行长度分割,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59468058/