-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new documentation from the wiki. Add links to new documentation in the settings section of `package.json` Closes #328 Signed-off-by: David Thompson <[email protected]>
- Loading branch information
Showing
12 changed files
with
888 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
## Code Lens | ||
|
||
### DTD features | ||
|
||
Code lens is provided in `.dtd` files to show where elements defined in the DTD are referenced. | ||
For instance, in the following code: | ||
|
||
```xml | ||
<!ELEMENT letter (to, from, title, body)> | ||
<!ELEMENT to (#PCDATA)> | ||
<!ELEMENT from (#PCDATA)> | ||
<!ELEMENT title (#PCDATA)> | ||
<!ELEMENT body (#PCDATA)> | ||
``` | ||
|
||
There will be a code lens entry after the first line that points from the | ||
definition of the element `to` to where it is used in the definition of the | ||
element `letter`. | ||
|
||
Here is a demonstration of the above Code Lens: | ||
|
||
![A letter DTD element is declared, which consists of to, from title, and body elements. The definitions for these sub elements have a code lens above, which allows ofr navigating to the letter element declaration.](./images/code-lens/DTDElementCodeLens.gif) | ||
|
||
### XSD Features | ||
|
||
Code lens is also provided in `.xsd` files. It shows where top level types | ||
and elements are referenced. For instance, in the following code: | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="http://example.org/my-example" | ||
xmlns:NS="http://example.org/my-example"> | ||
<xs:element | ||
name="root-element" | ||
type="NS:yell" /> | ||
<xs:simpleType name='yell'> | ||
<xs:restriction base='xs:string'> | ||
<xs:pattern value='[A-Z]+!'></xs:pattern> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:schema> | ||
``` | ||
|
||
There will be a code lens above the line where the `yell` type is defined | ||
that points to where it is referenced when defining the `root-element` element. | ||
|
||
Here is a demonstration of the above Code Lens: | ||
|
||
![The code lens provides the number of references and links to references for an `xs:simpleType`.](./images/code-lens/XSDTypeCodeLens.gif) | ||
|
||
Here is a demonstration of the code lens for `xs:element`: | ||
|
||
![An element root is declared that contains an element boot. Above the declaration of boot, there is a code lens that links to the reference in root.](./images/code-lens/XSDElementCodeLens.gif) |
Oops, something went wrong.