gpt4 book ai didi

visual-studio-code - 排序和删除 C# 代码中未使用的使用

转载 作者:行者123 更新时间:2023-12-04 01:46:22 25 4
gpt4 key购买 nike

有没有办法排序 删除未使用的 usings在 C# 中就像在 Visual Studio 2015 和 2017 中一样?

如果不是,这会是对 future Visual Studio Code 版本的补充吗?

最佳答案

vscode 内置了一个命令来帮助删除未使用的用法。

默认键绑定(bind)定义为:

{ "key": "ctrl+.", "command": "editor.action.quickFix",
"when": "editorHasCodeActionsProvider &&
editorTextFocus &&
!editorReadonly" },

至于对 using 进行排序:我没有找到为 using 语句明确构建的任何内容,但是有一个命令可以对行进行排序。将类似于以下内容添加到您的键绑定(bind)文件中:
{ "key": "ctrl+q", "command": "editor.action.sortLinesAscending",
"when": "editorFocus && !editorReadonly" },

然后,选择 using 语句并按 ctrl+q 对其进行排序。

关于visual-studio-code - 排序和删除 C# 代码中未使用的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43072546/

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