-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DTD hover/completion support for documentation
- Loading branch information
Showing
6 changed files
with
982 additions
and
4 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
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
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
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
57 changes: 57 additions & 0 deletions
57
...xml/src/test/java/org/eclipse/lsp4xml/extensions/contentmodel/DTDHoverExtensionsTest.java
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,57 @@ | ||
/** | ||
* Copyright (c) 2018 Angelo ZERR and Liferay Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Angelo Zerr <[email protected]> - initial API and implementation | ||
* Seiphon Wang <[email protected]> | ||
*/ | ||
package org.eclipse.lsp4xml.extensions.contentmodel; | ||
|
||
import org.apache.xerces.util.URI.MalformedURIException; | ||
import org.eclipse.lsp4xml.XMLAssert; | ||
import org.eclipse.lsp4xml.commons.BadLocationException; | ||
import org.eclipse.lsp4xml.services.XMLLanguageService; | ||
import org.junit.Test; | ||
|
||
public class DTDHoverExtensionsTest { | ||
|
||
@Test | ||
public void testTagHover() throws BadLocationException, MalformedURIException { | ||
String xml = "<?xml version=\"1.0\"?>\r\n" + // | ||
"<!DOCTYPE service-builder PUBLIC \"-//Liferay//DTD Service Builder 7.2.0//EN\" \"http://www.liferay.com/dtd/liferay-service-builder_7_2_0.dtd\">" | ||
+ "<service-builder dependency-injector=\"ds\" package-path=\"testSB\"></servi|ce-builder>"; | ||
assertHover(xml,"The service-builder element is the root of the deployment descriptor for" + // | ||
" a Service Builder descriptor that is used to generate services available to" + | ||
" portlets. The Service Builder saves the developer time by generating Spring" + | ||
" utilities, SOAP utilities, and Hibernate persistence classes to ease the" + | ||
" development of services." | ||
+ // | ||
System.lineSeparator() + // | ||
System.lineSeparator() + "Source: [liferay-service-builder_7_2_0.dtd](http://www.liferay.com/dtd/liferay-service-builder_7_2_0.dtd)", | ||
206); | ||
} | ||
|
||
@Test | ||
public void testAttributeNameHover() throws BadLocationException, MalformedURIException { | ||
String xml = "<?xml version=\"1.0\"?>\r\n" + // | ||
"<!DOCTYPE service-builder PUBLIC \"-//Liferay//DTD Service Builder 7.2.0//EN\" \"http://www.liferay.com/dtd/liferay-service-builder_7_2_0.dtd\">" | ||
+ "<service-builder dependency-injector=\"ds\" pa|ckage-path=\"testSB\"></service-builder>"; | ||
assertHover(xml, | ||
"The package-path value specifies the package of the generated code." | ||
+ // | ||
System.lineSeparator() + // | ||
System.lineSeparator() + "Source: [liferay-service-builder_7_2_0.dtd](http://www.liferay.com/dtd/liferay-service-builder_7_2_0.dtd)", | ||
null); | ||
} | ||
|
||
private static void assertHover(String value, String expectedHoverLabel, Integer expectedHoverOffset) | ||
throws BadLocationException { | ||
XMLAssert.assertHover(new XMLLanguageService(), value, "src/test/resources/catalogs/service.xml", null, | ||
expectedHoverLabel, expectedHoverOffset); | ||
} | ||
|
||
} |
Oops, something went wrong.