【发布时间】:2019-07-17 14:41:15
【问题描述】:
我正在尝试将 Atom https://atom.io/packages/language-sas 的 SAS 语言扩展移植到 VScode。除自动缩进外,一切正常(语法等)。
我使用yo code 为我的 SAS 语言扩展创建模板。我尝试使用在 Atom 中使用的相同正则表达式,但它们似乎不起作用。我还尝试了一些非常简单的设置,例如"increaseIndentPattern": "^\s*(data|proc)\s*;$,但它们似乎也不起作用。
我目前安装了以下扩展:Python、Remote-SSH、TSLint、Visual Studio Intellicode、Tomorrow 颜色主题。
这是我的package.json 和language-configuration.json:
{
"name": "sas-language",
"displayName": "SAS",
"description": "SAS language support for Visual Studio Code",
"version": "0.0.1",
"engines": {
"vscode": "^1.36.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "sas",
"aliases": [
"SAS",
"sas"
],
"extensions": [
".sas"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "sas",
"scopeName": "source.sas",
"path": "./syntaxes/language-sas.json"
}
],
"snippets": [
{
"language": "sas",
"path": "./snippets/language-sas.json"
}
]
}
}
{
"comments": {
"lineComment": "*",
"blockComment": ["/*", "*/"]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{"open": "{", "close": "}"},
{"open": "[", "close": "]"},
{"open": "(", "close": ")"},
{"open": "\"", "close": "\"", "notIn": ["string", "comment"]},
{"open": "'", "close": "'", "notIn": ["string", "comment"]}
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"indentationRules": {
"increaseIndentPattern": "(?i:(\\bdo\\b(.(?!end;))*$|\\bbegingraph\\b(.(?!endgraph;))*$|^\\s*(proc|data|%macro)\\s+.*;\\s*$))",
"decreaseIndentPattern": "(?i:(^\\s*(%?end|endgraph|endsas|run|quit|%mend)\\s*;))"
}
}
【问题讨论】:
-
不是重复的。这是一个关于如何使用可用机制实现自动缩进的问题。另一个是关于实现比直接提供的更复杂的。
标签: visual-studio-code sas indentation vscode-extensions