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 190d6d4
Showing
24 changed files
with
360 additions
and
75 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
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
41 changes: 41 additions & 0 deletions
41
...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,41 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. and others. | ||
* 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: | ||
* Red Hat Inc. - initial API and implementation | ||
*/ | ||
|
||
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; | ||
import org.eclipse.lsp4xml.settings.SharedSettings; | ||
|
||
/** | ||
* 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, SharedSettings settings) throws Exception { | ||
XSISchemaModel.computeValueCompletionResponses(request, response, fullRange, request.getXMLDocument(), settings); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. and others. | ||
* 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: | ||
* Red Hat Inc. - initial API and implementation | ||
*/ | ||
|
||
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
Oops, something went wrong.