forked from redhat-developer/quarkus-ls
-
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.
Filter and fill some value for Java (server) snippet
Fixes redhat-developer#265 Signed-off-by: azerr <azerr@redhat.com>
- Loading branch information
1 parent
eed5a4b
commit cc8705b
Showing
33 changed files
with
1,182 additions
and
112 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
52 changes: 52 additions & 0 deletions
52
....redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/commons/JavaKind.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,52 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.microprofile.commons; | ||
|
||
/** | ||
* The java element kind. | ||
* | ||
* @author Angelo ZERR | ||
* | ||
*/ | ||
public enum JavaKind { | ||
|
||
TYPE(1), METHOD(2), ANNOTATION(3); | ||
|
||
private final int value; | ||
|
||
JavaKind(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public static JavaKind forValue(int value) { | ||
JavaKind[] allValues = JavaKind.values(); | ||
if (value < 1 || value > allValues.length) | ||
throw new IllegalArgumentException("Illegal enum value: " + value); | ||
return allValues[value - 1]; | ||
} | ||
|
||
public static JavaKind getScope(String scope) { | ||
if (scope != null) { | ||
scope = scope.toUpperCase(); | ||
try { | ||
return JavaKind.valueOf(scope); | ||
} catch (Exception e) { | ||
// Do nothing | ||
} | ||
} | ||
return TYPE; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...croprofile.jdt.core/src/main/java/com/redhat/microprofile/commons/JavaSnippetContext.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 @@ | ||
package com.redhat.microprofile.commons; | ||
|
||
import java.util.List; | ||
|
||
public class JavaSnippetContext { | ||
|
||
private JavaKind kind; | ||
|
||
private List<String> type; | ||
|
||
public JavaKind getKind() { | ||
return kind; | ||
} | ||
|
||
public void setKind(JavaKind kind) { | ||
this.kind = kind; | ||
} | ||
|
||
public List<String> getType() { | ||
return type; | ||
} | ||
|
||
public void setType(List<String> type) { | ||
this.type = type; | ||
} | ||
|
||
|
||
} |
83 changes: 83 additions & 0 deletions
83
....core/src/main/java/com/redhat/microprofile/commons/MicroProfileJavaCompletionParams.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,83 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.microprofile.commons; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.lsp4j.Position; | ||
|
||
/** | ||
* MicroProfile Java completion parameters. | ||
* | ||
* @author Angelo ZERR | ||
* | ||
*/ | ||
public class MicroProfileJavaCompletionParams { | ||
|
||
private String uri; | ||
private Position position; | ||
private List<JavaSnippetContext> contexts; | ||
|
||
public MicroProfileJavaCompletionParams() { | ||
|
||
} | ||
|
||
public MicroProfileJavaCompletionParams(String uri, Position position) { | ||
this(); | ||
setUri(uri); | ||
setPosition(position); | ||
} | ||
|
||
/** | ||
* Returns the java file uri. | ||
* | ||
* @return the java file uri. | ||
*/ | ||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
/** | ||
* Set the java file uri. | ||
* | ||
* @param uri the java file uri. | ||
*/ | ||
public void setUri(String uri) { | ||
this.uri = uri; | ||
} | ||
|
||
/** | ||
* Returns the completion position | ||
* | ||
* @return the completion position | ||
*/ | ||
public Position getPosition() { | ||
return position; | ||
} | ||
|
||
/** | ||
* Sets the completion position | ||
* | ||
* @param position the completion position | ||
*/ | ||
public void setPosition(Position position) { | ||
this.position = position; | ||
} | ||
|
||
public List<JavaSnippetContext> getContexts() { | ||
return contexts; | ||
} | ||
|
||
public void setContexts(List<JavaSnippetContext> contexts) { | ||
this.contexts = contexts; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
....core/src/main/java/com/redhat/microprofile/commons/MicroProfileJavaCompletionResult.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 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.microprofile.commons; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* MicroProfile Java completion result. | ||
* | ||
* @author Angelo ZERR | ||
* | ||
*/ | ||
public class MicroProfileJavaCompletionResult { | ||
|
||
private List<Boolean> resolvedContexts; | ||
|
||
public List<Boolean> getResolvedContexts() { | ||
return resolvedContexts; | ||
} | ||
|
||
public void setResolvedContexts(List<Boolean> resolvedContexts) { | ||
this.resolvedContexts = resolvedContexts; | ||
} | ||
} |
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.