-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #453 from eclipse/javaContext
Make snippets context-aware
- Loading branch information
Showing
31 changed files
with
1,730 additions
and
162 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
76 changes: 76 additions & 0 deletions
76
...a.jdt.core/src/main/java/org/eclipse/lsp4jakarta/commons/JakartaJavaCompletionParams.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,76 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021, 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
* IBM Corporation - convert for Jakarta | ||
*******************************************************************************/ | ||
package org.eclipse.lsp4jakarta.commons; | ||
|
||
|
||
import org.eclipse.lsp4j.Position; | ||
|
||
/** | ||
* Parameters that are passed on completion trigger for MicroProfile projects in Java files | ||
* | ||
* @author datho7561 | ||
*/ | ||
public class JakartaJavaCompletionParams { | ||
|
||
private String uri; | ||
private Position position; | ||
|
||
public JakartaJavaCompletionParams() { | ||
|
||
} | ||
|
||
public JakartaJavaCompletionParams(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 hover position | ||
* | ||
* @return the hover position | ||
*/ | ||
public Position getPosition() { | ||
return position; | ||
} | ||
|
||
/** | ||
* Sets the hover position | ||
* | ||
* @param position the hover position | ||
*/ | ||
public void setPosition(Position position) { | ||
this.position = position; | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
...a.jdt.core/src/main/java/org/eclipse/lsp4jakarta/commons/JakartaJavaCompletionResult.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,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
* IBM Corporation - convert to Jakarta | ||
*******************************************************************************/ | ||
package org.eclipse.lsp4jakarta.commons; | ||
|
||
import org.eclipse.lsp4j.CompletionList; | ||
|
||
/** | ||
* Represents completion information and context calculated by the Java language server component. | ||
*/ | ||
public class JakartaJavaCompletionResult { | ||
private CompletionList completionList; | ||
private JavaCursorContextResult cursorContext; | ||
|
||
public JakartaJavaCompletionResult(CompletionList completionList, | ||
JavaCursorContextResult cursorContext) { | ||
this.completionList = completionList; | ||
this.cursorContext = cursorContext; | ||
} | ||
|
||
public JakartaJavaCompletionResult() { | ||
this(null, null); | ||
} | ||
|
||
/** | ||
* Returns the list of completion items contributed by the Java language server | ||
* component. | ||
* | ||
* @return the list of completion items contributed by the Java language server | ||
* component | ||
*/ | ||
public CompletionList getCompletionList() { | ||
return completionList; | ||
} | ||
|
||
/** | ||
* Returns information on the context of the cursor in the Java file, calculated | ||
* by the Java language server component. | ||
* | ||
* @return information on the context of the cursor in the Java file, calculated | ||
* by the Java language server component | ||
*/ | ||
public JavaCursorContextResult getCursorContext() { | ||
return cursorContext; | ||
} | ||
|
||
} |
Oops, something went wrong.