forked from eclipse-lemminx/lemminx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes eclipse-lemminx#247 Signed-off-by: Nikolas Komonen <[email protected]>
- Loading branch information
1 parent
4797365
commit 4fac701
Showing
9 changed files
with
162 additions
and
9 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
29 changes: 29 additions & 0 deletions
29
...se.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/xsi/XSICompletionParticipant.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,29 @@ | ||
package org.eclipse.lsp4xml.extensions.xsi; | ||
|
||
import org.eclipse.lsp4j.Range; | ||
import org.eclipse.lsp4xml.services.XSISchemaModel; | ||
import org.eclipse.lsp4xml.services.extensions.CompletionParticipantAdapter; | ||
import org.eclipse.lsp4xml.services.extensions.ICompletionRequest; | ||
import org.eclipse.lsp4xml.services.extensions.ICompletionResponse; | ||
|
||
/** | ||
* XSICompletionParticipant | ||
*/ | ||
public class XSICompletionParticipant extends CompletionParticipantAdapter { | ||
|
||
@Override | ||
public void onAttributeName(boolean generateValue, Range fullRange, ICompletionRequest request, | ||
ICompletionResponse response) throws Exception { | ||
if (request.getXMLDocument().hasSchemaInstancePrefix()) { | ||
XSISchemaModel.computeCompletionResponses(request, response, fullRange, request.getXMLDocument(), | ||
generateValue); | ||
} | ||
} | ||
|
||
@Override | ||
public void onAttributeValue(String valuePrefix, Range fullRange, boolean addQuotes, ICompletionRequest request, | ||
ICompletionResponse response) throws Exception { | ||
XSISchemaModel.computeValueCompletionResponses(request, response, fullRange, request.getXMLDocument()); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/xsi/XSISchemaPlugin.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,33 @@ | ||
package org.eclipse.lsp4xml.extensions.xsi; | ||
|
||
import org.eclipse.lsp4j.InitializeParams; | ||
import org.eclipse.lsp4xml.services.extensions.ICompletionParticipant; | ||
import org.eclipse.lsp4xml.services.extensions.IXMLExtension; | ||
import org.eclipse.lsp4xml.services.extensions.XMLExtensionsRegistry; | ||
import org.eclipse.lsp4xml.services.extensions.save.ISaveContext; | ||
|
||
/** | ||
* Plugin to handle `xsi` attributes or a namespace with the value of: | ||
* "http://www.w3.org/2001/XMLSchema-instance" | ||
* | ||
* Loaded by service loader in 'resources' folder. | ||
*/ | ||
public class XSISchemaPlugin implements IXMLExtension { | ||
|
||
ICompletionParticipant completionParticipant = new XSICompletionParticipant(); | ||
|
||
@Override | ||
public void start(InitializeParams params, XMLExtensionsRegistry registry) { | ||
registry.registerCompletionParticipant(completionParticipant); | ||
} | ||
|
||
@Override | ||
public void stop(XMLExtensionsRegistry registry) { | ||
registry.unregisterCompletionParticipant(completionParticipant); | ||
} | ||
|
||
@Override | ||
public void doSave(ISaveContext context) { | ||
|
||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.