Skip to content

Commit

Permalink
DTD hyperlink with XML catalog doesn't work
Browse files Browse the repository at this point in the history
Fixes eclipse-lemminx#850

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Aug 20, 2020
1 parent e80bdb8 commit 59d0a0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ContentModelPlugin implements IXMLExtension {

private final ICodeActionParticipant codeActionParticipant;

private final IDocumentLinkParticipant documentLinkParticipant;
private IDocumentLinkParticipant documentLinkParticipant;

private final ITypeDefinitionParticipant typeDefinitionParticipant;

Expand All @@ -66,7 +66,6 @@ public ContentModelPlugin() {
hoverParticipant = new ContentModelHoverParticipant();
diagnosticsParticipant = new ContentModelDiagnosticsParticipant(this);
codeActionParticipant = new ContentModelCodeActionParticipant();
documentLinkParticipant = new ContentModelDocumentLinkParticipant();
typeDefinitionParticipant = new ContentModelTypeDefinitionParticipant();
}

Expand Down Expand Up @@ -144,6 +143,7 @@ public void start(InitializeParams params, XMLExtensionsRegistry registry) {
if (params != null) {
contentModelManager.setRootURI(params.getRootUri());
}
documentLinkParticipant = new ContentModelDocumentLinkParticipant(resolverManager);
registry.registerCompletionParticipant(completionParticipant);
registry.registerHoverParticipant(hoverParticipant);
registry.registerDiagnosticsParticipant(diagnosticsParticipant);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.lemminx.dom.SchemaLocationHint;
import org.eclipse.lemminx.dom.XMLModel;
import org.eclipse.lemminx.services.extensions.IDocumentLinkParticipant;
import org.eclipse.lemminx.uriresolver.URIResolverExtensionManager;
import org.eclipse.lsp4j.DocumentLink;

/**
Expand All @@ -44,6 +45,12 @@
*/
public class ContentModelDocumentLinkParticipant implements IDocumentLinkParticipant {

private final URIResolverExtensionManager resolverManager;

public ContentModelDocumentLinkParticipant(URIResolverExtensionManager resolverManager) {
this.resolverManager = resolverManager;
}

@Override
public void findDocumentLinks(DOMDocument document, List<DocumentLink> links) {
// Document link for xsi:noNamespaceSchemaLocation
Expand All @@ -65,7 +72,7 @@ public void findDocumentLinks(DOMDocument document, List<DocumentLink> links) {
// Document link for DTD
DOMDocumentType docType = document.getDoctype();
if (docType != null) {
String location = getResolvedLocation(document.getDocumentURI(), docType.getSystemIdWithoutQuotes());
String location = resolverManager.resolve(document.getDocumentURI(), docType.getPublicIdWithoutQuotes(), docType.getSystemIdWithoutQuotes()); //getResolvedLocation(document.getDocumentURI(), docType.getSystemIdWithoutQuotes());
if (location != null) {
try {
DOMRange systemIdRange = docType.getSystemIdNode();
Expand Down

0 comments on commit 59d0a0e

Please sign in to comment.