Package org.eclipse.lemminx.settings
Class XMLSymbolFilter
java.lang.Object
org.eclipse.lemminx.settings.PathPatternMatcher
org.eclipse.lemminx.settings.DocumentMatcher
org.eclipse.lemminx.settings.XMLSymbolFilter
XML symbol filter used to show/hide DOM attributes, text nodes specified with
XPath expressions:
"xml.symbols.filters": [
// Declaration of symbols filter for maven 'pom.xml' to show all text nodes in the Outline.
{
"pattern": "pom.xml",
"expressions" :[
{
"xpath": "//text()"
}
]
},
// Declaration of symbols filter for Spring beans to show all @id of the elements in the Outline.
{
"pattern": "bean*.xml",
"expressions" :[
{
"xpath": "//@id"
}
]
},
// Declaration of symbols filter for ant/phing build.xml files to show all target names and property
// names/files in the Outline.
{
"pattern": "build*.xml",
"expressions" :[
{
// keep the value of the attribute "name" on the same line
// as the "target" element, and only show the attribute value
"xpath": "//target/@name",
"inlineAttribute" : true,
"showAttributeName": false
},
// show "unless" and "depends" as nested attributes for
// "target" elements
{
"xpath": "//target/@unless"
},
{
"xpath": "//target/@depends"
},
{
// keep the value of the attribute "name" on the same line
// as the "property" element, and only show the attribute value
"xpath": "//property/@name",
"inlineAttribute" : true,
"showAttributeName": false
},
{
// keep the value of the attribute "file" on the same line
// as the "property" element, and show the attribute name
// along with the value to distinguish it from the more common
// "name" attribute
"xpath": "//property/@file",
"inlineAttribute" : true,
"showAttributeName": true
}
}
]
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the expression list filter.getFilterForInlineAttr(DOMAttr attrNode) Gets the first matched attribute node that is set as an inline attribute for an element.booleanhasFilterFor(IXPathNodeMatcher.MatcherType matcherType) Returns true if the filter have an expression for the given type (element, attribute, text) and false otherwise.booleanisNodeSymbol(DOMNode node) Returns true if the given node is a symbol and false otherwise.voidsetExpressions(XMLSymbolExpressionFilter[] expressions) Set the expression list filter.Methods inherited from class org.eclipse.lemminx.settings.DocumentMatcher
getGrammarURI, getNamespaceURI, getPublicId, getRootElement, getSystemId, matches, setGrammarURI, setNamespaceURI, setPublicId, setRootElement, setSystemIdMethods inherited from class org.eclipse.lemminx.settings.PathPatternMatcher
createGlobMatcher, equals, getPathMatcher, getPattern, matches, matches, setPathMatcher, setPattern
-
Field Details
-
DEFAULT
-
-
Constructor Details
-
XMLSymbolFilter
public XMLSymbolFilter()
-
-
Method Details
-
setExpressions
Set the expression list filter.- Parameters:
expressions- the expression list filter.
-
getExpressions
Returns the expression list filter.- Returns:
- the expression list filter.
-
getFilterForInlineAttr
Gets the first matched attribute node that is set as an inline attribute for an element.- Parameters:
attrNode- the DOMElement attribute node to check for.- Returns:
- the first matched attribute node that is set as an inline attribute for an element, or null if there isn't one.
-
isNodeSymbol
Returns true if the given node is a symbol and false otherwise.- Parameters:
node- the DOM node.- Returns:
- true if the given node is a symbol and false otherwise.
-
hasFilterFor
Returns true if the filter have an expression for the given type (element, attribute, text) and false otherwise.- Parameters:
matcherType- the matcher type.- Returns:
- true if the filter have an expression for the given type (element, attribute, text) and false otherwise.
-