V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
chenqh
V2EX  ›  Python

有人知道怎么设置 vscode Python 的 enterRules 吗?

  •  
  •   chenqh · 2019-03-19 12:58:56 +08:00 · 835 次点击
    这是一个创建于 1859 天前的主题,其中的信息可能已经有所发展或是发生改变。

    看了下 vscode python 的

     languages.setLanguageConfiguration(PYTHON_LANGUAGE, {
            onEnterRules: [
                {
                    beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async)\b.*:\s*/,
                    action: { indentAction: IndentAction.Indent }
                },
                {
                    beforeText: /^(?!\s+\\)[^#\n]+\\\s*/,
                    action: { indentAction: IndentAction.Indent }
                },
                {
                    beforeText: /^\s*#.*/,
                    afterText: /.+$/,
                    action: { indentAction: IndentAction.None, appendText: '# ' }
                },
                {
                    beforeText: /^\s+(continue|break|return)\b.*/,
                    afterText: /\s+$/,
                    action: { indentAction: IndentAction.Outdent }
                }
            ]
        });
    

    感觉有点问题呀, 比如def __init__(self, name=None, 按 enter 之后没有缩进?没有办法直接缩进到(这里吗?
    而且他这个东西怎么处理多行 def 呢

    def __init__(self, method=None,
                       uri=None,
                       version=None,
                       headers=None):
    
                         
    

    这个样子缩进有问题呀

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2776 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 09:47 · PVG 17:47 · LAX 02:47 · JFK 05:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.