How to implement complicated auto-indentation in VScode

后端 未结 2 1375
星月不相逢
星月不相逢 2021-01-19 15:59

I am working on a language extension for SAS for VScode. I previously worked on the SAS language extension for Atom (https://github.com/akanosora/language-sas) as well as Vi

2条回答
  •  逝去的感伤
    2021-01-19 16:26

    You can add the data and proc keywords themselves to the "decreaseIndentPattern" rule. This way, these keywords will serve for both un-indenting the current line, and starting a new indentation block on the next line.

    Consider this, for example:

    "indentationRules": {
        "increaseIndentPattern": "^\\s*(proc|data)\\s+.*;\\s*$",
        "decreaseIndentPattern": "^\\s*(run|((proc|data)\\s+.*))\\s*;"
    }
    

提交回复
热议问题