您的位置:首页 > 财经 > 金融 > vs code格式化

vs code格式化

2025/4/3 3:52:13 来源:https://blog.csdn.net/jacke121/article/details/140223281  浏览:    关键词:vs code格式化

目录

vs code格式化

函数参数不换行

禁止 pylance 插件自动添加 import


vs code格式化

函数参数不换行

    def generate_canvas_box(self,corners,idxs,thickness=2,data_idx=None,debug = False):

方法四:使用 VS Code 的自定义格式化设置

  1. 打开 VS Code 设置(settings.json)

    • 点击右上角的齿轮图标,然后选择“Settings”。
    • 在右上角点击 {} 图标,打开 settings.json 文件。
  2. 添加自定义格式化设置: 在 settings.json 中添加以下内容,以控制自动格式化行为:

{"python.formatting.provider": "black","python.formatting.blackArgs": ["--line-length", "120"],"editor.formatOnSave": false
}

打开settings.json

  • 找到 VS Code 的用户设置文件夹

    • Windows: 通常在 C:\Users\<Your_Username>\AppData\Roaming\Code\User\settings.json
    • macOS: 通常在 ~/Library/Application Support/Code/User/settings.json
    • Linux: 通常在 ~/.config/Code/User/settings.json

VS code打开命令面板(快捷键ctrl shift P)搜settings.json

每一行后面都要有逗号

{"files.autoSave": "onFocusChange","python.defaultInterpreterPath": "B:\\ProgramData\\Miniconda3\\python.exe","explorer.confirmDelete": false,"git.openRepositoryInParentFolders": "never","remote.SSH.remotePlatform": {"120.220.95.170": "linux"},"editor.minimap.enabled": false,"python.formatting.provider": "black","editor.wordWrapColumn": 200,"python.formatting.blackArgs": ["--line-length", "120"],"editor.formatOnSave": false
}

禁止 pylance 插件自动添加 import

打开设置,搜索 autoImportCompletions

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com