dotjoshjohnson / vscode-xml Goto Github PK
View Code? Open in Web Editor NEWXML Tools for Visual Studio Code
License: MIT License
XML Tools for Visual Studio Code
License: MIT License
VS Code now contains a command to view outdated extensions. Because of the manual processes involved on the deployment side, it'd be best to remove the homebrewed update notifier.
Due to a CI build issue, we needed to fork the Microsoft/vscode-extension-vscode
repository and propose a fix for microsoft/vscode-extension-vscode#12. The package.json
for the vscode-xml
extension is temporarily pointing to the commit in the fork containing our proposed fix. Once MS publishes an official fix, we can point back to the registered NPM version.
Currently, the extension swallows most errors. There should be better catches in place to surface errors to the user.
formatting removes comments.
The repo links in package.json
need to be updated to reflect the move to the TrueCommerce organization.
The logic for locating and parsing the VS Code storage.json
file should be split out into a new service. It currently resides in the XmlTreeService
class.
Some of the import
statements are becoming unruly. Many of these can be condensed using an alias (import * as vsc from 'vscode'
).
This is causing the formatter to also leave newlines in place as XML is linearized using the minifier function.
I've found a case in which an extra newline is added when Format Code
is called:
Before:
<?xml version="1.0"?>
<!-- TEST COMMENT -->
<text>
<content />TEST_TEXT
</text>
After:
<?xml version="1.0"?>
<!-- TEST COMMENT -->
<text>
<content />TEST_TEXT
</text>
If I continue to do Format Code
it will continue to add newlines after the <content/>
line, like so:
<?xml version="1.0"?>
<!-- TEST COMMENT -->
<text>
<content />TEST_TEXT
</text>
I know this isn't necessarily a "best practice" when it comes to writing XML files, but it is still valid XML.
I'm opening an XML file in Visual Studio Code 1.5.2, right-clicking on the text, clicking on "Format code" and nothing is happening. XML Tools 1.6.0 is installed.
I'm not sure if a Code update has broken something so I can't be sure when this last worked.
Sorry for not being more helpful.
I had forked the xmldom
library to fix a line numbering issue. This has now been fixed in the main repo and we should switch the package.json
dependency back to the NPM package.
When a large XML file is opened, VS Code will still fire context change events (editor window change and selection change) even if the editor API is not ready for that document. This results in a barrage of TypeErrors due to null references. Adding a guard clause should keep us from tripping over a 500lb XML file.
On a Nativescript xml coding, when using Ternary Operators with <
I got the error above, but not when using something like that !=
:
XML formatting failed: at line 13, column 76: expected exclamation mark, question mark or alphabetic tag name.
<StackLayout>
<Label text="label with just < " visibility="{{ p.status < 1 ? 'visible' : 'collapsed' }}" />
<Label text="labe with != " visibility="{{ p.status != 1 ? 'visible' : 'collapsed' }}" />
</StackLayout>
Currently does not seem to do anything.
It would be nice if I could just open VS Code, paste some XML and format it without having to save it to a .xml file first
When trying to get the treeview on Ubuntu, if the path contains an uppercase char, it fails with this message:
Impossible d'ouvrir '' : cannot open file:///home/nicolas/t%C3%A9l%C3%A9chargements/backup-1473699716781.xml. Detail: Fichier introuvable (/home/nicolas/téléchargements/backup-1473699716781.xml).
The right path here is home/nicolas/Téléchargements/backup-1473699716781.xml
Commands are being exposed prior to the extension being activated. This is causing event listener errors when trying to, for example, format XML before the language is changed from "Plain Text" to "XML". We should check to see if this is due to the way commands are being declared in the extension manifest.
If this is a VS Code bug, we can work around it by activating the extension on any event (using the *
activation event).
When an XML fragment is selected and the Format Code
command is issued, the selection is replaced with a formatted copy of the entire document. Only the selection should be formatted.
every time I executed the xpath, an new XPath Results item will be added.
here is the output what i got.
[Line 482] Estimates:
34.71600
-41.21200
4.16800
19.00000
32.72366
3
Target ES6 and use the async/await API.
The XPath evaluator doesn't seem to resolve default namespaces properly.
This works:
/Root/Child
<Root>
<Child>value</Child>
</Root>
But this doesn't:
/Root/Child
<Root xmlns="http://mynamespace.com">
<Child>value</Child>
</Root>
Create wiki documentation for the new XML tree view feature (including technical documentation for the new xmltree://
protocol implemented in 801fc5a).
having xml:
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book>
<title lang="en">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="en">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
running XPath: count(//book)
Result:
2
ERROR something went wrong while evaluating the XPath: Type error
Hi,
Has anybody successfully ran this extension on Linux? Which xmlTools.xqueryExecutionEngine
works for you?
I'm thinking that Saxon might be my best bet here, and am busy trying to formulate a working xmlTools.xqueryExecutionArguments
, but a more detailed guide in terms of what this extension expects of such a tool (in terms of inputs / outputs) would be very useful.
In MarkLogic, for example, the xdmp
and cts
namespaces are bound automatically and don’t need to be declared. It would be nice to be able to specify a list of prefix-URI pairs that the linter would assume already exist.
The equivalent of inserting,
import module namespace xdmp = "http://marklogic.com/xdmp";
import module namespace cts = "http://marklogic.com/cts";
manually into your code.
Instead of adding a new command, better add yourself as a formatter provider
vscode.languages.registerDocumentFormattingEditProvider('xml', ...)
vscode.languages.registerDocumentRangeFormattingEditProvider('xml', ...)
You will then get invoked on the built-in Format command.
You can have a look at my css formatter extension:
https://github.com/aeschli/vscode-css-formatter/
I have a small change to the providers/Formatting.ts file to allow optional 'insertSpaces' and 'tabSize' options to the extension settings (defaults to build in values) to allow greater flexibility when formatting XML to allow different formatting than the defaults.
I would like to push a private branch for you to look over.
With the VS Code "January" release, we should have the tools available to render an XML document as a collapsible tree view.
microsoft/vscode#272 - Allows us to create a virtual document in a new column.
microsoft/vscode#1308 - Allows extensions to preview HTML in a TextDocument
instance.
Currently, the script path and input XML path are made available. A $(project)
variable should also be exposed, which would be the root folder of the currently opened project folder.
The current XML formatter is a bit messy. It should be rewritten to include more edge cases to avoid messing with CDATA formatting and attribute contents.
Also, the current formatter will take elements that should normally appear like this: <XmlElement></XmlElement>
and put a line break between the two tags. This shouldn't happen and should be corrected.
Before
<node attr="none" attr2="lots" attr3="less" > </node>
After
<node attr="none" attr2="lots" attr3="less" ></node>
Spaces between node
and attr1
should be merged into only one space.
Also, spaces before the closing >
aren't treated.
Attributes attr1
, attr2
and attr3
were spaced correctly with each other.
Xml tree view is pretty nice.
But I have problem, Treeview has no tab stop, It can not be controlled(ellapsed,collapsed) VIA KEYBOARD
Navigate via keyboard is very important thing to search and observe Tree
Hi,
Great extension, but wondering if it can perseve the whitepace inside nodes..
For example:
<root><child>Line 1
Line 2
Line 3</child></root>
Becomes
<root>
<child>Line 1Line 2Line 3</child>
</root>
Where as it would be great if it could keep the white space inside the nodes..
<root>
<child>Line 1
Line 2
Line 3</child>
</root>
How can add the function to "format code" to XSL and XSLT files?
Hi
Great extension. I use Visual Studio Code and XML Tools for writing my xslt files. Here the formatting of xml comes in handy, but I would like to keep my blank lines which makes it easier to find my way around my code.
Would it be possible to get a setting for this?
Thanks a bunch!
Morten
what is the correct format when use evaluate xpath command?
like writexml tool :evaluate xpath XX\XXXX
?
After a Format Code of web.config the xml is no longer valid.
The XPath input prompt should default to the last XPath query used against the active document. This feature should be exposed as a user setting so it can be disabled if desired.
The XML formatter appends always a new line character at the end of the file even when there is already one. This is needless and in my opinon a bug. Please fix this
If you past in some XML, then select XML as the format (from the bottom right corner of VS), but you have not saved it to a disk file, it will fail.
Would be nice to just copy and paste some text into an "untitled" page and after selecting all (or portions) of text, simply doing a "Format" command (or alt-shift-f) to format the string with tabs/spaces. Tried this with a sample XML string and it doesn't work until I save that untitled file as a ".xml".
"Indent XML" is a similar Sublime plugin https://github.com/alek-sys/sublimetext_indentxml that works with selection.
We plan to change the VSCE publisher from DotJoshJohnson
to TrueCommerce
to reflect the move from a personally-developed extension to an organization-maintained extension. This move will change the extension ID from DotJoshJohnson.xml
to TrueCommerce.xml
. Prior to making this change, an update will need to be released that contains bootstrapping logic that can move existing users to the "new" extension:
DotJoshJohnson.xml
to watch the marketplace for TrueCommerce.xml
.TrueComerce.xml
is deployed to the marketplace, DotJoshJohnson.xml
should either:
TrueCommerce.xml
, install it, then uninstall itself (if possible).There is more discussion to be had here, and this is not an urgent move. This should be classified as technical debt (in terms of priority) and should not block new features or bug fixes.
the xml as follows:
<result>Test text
text
</result>
after formatting:
<result>Test texttext</result>
The '\n' in element text should not be removed.
When formatting a document, every namespace attribute is placed on a new line.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<parent xmlns="namespace.url" xmlns:foo="bar">
<child>Info</child>
</parent>
is converted to
<?xml version="1.0" encoding="UTF-8"?>
<parent
xmlns="namespace.url"
xmlns:foo="bar">
<child>Info</child>
</parent>
It will be nice to have at least an option to disable this behaviour and put every node tag on a unique line with all its attributes.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" /> <soapenv:Body> <TableResponse xmlns="http://xml.tools/"> <TableResult> <TableLists> <TableList> <TableCode>Tool</TableCode> <TableEntry> <ElementCode>00001</ElementCode> <ElementDescription>1</ElementDescription> </TableEntry> <TableEntry> <ElementCode>0002</ElementCode> <ElementDescription>2</ElementDescription> </TableEntry> </TableList> </TableLists> </TableResult> </TableResponse> </soapenv:Body> </soapenv:Envelope>
Shift+Alt+F format it, but... Body is intended as subchild of Header, should be on the same level.
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.