Skip to content

Commit 98fb947

Browse files
angelozerrdatho7561
authored andcommitted
Avoid duplication of documentation between extension and wiki
Fixes #331 Signed-off-by: azerr <azerr@redhat.com>
1 parent cef03be commit 98fb947

File tree

7 files changed

+75
-9
lines changed

7 files changed

+75
-9
lines changed

docs/Extensions.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Custom XML Extensions
1+
# Extensions
2+
3+
## Custom XML Extensions
24

35
The [LemMinX - XML Language Server](https://github.com/eclipse/lemminx) can be extended to support custom completion, hover, validation, rename, etc by using the [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-spi) mechanism.
46
vscode-xml provides the ability to use your custom XML support provider, by adding external jars to the XML language server's classpath.
@@ -34,3 +36,7 @@ To do that:
3436
You can see the [vscode-xml-maven](https://github.com/angelozerr/vscode-xml-maven) sample which registers custom maven completion [MavenCompletionParticipant](https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/MavenCompletionParticipant.java#L210) for scope:
3537

3638
![demo of vscode xml maven suggesting different scopes for a dependency](./images/vscode-xml-maven.gif)
39+
40+
## XML extension API (TypeScript)
41+
42+
See [PR 292](https://github.com/redhat-developer/vscode-xml/pull/292)

docs/Preferences.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Preferences
2+
13
## Java Home
24

35
vscode-xml requires Java JDK (or JRE) 8 or more recent in order to run.
@@ -63,7 +65,7 @@
6365
]
6466
```
6567

66-
Please see [XSD file associations](Validation#xml-file-association-with-xsd) and [DTD file associations](Validation#xml-file-association-with-dtd) for more information.
68+
Please see [XSD file associations](Validation.md#xml-file-association-with-xsd) and [DTD file associations](Validation.md#xml-file-association-with-dtd) for more information.
6769

6870
## Catalogs
6971

@@ -96,11 +98,11 @@
9698

9799
## Formatting
98100

99-
See the [Formatting page](Formatting#formatting).
101+
See the [Formatting page](Formatting.md#formatting).
100102

101103
## Code Lens
102104

103-
Use `xml.codeLens.enabled` in order to enable or disable code lens. Please see [the Code Lens page](CodeLens#code-lens) for more information.
105+
Use `xml.codeLens.enabled` in order to enable or disable code lens. Please see [the Code Lens page](CodeLens.md#code-lens) for more information.
104106

105107
## Documentation Type
106108

@@ -173,4 +175,4 @@ JARs can be contributed to the LemMinX classpath using the `xml.extension.jars`
173175
These paths can include globs.
174176
This feature is only intended to be used for LemMinX extension development purposes.
175177
Distributing vscode-xml extensions is best done through the mechanism described in the
176-
[vscode-xml extension development documentation](Extensions#custom-xml-extensions).
178+
[vscode-xml extension development documentation](Extensions.md#custom-xml-extensions).

docs/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# XML Documentation
2+
3+
Welcome to the [vscode-xml](https://github.com/redhat-developer/vscode-xml) documentation.
4+
5+
## User Guide
6+
7+
As [vscode-xml](https://github.com/redhat-developer/vscode-xml) consumes the [LemMinX XML Language Server](https://github.com/eclipse/lemminx) written in `Java`, it requires `Java`. Please start reading [here](Preferences.md#java-home).
8+
9+
* [XML Validation](Validation.md#xml-validation): How to validate XML with a grammar (XSD/DTD)?
10+
* [Preferences](Preferences.md#preferences): More info on available [vscode-xml](https://github.com/redhat-developer/vscode-xml) preferences.
11+
* [Formatting](Formatting.md#formatting): More info on the available formatting preferences.
12+
* [Troubleshooting](Troubleshooting.md#troubleshooting): Info on troubleshooting and fixes to issues.
13+
14+
## Developer Guide
15+
16+
* [Extensions](Extensions.md#extensions): How to extend vscode-xml settings and XML features (completion, validation, hover, etc)?

docs/Troubleshooting.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Troubleshooting
2+
3+
## Issues
4+
5+
Please create [vscode-xml issues](https://github.com/redhat-developer/vscode-xml/issues) for any problem.
6+
7+
### No support on xml file.
8+
9+
Sometimes an old instance of the XML Language Server is still running.
10+
11+
You can check if the server is not working in VSCode by going to:
12+
1) Turning on `xml.trace.server` in the VSCode preferences
13+
2) `View -> Output -> XML Support` (drop down menu top right)
14+
If it is not working it will indicate the server has Shutdown.
15+
16+
You can kill the process by:
17+
18+
1) Run `jps` command in terminal
19+
2) Check if multiple instances of `org.eclipse.lemminx-uber.jar` or `XMLServerLauncher`
20+
3) According to your OS:
21+
22+
* on Windows OS: run `taskkill /F /PID ...` all instances
23+
* on other OS: run `kill -9 ...` all instances

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"activationEvents": [
2525
"onLanguage:xml",
2626
"onLanguage:xsl",
27-
"onCommand:xml.open.docs"
27+
"onCommand:xml.open.docs",
28+
"onCommand:xml.open.docs.home"
2829
],
2930
"main": "./dist/extension",
3031
"scripts": {
@@ -373,6 +374,13 @@
373374
"files.trimTrailingWhitespace": false
374375
}
375376
},
377+
"commands": [
378+
{
379+
"command": "xml.open.docs.home",
380+
"title": "Open XML Documentation",
381+
"category": "XML"
382+
}
383+
],
376384
"languages": [
377385
{
378386
"id": "xml",

src/commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ export namespace Commands {
4848
export const MARKDOWN_API_RENDER = 'markdown.api.render';
4949

5050
export const OPEN_DOCS = "xml.open.docs";
51+
52+
export const OPEN_DOCS_HOME = "xml.open.docs.home";
5153
}

src/extension.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,22 @@ namespace ActionableNotification {
136136
let languageClient: LanguageClient;
137137

138138
export function activate(context: ExtensionContext) {
139+
// Register commands for XML documentation
139140
context.subscriptions.push(markdownPreviewProvider);
140-
context.subscriptions.push(commands.registerCommand(Commands.OPEN_DOCS, async (params) => {
141-
const uri = params.page + '.md';
141+
context.subscriptions.push(commands.registerCommand(Commands.OPEN_DOCS_HOME, async () => {
142+
const uri = 'README.md';
143+
const title = 'XML Documentation';
144+
const sectionId = '';
145+
markdownPreviewProvider.show(context.asAbsolutePath(path.join('docs', uri)), title, sectionId, context);
146+
}));
147+
context.subscriptions.push(commands.registerCommand(Commands.OPEN_DOCS, async (params: {page: string, section: string}) => {
148+
const page = params.page.endsWith('.md') ? params.page.substr(0, params.page.length - 3) : params.page;
149+
const uri = page + '.md';
142150
const sectionId = params.section || '';
143-
const title = 'XML ' + params.page;
151+
const title = 'XML ' + page;
144152
markdownPreviewProvider.show(context.asAbsolutePath(path.join('docs', uri)), title, sectionId, context);
145153
}));
154+
146155
let storagePath = context.storagePath;
147156
const externalXmlSettings = {
148157
"xmlCatalogs": [],

0 commit comments

Comments
 (0)