在 Visual Studio Code 中禁用自动换行长行 [英] Disable auto wrap long line in Visual Studio Code

查看:106
本文介绍了在 Visual Studio Code 中禁用自动换行长行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Visual Studio Code 和 Pylint 编写 Python 代码.

I use Visual Studio Code to write Python code with Pylint.

当我按下 Ctrl + S(保存)时,编辑器将一个长行包装成多个短行.如何禁用该操作或将换行列数配置为 120(默认为 80)?

When I press Ctrl + S (save), the editor wraps a long line into multiple short lines. How do I disable the action or configure wrap column count to 120 (default is 80)?

我已经尝试过 "python.linting.pylintArgs": ["--max-line-length=120"]"editor.wordWrapColumn": 120,但它没有用.

I have tried "python.linting.pylintArgs": ["--max-line-length=120"] and "editor.wordWrapColumn": 120, but it didn't work.

推荐答案

检查您的 Python 格式提供程序.

Check your Python formatting provider.

"python.formatting.provider": "autopep8"

我猜在你的情况下,不是 Pylint 一直在包裹长行,而是 autopep8.尝试为 autopep8 设置 --max-line-length.

I guess in your case it is not Pylint which keeps wrapping the long lines, but autopep8. Try setting --max-line-length for autopep8 instead.

"python.formatting.autopep8Args": [
    "--max-line-length=200"
]

这篇关于在 Visual Studio Code 中禁用自动换行长行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆