atom / language-xml Goto Github PK
View Code? Open in Web Editor NEWXML package for Atom
License: Other
XML package for Atom
License: Other
I'm working with ontologies having the file ending '.owl' which is standard xml or rdf format so it would be nice if that would be highlighted by language-xml.
Thanks! :)
I suggest adding CSL files to the filetype list as they are basically XMLs.
[…] the Citation Style Language (CSL), an open XML-based language to describe the formatting of citations and bibliographies.
It would be super cool if support for the msxml:script tag could be included.
Syntax is the following:
<msxsl:script language="JScript" other="arguments">
<![CDATA[
// javascript code, include source.js
]]>
</msxsl:script>
C# code could have some additional Information in XML tags, like
<msxsl:script language="C#" other="arguments">
<msxsl:assembly name="System.Web" />
<![CDATA[
// C#-code, include source.cs
]]>
</msxml:script>
For C# I've also seen language="CSharp"
, I don't know which version is more common.
XML files without a .xml file extension have no syntax highlighting
See: atom/atom#12678
it would be useful to extract the patterns for DTDs, add them to a language-dtd and include them from here:
SVG files are XML files that can contain CSS, but this package doesn’t highlight CSS in those files.
Expected behavior:
Line 4 to 6, and text in the style
attribute at line 9 are highlighted as CSS.
(this is an edited image)
Actual behavior:
Line 4 to 6 are not highlighted, and text in the style
attribute at line 9 is highlighted like any other string.
Reproduces how often: Everytime
Arch Linux
Atom : 1.34.0
Electron: 3.1.1
Chrome : 66.0.3359.181
Node : 10.2.0
Hey,
I'm looking for a way to dynamicaly add new snippets to language-xml.cson, is it possible ?
Because when i define some snippets for XML in ~/.atom/snippets.cson, they are not loaded.
Thanks
There is a small issue with syntax coloring which I have observed in XML files (I am not sure if it occurs with other syntaxes). I think the issue did not occur in previous versions of Atom.
As you can see, the color spans are moved by one character forward on the lines which only contain an XML attribute. The issue occurs only if the number of leading spaces on these lines is even.
(Atom 0.207.0, Ubuntu 14.04 64-bit)
Atom version 0.136
The below sample text, when placing the cursor within the second 'Directory' element, the wrong matching element is shown. This doesn't seem to affect code folding. I also tried setting the language to "Property List (XML)" and the issue is there as well. I'm not sure if I should open another issue for that.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="PatchFamilyTest" />
</Directory>
</Directory>
</Fragment>
</Wix>
E.g, URL encode nested comments, so that users can quickly toggle comment nesting and denesting.
From @omochi on January 19, 2019 17:0
I may found bug of syntax.
It should be:
{
"begin": "<%--",
"captures": {
"0": {
"name": "punctuation.definition.comment.xml"
}
},
"end": "--%>",
"name": "comment.block.xml"
},
Copied from original issue: microsoft/vscode#66776
<tag>
content
</tag>
press command+/
<tag>
<!-- content -->
</tag>
press again
<tag>
conten>
</tag>
As the title says, in Atom 0.69.0 you can't expand snippets starting with '<'.
Hi,
As a Linux user I frequently use desktop environments that are subject to the free desktop specification and I would appreciate it if, the file extension .menu
(for application menus which are XML files) was to be added to the list of files that automatically receive syntax highlighting by this package.
Thanks for your time,
Brenton
XML colorizing incomplete for the too long line: initial part of the line is correctly displayed in colors but since some position everything rest in the line showed as grey.
Open the attached file in Atom, check line #3
Expected behavior: Colorizing complete for the whole line
Actual behavior: Colorizing incomplete for the line #3
Reproduces how often: Reproduced each time the attached document opened
Atom : 1.32.2
Electron: 2.0.9
Chrome : 61.0.3163.100
Node : 8.9.3
apm 2.1.2
npm 6.2.0
node 8.9.3 x64
atom 1.32.2
python
git 2.17.0.windows.1
visual studio 2015
The "highlight other tag" feature where the tag in xml or html is underlined when the cursor is within the tag name is wrong when some of the tags have the shorthand for tag ends
Expected behavior: The first and the last xs:element
tags are underlined
Actual behavior: The last xs:element
and the closest back up the file are underlined
Reproduces how often: Whenever there are preceding tags of the same name with the />
ending shorthand
Atom : 1.18.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
apm 1.18.1
npm 3.10.10
node 6.9.5 x64
python
git 2.10.2.win
visual studio
I originally filed this as atom/atom#7934 and was told to refile it here.
Looking at an Ant build file with a target that uses an echo task with an task using a multi-line text value. Something like this
<?xml version="1.0" encoding="UTF-8"?>
<project name="lgcbuildutils">
<target name="init">
...
</target>
<target name="clean">
...
</target>
<target name="compile">
...
</target>
<target name="special">
...
<echo file="${reportFile}"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="file:///usr/share/mylib/conversion.xsl"?>
<modules/>]]>
</echo>
....
</target>
<target name="deploy">
...
</target>
</project>
When I fold all, it leaves the <?xml-stylesheet> unfolded, and everything after that line is folded under it. In the first screenshot you can see that everything between two such echo tasks was folder under the first <?xml-stylesheet>. In the second you can see the and the first <?xml-stylesheet> unfolded.
My original submission I thought it was from the <?xml ...?>
elements but it turned out to be any multi-line text value.
XML grammar forbids comment ending in triple dash --->
but this grammar appears to accept it. This can make troubleshooting XML parse errors quite confusing because parts of the document are parsed as commented out even though the XML looks well-formed to the eye.
<?xml version="1.0" encoding="utf-8"?>
<foo>Bar
<!--malformed comment--->
Baz
</foo>
Expected behavior:
Something like vim:
Reproduces how often:
100%
Atom : 1.15.0
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
apm 1.15.3
npm 3.10.5
node 4.4.5 x64
python 2.7.12
git 2.7.4
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Code folding on matched tags fails when multiline CDATA text is present in any tag that's not the topmost one. For example, the Inner
tag in this fails to fold:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Outer>
<Inner>
<![CDATA[LINE 1
LINE 2]]>
</Inner>
</Outer>
Large, legal XML files fail to highlight with this grammar. In particular a 3.9 MB file, with roughly 30,000 nodes, doesn't highlight at all.
Moreover, even if I delete the entire contents of the file except for the outermost tag pairs, while keeping the tab open, the grammar never highlights it. Switching the tab to another grammar and then switching it back to XML doesn't fix it either. The tab has to be closed and reopened.
C
, and then back to XML
.Expected behavior: Syntax highlighting should've occurred
Actual behavior: the text remains unhighlighted
Reproduces how often: If the file is large enough (or complex enough, or whatever the condition is) to cause it, then always.
macos 10.12.5
atom --version
Atom : 1.17.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
Hi All
I'm new to Atom (long time gedit user, but I think this is my new editor :) ).
I think there's a bug in the grammar for xml, when at closing bracket is seen in a comment the grammar colouring follows that?
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE root [
<!ENTITY Temp_0 '127.0' > <!-- Target temperature -->
<!ENTITY Temp_400 '107.55' > <!-- [degree C]-->
<!ENTITY Temp_600 '107.6'> <!-- [degree C] -->
]>
hehe the same happens here when using the colouring possibility :) Why this issue? Gedit highlight fine passing the comment parts...
This is similar to #45 but with an extreme amount of detail. I also originally posted this on VSCode's issue page, but was then told to go here since I'm guessing they use the language packs here. I've essentially copied and pasted the issue here.
As a frequent user of XML for planning layouts and storing/retrieving data, I can say that some parts of XML aren't that well covered by VSCode. Specifically, this is XML DTD (Document Type Definitions) and the highlighting (and when inspecting using TM Scopes, the internal structure) isn't as fleshed out. Within this issue, I'd like to submit my own ideas for improving this. Below is a screenshot of some XML DTD Code which I will reference frequently to make my points:
I am using the theme "One Dark Pro" but testing the default themes also gives this same issue.
The example I am using is taken from
This issue will cover the following areas which I've created:
DISCLAIMER: For those who say use XSD, I do use that but sometimes I revert to DTD just for historical reasons or (at least for me), it's easier to define document-only related elements/attributes without having to do too much XSD Namespacing and that. Now onto the bulk!
In XML DTD, Keywords can be split into multiple sections (at least this is what I can split them into):
<!ELEMENT>
and <!ATTLIST>
and the name says it all EMPTY
, ANY
, #REQUIRED
, #IMPLIED
#PCDATA
, CDATA
attribute-name`` and
attribute-value```As per my screenshot above, it is evident that for Declarations, there is some syntax there, as <!DOCTYPE>
and <!ENTITY>
is highlighted, these both fit in the scope keyword.other.doctype.xml
and keyword.other.entity.xml
respectively. However, it seems other keywords, especially <!ELEMENT> and <!ATTLIST> don't seem to have anything. The scope only shows them as part of meta.internalsubset.xml
. Here, the obvious resolution would be to stick these with their own scope such as keyword.other.element.xml
and keyword.other.attlist.xml
and give them that purply highlighting (or blue in default dark+).
Secondly, for Modifier Keywords, I believe they should have a colour similar to that of JavaScript type objects such as Boolean
(green default), and have a scope such as keyword.other.modifier.xml
.
Again, these keywords present meaning and therefore, should be highlighted to give this meaning. Now this is where it gets more ambiguous as Data Keywords also share similar syntax, they can have #s too but not have them at the same time, in my examples, I've given #PCDATA
and CDATA
. To me, these should have the scope of charData or something of the sorts, since these keywords represent what can be 'parsed' inside an XML element, so possibly along the lines of keyword.other.char-data.xml
, and also highlight them in the colour which is used in JavaScript variable number values
Now, this part gets really complicated. Welcome to Values! This section gets crazy because there are many different scopes that could be implemented and some can only appear on certain Declarations etc., and it's just a huge XMessL (see what I did there? I'm sorry). If I were to take the <!ELEMENT>
declaration and give a quick diagnose:
element-name
category
(This is essentially Modifiers but I renamed it to cover more values)/Modifierselement-content
including Data Keywords and Other Elements, along with Special Characters (more on that later)Some of this is easy, some not. element-name
, easy, just highlight it like any HTML/XML element that a theme would do? Default is blue, but One Dark Pro recognises it as a variable so it's red, doesn't matter to me that much though. Modifiers, explained pretty much. element-content
is slightly more challenging, since it uses ()
and within the brackets, Data Keywords can be put inside, or special characters and other elements, separated by commas. In my screenshot, a good example is Line 10: <!ELEMENT PRODUCT (SPECIFICATIONS+,OPTIONS?,PRICE+,NOTES?)>
and Line 23: <!ELEMENT OPTIONS (#PCDATA)>
. My solution to highlight those elements is simply the element colour. I don't think the brackets need to be highlighted though, since I think there is enough mishmash XML colour here already right?
The next step is to diagnose the <!ATTLIST> declaration, as there is whole lot more that can be put into here:
element-name
and modifiers as stated above, but also:attribute-name
attribute-type
attribute-value
Good examples from the screenshot are at Lines 19 - 21:
<!ATTLIST SPECIFICATIONS
WEIGHT CDATA #IMPLIED
POWER CDATA #IMPLIED>
and Lines 24 - 26:
<!ATTLIST OPTIONS FINISH (Metal|Polished|Matte) "Matte"
ADAPTER (Included|Optional|NotApplicable) "Included"
CASE (HardShell|Soft|NotApplicable) "HardShell">
Just to explain briefly, this issue is already goddamn long enough.... The first example best represents the basic syntax. It has element SPECIFICATIONS
, attribute WEIGHT
, type CDATA
(characters basically) and a modifier of #IMPLIED
. The Second one is monstrous at first sight, but really, the only differences are that it contains a Default Value (in the double quotes) and Options for the attribute-value, separated by the special character |
. To resolve this structure, obviously provide scopes such as keyword.other.attlist.attribute-name.xml
, and replace attribute-name
with the relevant one such as type and value. For highlighting the ones in brackets in example 2, the words would probably have to be highlighted in the colour used for attribute values in HTML/XML, same as the default-value since, well they are and can be values after all. Possibly add a .attribute-value-range
scope?
That's basically it for this section, next up is Special Characters! Luckily, this is a much shorter section, less to develop so don't worry, you're almost done (if you haven't stopped reading already)
So far, we've already touched up on some special characters, these include the + ? | *
operators, their meanings aren't relevant right now, but they usually appear inside parentheses, and denote when and how an element to appear (basically frequency). These should have a scope such as operators.xml
and be highlighted in the colour of normal operators in say JavaScript (yes I've been referencing JS the most but it's one language I'm very close to)
One thing that I anticipate could be thrown up, is controlling it appearing in actual XML documents or in DTD. In actual XML, any text between elements is just text, so it shouldn't be highlighted. Plus, It's scope and hierarchal based, so it wouldn't be incorrect anyways. There are examples of this everywhere.
Finally (yes, I know!), i know I've probably made some errors, I've grouped things unnecessarily and jumped a few barriers. Below I'll provide a few links for reading into XML DTD more so you can understand where I;m coming from, and if any questions pop up, feel free to ask:
In this example attr
has the scope:
text.xml
meta.tag.xml
entity.other.attribute-name.localname.xml
<tag
attr="foo">
bar
</tag>
In this example attr
has the scope:
text.xml
meta.tag.xml
<tag
attr="foo">
bar
</tag>
From @jens1o on May 12, 2017 19:30
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "false"
syntaxCheck = "false"
bootstrap = "scss.inc.php">
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
</phpunit>
Copied from original issue: microsoft/vscode#26570
From @Ryan050 on February 3, 2015 11:18
add mxml to xml syntax: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf5f65f-7ff1.html
Copied from original issue: atom/atom#5372
For example,
<hello world1="123" world2="123" world3="123" world4="123" world5="123" world6="123" world7="123" world8="123" world9="123" world10="123" world11="123" world12="123" world13="123" world14="123" world15="123" world16="123" world17="123" world18="123" world19="123" world20="123"/>
stops highlighting world17's string attribute.
@kevinsawicki MXML should be supported by:
https://atom.io/packages/language-flex
Could you add syntax-based folding for XML?
It looks like it can be achieved via a Tree-sitter parser.
A related issue: #33
Currently, folding is based on indentation only, and so it isn't applicable in many cases.
When editing xml files with other file extensions (such as wxs, which is a wix source file http://wixtoolset.org/documentation/manual/v3/overview/files.html) the xml language style must be manually specified each time a file is opened. It would be beneficial to have a setting to be able to specify wxs to always be opened with the xml language style.
From @tommai78101 on September 6, 2018 14:13
When you put double hyphens (--
) inside multi-line comment blocks in XML files, it breaks the syntax highlighting.
Per the following information:
[Definition: Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.] Parameter entity references must not be recognized within comments.
http://www.w3.org/TR/REC-xml/#sec-comments
This is correct indication or correct response to an invalid --
inside XML comments, however, it should only highlight the offending --
in red, but keep the rest of the code with correct syntax highlighting, so it doesn't highlight the remaining code after the offending --
to be green entirely.
<?xml version="1.0" encoding="utf-8"?>
<Foo>
<Class>
<!-- This is a comment -->
<Bar>Hello world</Bar>
<!--
This is a multiple-lines comment.
Hello comment!
-->
<Baz>Goodbye world.</Baz>
<!--
This is a multiple-lines comment with double hyphens inside it.
--
-->
<Error>Highlighting parsing error</Error>
</Class>
</Foo>
Does this issue occur when all extensions are disabled?: Yes
Does this issue occur when one of the extensions is disabled?: Yes
Copied from original issue: microsoft/vscode#58076
Large, legal XML files fail to highlight with this grammar. In particular a 3.9 MB file, with roughly 30,000 nodes, doesn't highlight at all.
Moreover, even if I delete the entire contents of the file except for the outermost tag pairs, while keeping the tab open, the grammar never highlights it. Switching the tab to another grammar and then switching it back to XML doesn't fix it either. The tab has to be closed and reopened.
For example .vcxproj, .vcxproj.filters
Not exactly sure if a double extension will work, also I have no idea about the full list since I only use C and there are other projects that Visual Studio supports (like C#). I guess they won't use the name VCxproj.
Attempting to fold code sections breaks when the XML file contains multiline CDATA sections. Folding doesn't progress past the line containing the beginning of the CDATA
section.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<outer>
<inner test=".test[test].0">
<![CDATA[a'ed foo
foo test
test bar
biz]]>
</inner>
</outer>
inner
tag).Expected behavior: The entire inner
tag should fold, 6 lines into 1 line.
Actual behavior: Only 2 lines fold, and the foo test
line & after remains.
Reproduces how often: Always
Try the same thing for the outer
tag, and the folding ends at the CDATA
line.
macOS 10.12.5
atom --version
Atom : 1.17.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
fxml files are xml files used for building javafx apps. They are also created by scenebuilder.
grammars/xml.json:
"dtml",
"fsproj",
"fxml", <-------
"isml",
"jsp",
Hi,
I am working a lot with SLD which is also an XML schema. Please add it to the list of supported file-types.
Additionally I wanted to ask if it would be possible to add file types on my own in the settings.
Cheers,
Benjamin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.