mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
34489a2494
This commit adds the following: - Syntax builder scripts to make syntaxes easier to read and edit - Syntax highlight in single quote attributes - Syntax highlight for slot props - Basic syntax highlight for xpaths - Added `Switch Below` command This commit fixes the following: - Using `Switch Besides` or `Switch Below` does not open a new panel if one was already open - Fixed missing space in component's snippet indentation
106 lines
3.1 KiB
JavaScript
106 lines
3.1 KiB
JavaScript
import { createAttributePatterns, createPattern } from "../syntax_builder_utils.mjs";
|
|
|
|
const xpathPattern = [createPattern("xpath", {
|
|
patterns: [
|
|
{
|
|
begin: "\\[",
|
|
beginCaptures: {
|
|
"0": {
|
|
name: "punctuation.definition",
|
|
}
|
|
},
|
|
end: "\\]",
|
|
endCaptures: {
|
|
"0": {
|
|
name: "punctuation.definition",
|
|
}
|
|
},
|
|
patterns: [
|
|
{
|
|
begin: "'",
|
|
beginCaptures: {
|
|
"0": {
|
|
name: "punctuation.definition",
|
|
}
|
|
},
|
|
end: "'",
|
|
endCaptures: {
|
|
"0": {
|
|
name: "punctuation.definition",
|
|
}
|
|
},
|
|
contentName: "string.quoted.single",
|
|
},
|
|
{
|
|
begin: "\\\"",
|
|
beginCaptures: {
|
|
"0": {
|
|
name: "punctuation.definition",
|
|
}
|
|
},
|
|
end: "\\\"",
|
|
endCaptures: {
|
|
"0": {
|
|
name: "punctuation.definition",
|
|
}
|
|
},
|
|
contentName: "string.quoted.double",
|
|
},
|
|
{
|
|
match: "(@)([a-zA-Z0-9_:\\-]+)\\b",
|
|
captures: {
|
|
"1": {
|
|
name: "punctuation.definition",
|
|
},
|
|
"2": {
|
|
name: "entity.other.attribute-name",
|
|
}
|
|
}
|
|
},
|
|
{
|
|
match: "(\\(|\\))",
|
|
name: "meta.brace.round",
|
|
},
|
|
{
|
|
match: "[0-9]+(\\.[0-9]+)?",
|
|
name: "constant.numeric.decimal",
|
|
},
|
|
{
|
|
match: "\\b(hasclass)\\b",
|
|
captures: {
|
|
"1": {
|
|
name: "entity.name.function",
|
|
},
|
|
}
|
|
},
|
|
]
|
|
},
|
|
{
|
|
match: "/{1,2}",
|
|
name: "text",
|
|
},
|
|
{
|
|
match: "(?<!@)([A-Z][a-zA-Z]+)\\b",
|
|
captures: {
|
|
"1": {
|
|
name: "entity.name.type.class",
|
|
}
|
|
}
|
|
},
|
|
{
|
|
match: "(?<!@)([a-z][a-zA-Z0-9_:.]+|[abiqsuw])\\b",
|
|
captures: {
|
|
"1": {
|
|
name: "entity.name.tag",
|
|
}
|
|
}
|
|
},
|
|
]
|
|
})];
|
|
|
|
export const xpathAttributes = createAttributePatterns("xpath-attributes", {
|
|
match: "expr",
|
|
attributeName: "owl.xml.attribute owl.xml.attribute.xpath",
|
|
patterns: xpathPattern,
|
|
});
|