-
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.
Initialize reference extension participant (see #58)
- Loading branch information
1 parent
ccda65b
commit 3d4b945
Showing
5 changed files
with
104 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/services/XMLReference.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,43 @@ | ||
/** | ||
* Copyright (c) 2018 Angelo ZERR | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Angelo Zerr <[email protected]> - initial API and implementation | ||
*/ | ||
package org.eclipse.lsp4xml.services; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.eclipse.lsp4j.Location; | ||
import org.eclipse.lsp4j.Position; | ||
import org.eclipse.lsp4j.ReferenceContext; | ||
import org.eclipse.lsp4xml.dom.XMLDocument; | ||
import org.eclipse.lsp4xml.services.extensions.IReferenceParticipant; | ||
import org.eclipse.lsp4xml.services.extensions.XMLExtensionsRegistry; | ||
|
||
/** | ||
* XML reference support. | ||
* | ||
*/ | ||
class XMLReference { | ||
|
||
private final XMLExtensionsRegistry extensionsRegistry; | ||
|
||
public XMLReference(XMLExtensionsRegistry extensionsRegistry) { | ||
this.extensionsRegistry = extensionsRegistry; | ||
} | ||
|
||
public List<? extends Location> findReferences(XMLDocument document, Position position, ReferenceContext context) { | ||
List<Location> locations = new ArrayList<>(); | ||
for (IReferenceParticipant participant : extensionsRegistry.getReferenceParticipants()) { | ||
participant.findReference(document, position, context, locations); | ||
} | ||
return locations; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
....lsp4xml/src/main/java/org/eclipse/lsp4xml/services/extensions/IReferenceParticipant.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,28 @@ | ||
/** | ||
* Copyright (c) 2018 Angelo ZERR. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Angelo Zerr <[email protected]> - initial API and implementation | ||
*/ | ||
package org.eclipse.lsp4xml.services.extensions; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.lsp4j.Location; | ||
import org.eclipse.lsp4j.Position; | ||
import org.eclipse.lsp4j.ReferenceContext; | ||
import org.eclipse.lsp4xml.dom.XMLDocument; | ||
|
||
/** | ||
* Reference participant API. | ||
* | ||
*/ | ||
public interface IReferenceParticipant { | ||
|
||
void findReference(XMLDocument document, Position position, ReferenceContext context, List<Location> locations); | ||
|
||
} |
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