Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax and language configuration fixes and improvements #286

Merged
merged 13 commits into from
May 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions packages/vscode/languages/astro-language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"brackets": [
["<!--", "-->"],
["<", ">"],
["{", "}"],
["(", ")"]
Copy link
Member Author

@Princesseuh Princesseuh May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no cases where you want parenthesizes to count as brackets in the source.astro scope, in contexts where they do matter (ex: source.ts, source.js, source.tsx) the languages used there will add them as brackets

["{", "}"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
Expand All @@ -15,8 +14,9 @@
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "`", "close": "`" },
{ "open": "{/*", "close": "*/}", "notIn": ["comment", "string"] },
{ "open": "<!--", "close": "-->", "notIn": ["comment", "string"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
{ "open": "/**", "close": " */", "notIn": ["string", "comment"] }
],
"autoCloseBefore": ";:.,=}])>` \n\t",
"surroundingPairs": [
Expand All @@ -33,5 +33,36 @@
"start": "^\\s*<!--\\s*#region\\b.*-->",
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
}
},
"wordPattern": {
"pattern": "([^\\-\\s]+-[^\\-\\s]+)|(-?\\d*\\.\\d\\w*)|([^\\`\\~\\-\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:'\"\\,\\.\\<\\>\\/\\s]+)"
},
"onEnterRules": [
{
"beforeText": {
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!/)>)[^<]*$",
"flags": "i"
},
"afterText": {
"pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>$",
"flags": "i"
},
"action": {
"indent": "indentOutdent"
}
},
{
"beforeText": {
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!/)>)[^<]*$",
"flags": "i"
},
"action": {
"indent": "indent"
}
}
],
"indentationRules": {
"increaseIndentPattern": "<(?!\\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr)\\b|[^>]*\\/>)([-_\\.A-Za-z0-9]+)(?=\\s|>)\\b[^>]*>(?!.*<\\/\\1>)|<!--(?!.*-->)|\\{[^}\"']*$",
"decreaseIndentPattern": "^\\s*(<\\/(?!html)[-_\\.A-Za-z0-9]+\\b[^>]*>|-->|\\})"
}
Comment on lines +64 to 67
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this will be great! Nice job ☺️

}