我正在尝试通过添加区域来扩展 Microsoft 的 AL 语言。我可以通过转到 vscode 扩展文件夹 .vscode\extensions\Microsoft.al-0.14.17461 并更改文件 al.configuration.json 和 alsyntax.tmlanguage 来手动执行此操作。
但我想通过创建自己的 VSCode 扩展来做到这一点。所以我创建了自己的扩展并将那些特定的文件复制到它+添加我的特定代码。幸运的是它奏效了!
但是,它仅在我使用整个语法文件而不仅仅是我的特定代码时才有效。
下面是 al.configuration.json 的代码,它是我要添加的 ** 之间的折叠部分。
{
**"folding": {
"markers": {
"start": "^\\s*//\\s*#region\\b",
"end": "^\\s*//\\s*#endregion\\b"
}**
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["BEGIN", "END;"],
["begin", "end;"],
["Begin", "End;"]
],
"autoClosingPairs": [
{ "open": "BEGIN", "close": "END;", "notIn": ["string", "comment"] },
{ "open": "begin", "close": "end;", "notIn": ["string", "comment"] },
{ "open": "Begin", "close": "End;", "notIn": ["string", "comment"] },
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] }
],
"surroundingPairs": [
["'", "'"],
["\"", "\""]
],
"wordPattern": "(\"(?:(?:\\\"\\\")|[^\\\"])*\")|(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)"
}