From dbb3f8929624091bbaa6bae1726f0411ec933ed1 Mon Sep 17 00:00:00 2001 From: azerr Date: Wed, 7 Sep 2022 14:13:40 +0200 Subject: [PATCH] OnEnterRules support for html files Signed-off-by: azerr --- .../html/language-configuration.json | 42 ----------- .../html/language-configuration.jsonc | 71 +++++++++++++++++++ org.eclipse.wildwebdeveloper/plugin.xml | 2 +- 3 files changed, 72 insertions(+), 43 deletions(-) delete mode 100644 org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.json create mode 100644 org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.jsonc diff --git a/org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.json b/org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.json deleted file mode 100644 index a9e9495d4d..0000000000 --- a/org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.json +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2015-2017 Angelo ZERR. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial code from https://github.com/Microsoft/vscode/ - * Initial copyright Copyright (C) Microsoft Corporation. All rights reserved. - * Initial license: MIT - * - * Contributors: - * - Microsoft Corporation: Initial code licensed under MIT license - * - * @see https://github.com/Microsoft/vscode/blob/master/extensions/html/language-configuration.json - */ - { - "comments": { - "blockComment": [ "" ] - }, - "brackets": [ - [""], - ["<", ">"], - ["{", "}"], - ["(", ")"] - ], - "autoClosingPairs": [ - { "open": "{", "close": "}"}, - { "open": "[", "close": "]"}, - { "open": "(", "close": ")" }, - { "open": "'", "close": "'" }, - { "open": "\"", "close": "\"" } - ], - "surroundingPairs": [ - { "open": "'", "close": "'" }, - { "open": "\"", "close": "\"" }, - { "open": "{", "close": "}"}, - { "open": "[", "close": "]"}, - { "open": "(", "close": ")" }, - { "open": "<", "close": ">" } - ] -} \ No newline at end of file diff --git a/org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.jsonc b/org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.jsonc new file mode 100644 index 0000000000..82e035ee6b --- /dev/null +++ b/org.eclipse.wildwebdeveloper/language-configurations/html/language-configuration.jsonc @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2015-2017 Angelo ZERR. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Initial code from https://github.com/Microsoft/vscode/ + * Initial copyright Copyright (C) Microsoft Corporation. All rights reserved. + * Initial license: MIT + * + * Contributors: + * - Microsoft Corporation: Initial code licensed under MIT license + * + * @see https://github.com/Microsoft/vscode/blob/master/extensions/html/language-configuration.json + */ +{ + "comments": { + "blockComment": [ "" ] + }, + "brackets": [ + [""], + ["<", ">"], + ["{", "}"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}"}, + { "open": "[", "close": "]"}, + { "open": "(", "close": ")" }, + { "open": "'", "close": "'" }, + { "open": "\"", "close": "\"" }, + { "open": "", "notIn": [ "comment", "string" ]} + ], + "surroundingPairs": [ + { "open": "'", "close": "'" }, + { "open": "\"", "close": "\"" }, + { "open": "{", "close": "}"}, + { "open": "[", "close": "]"}, + { "open": "(", "close": ")" }, + { "open": "<", "close": ">" } + ], + "colorizedBracketPairs": [ + ], + "folding": { + "markers": { + "start": "^\\s*", + "end": "^\\s*" + } + }, + "wordPattern": "(-?\\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[^>]*>|-->|\\})" + } +} \ No newline at end of file diff --git a/org.eclipse.wildwebdeveloper/plugin.xml b/org.eclipse.wildwebdeveloper/plugin.xml index 135a8da5e4..850a3fbea8 100644 --- a/org.eclipse.wildwebdeveloper/plugin.xml +++ b/org.eclipse.wildwebdeveloper/plugin.xml @@ -308,7 +308,7 @@ point="org.eclipse.tm4e.languageconfiguration.languageConfigurations"> + path="language-configurations/html/language-configuration.jsonc">