[Vscode] Adds #region functionality to Python and LUA __python

Source: Internet
Author: User
Tags lua

First navigate to D:\Program Files\Microsoft VS Code\resources\app\extensions, change the path to its own, open the Python and LUA directories, and modify the Language-configurat Ion.json files. python

Python defaults have been matched, but not well matched, only support #region, if there is a space between # and region (# Region) is not, the folding changed to the following is good:

    "Folding": {
        "Offside": true,
        "markers": {
            "start": "^\\s*#\\s*region\\b",
            "End": "^\\s*#\\s* endregion\\b "
        }
    }
Lua

Lua is not matched by default, and the last paragraph in the configuration file adds

    "Folding": {
        "Offside": true,
        "markers": {
            "start": "^\\s*--\\s*region\\b",
            "End": "^\\s*--\\s* endregion\\b "
        }
    }

After the change, remember to restart the Vscode will not take effect. PostScript tried to add multiple marker, but failed to see the other language configuration seems to be used to separate, but did not succeed, estimated with the delimiter I used, I used the {{&}}, these two have special purpose in JSON, plus the escape character \ \ Still does not take effect, give up. Also tried to support this in sublime, but did not find the place to match, in this respect sublime is too far, and N not update once, more and more can't keep up with the trend. Using #region in Python is a convention, and Python's most popular IDE Pycharm is inherently supportive of region, although this is not part of the Python syntax (indeterminate, sublime does not support region inference). Lua does not--region/endregion this syntax, there is no IDE or editor support, and this feature is only to facilitate the contraction of the code, so you can not region, such as I wanted to use {{...}}, but did not succeed, you have what you want to use can play their own , I will not toss, use region bar, at least many languages use this.

Reference Document: HTTPS://GITHUB.COM/MICROSOFT/VSCODE-PYTHON/ISSUES/33

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.