-
Notifications
You must be signed in to change notification settings - Fork 149
feat: add Beta support for Inline Completion Request #886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rubenporras
wants to merge
5
commits into
eclipse-lsp4j:main
Choose a base branch
from
rubenporras:Inline_Completion_Request
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b196f8b
feat: add Beta support for Inline Completion Request
rubenporras 99884c7
address comments
rubenporras 9876327
Add a Beta annotation to avoid a dependency on Guava
rubenporras d61fd0a
address new review comments
rubenporras 2213918
address comments
rubenporras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
org.eclipse.lsp4j.jsonrpc/src/main/java/org/eclipse/lsp4j/jsonrpc/Beta.java
This file contains hidden or 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,45 @@ | ||
/* | ||
* Copyright (C) 2010 The Guava Authors and others | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package org.eclipse.lsp4j.jsonrpc; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Signifies that a public API (public class, method or field) is subject to incompatible changes, | ||
* or even removal, in a future release. An API bearing this annotation is exempt from any | ||
* compatibility guarantees made by its containing library. Note that the presence of this | ||
* annotation implies nothing about the quality or performance of the API in question, only the fact | ||
* that it is not "API-frozen." | ||
* | ||
* <p>It is generally safe for <i>applications</i> to depend on beta APIs, at the cost of some extra | ||
* work during upgrades. However it is generally inadvisable for <i>libraries</i> (which get | ||
* included on users' CLASSPATHs, outside the library developers' control) to do so. | ||
* | ||
* @author Kevin Bourrillion | ||
*/ | ||
@Retention(RetentionPolicy.CLASS) | ||
@Target({ | ||
ElementType.ANNOTATION_TYPE, | ||
ElementType.CONSTRUCTOR, | ||
ElementType.FIELD, | ||
ElementType.METHOD, | ||
ElementType.TYPE | ||
}) | ||
@Documented | ||
public @interface Beta {} |
52 changes: 52 additions & 0 deletions
52
org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/InlineCompletionTriggerKind.java
This file contains hidden or 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) 2025 Avaloq Group AG. | ||
* | ||
* 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 Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
******************************************************************************/ | ||
package org.eclipse.lsp4j; | ||
|
||
import org.eclipse.lsp4j.jsonrpc.Beta; | ||
|
||
/** | ||
* Describes how an {@link InlineCompletionItem} was triggered. | ||
rubenporras marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* <p> | ||
* @since 3.18.0 | ||
*/ | ||
@Beta | ||
public enum InlineCompletionTriggerKind { | ||
/** | ||
* Completion was triggered explicitly by a user gesture. Return multiple | ||
* completion items to enable cycling through them. | ||
*/ | ||
Invoked(1), | ||
|
||
/** | ||
* Completion was triggered automatically while editing. It is sufficient to | ||
* return a single completion item in this case. | ||
*/ | ||
Automatic(2); | ||
|
||
private final int value; | ||
|
||
InlineCompletionTriggerKind(final int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public static InlineCompletionTriggerKind forValue(final int value) { | ||
InlineCompletionTriggerKind[] allValues = InlineCompletionTriggerKind.values(); | ||
if (value < 1 || value > allValues.length) { | ||
throw new IllegalArgumentException("Illegal enum value: " + value); | ||
} | ||
return allValues[value - 1]; | ||
} | ||
} |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonahgraham I'd like to solicit your input on this idea of having our own
Beta
annotation, and its proposed implementation. In its current form it has been copied from Guava. Does it necessitate a separate IP review for this PR? In that case, I'd probably prefer to define a similar annotation from scratch.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is correct.
I have just removed the
@GwtCompatible
annotation and adapted the copyright to add and othres.I could start from zero if needed, but other than having a different javadoc, there is not much room for deviating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the question is whether a review from the Eclipse IP Team would be required because of that and if so, whether it would be more straightforward if we could do without the elaborate Javadoc and make our own annotation from scratch instead.