Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@
</module>
<module name="JavadocMethod">
<property name="accessModifiers" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowMissingParamTags" value="false"/>
<property name="allowMissingReturnTag" value="false"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public AuthStatusManager(CopilotLanguageServerConnection connection) {
/**
* Initiate the sign in process.
*
* @return the sign-in initiation result from the language server.
* @throws ExecutionException if the sign in initiate process fails due to an execution error
* @throws InterruptedException if the sign in initiate process is interrupted
*/
Expand All @@ -67,6 +68,8 @@ public SignInInitiateResult signInInitiate() throws InterruptedException, Execut
/**
* Confirm the sign in process.
*
* @param userCode the user code returned by the sign-in initiation.
* @return the updated Copilot status result after sign-in confirmation.
* @throws ExecutionException if the sign in process fails due to an execution error
* @throws InterruptedException if the sign in process is interrupted
*/
Expand All @@ -85,6 +88,7 @@ public CopilotStatusResult signInConfirm(String userCode) throws InterruptedExce
/**
* Sign out from the GitHub Copilot.
*
* @return the updated Copilot status result after signing out.
* @throws ExecutionException if the sign out process fails due to an execution error
* @throws InterruptedException if the sign out process is interrupted
*/
Expand All @@ -97,6 +101,9 @@ public CopilotStatusResult signOut() throws InterruptedException, ExecutionExcep

/**
* Set the CopilotStatusResult string to the given status and notify the listeners.
*
* @param newCopilotStatusResult the new Copilot status value.
* @return the updated Copilot status result.
*/
public CopilotStatusResult setCopilotStatus(String newCopilotStatusResult) {
if (!Objects.equals(this.copilotStatusResult.getStatus(), newCopilotStatusResult)) {
Expand Down Expand Up @@ -142,13 +149,17 @@ public CompletableFuture<CheckQuotaResult> checkQuota() {

/**
* Set the user for Copilot.
*
* @param user the Copilot user name to set.
*/
public void setCopilotUser(String user) {
this.copilotStatusResult.setUser(user);
}

/**
* Get the current status of the copilot.
*
* @return the current Copilot status.
*/
public String getCopilotStatus() {
if (this.copilotStatusResult == null) {
Expand All @@ -159,6 +170,8 @@ public String getCopilotStatus() {

/**
* Get the name of the login user.
*
* @return the name of the signed-in user, or an empty string if no user is available.
*/
public String getUserName() {
if (this.copilotStatusResult == null) {
Expand All @@ -172,13 +185,17 @@ public String getUserName() {

/**
* Set the CheckQuotaResult.
*
* @param checkQuotaResult the quota status result to set.
*/
public void setQuotaStatus(CheckQuotaResult checkQuotaResult) {
this.checkQuotaResult = checkQuotaResult;
}

/**
* Get the current CopilotStatusResult.
*
* @return the current quota status result.
*/
public CheckQuotaResult getQuotaStatus() {
if (this.checkQuotaResult == null) {
Expand All @@ -189,13 +206,17 @@ public CheckQuotaResult getQuotaStatus() {

/**
* Add a listener for the authentication status.
*
* @param listener the listener to add.
*/
public void addCopilotAuthStatusListener(CopilotAuthStatusListener listener) {
this.copilotAuthStatusListeners.add(listener);
}

/**
* Remove the listener for the authentication status.
*
* @param listener the listener to remove.
*/
public void removeCopilotAuthStatusListener(CopilotAuthStatusListener listener) {
this.copilotAuthStatusListeners.remove(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface CopilotAuthStatusListener {

/**
* Notifies to the listeners when the authentication status is changed.
*
* @param copilotStatusResult the updated Copilot status result.
*/
void onDidCopilotStatusChange(CopilotStatusResult copilotStatusResult);
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public CompletionProvider getCompletionProvider() {

/**
* Get the next edit suggestion provider in lazy-load manner.
*
* @return the next edit suggestion provider.
*/
public NextEditSuggestionProvider getNextEditSuggestionProvider() {
if (this.nextEditSuggestionProvider == null) {
Expand All @@ -170,6 +172,8 @@ public FeatureFlags getFeatureFlags() {

/**
* Get the format option provider in lazy-load manner.
*
* @return the format option provider.
*/
public FormatOptionProvider getFormatOptionProvider() {
if (this.formatOptionProvider == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,26 @@ public ChatEventsManager() {

/**
* Add a listener to the chat progress provider.
*
* @param listener the listener to add.
*/
public void addChatProgressListener(ChatProgressListener listener) {
this.chatProgressListeners.add(listener);
}

/**
* Remove a listener from the chat progress provider.
*
* @param listener the listener to remove.
*/
public void removeChatProgressListener(ChatProgressListener listener) {
this.chatProgressListeners.remove(listener);
}

/**
* Notify the progress to the listeners.
*
* @param message the progress message to notify.
*/
public void notifyProgress(ChatProgressValue message) {
for (ChatProgressListener listener : this.chatProgressListeners) {
Expand Down Expand Up @@ -79,6 +85,7 @@ public void unregisterAgentToolListener(ToolInvocationListener listener) {
* Notify the listeners when the agent tool should be confirmed.
*
* @param params the parameters for the tool confirmation
* @return a future containing the tool confirmation result.
*/
public CompletableFuture<LanguageModelToolConfirmationResult> confirmAgentToolInvocation(
InvokeClientToolConfirmationParams params) {
Expand All @@ -93,6 +100,7 @@ public CompletableFuture<LanguageModelToolConfirmationResult> confirmAgentToolIn
* Notify the listeners when the agent tool should be invoked.
*
* @param params the parameters for the tool invocation
* @return a future containing the tool invocation results.
*/
public CompletableFuture<LanguageModelToolResult[]> invokeAgentTool(InvokeClientToolParams params) {
if (this.agentToolListener == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
public interface ChatProgressListener {
/**
* Notifies to the listeners when the chat is resolved.
*
* @param progress the chat progress value.
*/
public void onChatProgress(ChatProgressValue progress);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,23 @@ public boolean isPrimary() {
return primary;
}

/** Creates a primary accept action (scope = ONCE). */
/**
* Creates a primary accept action (scope = ONCE).
*
* @param label the button label.
* @return the primary accept confirmation action.
*/
public static ConfirmationAction allowOnce(String label) {
return new ConfirmationAction(label, true,
ConfirmationActionScope.ONCE, null, true);
}

/** Creates a dismiss action. */
/**
* Creates a dismiss action.
*
* @param label the button label.
* @return the dismiss confirmation action.
*/
public static ConfirmationAction skip(String label) {
return new ConfirmationAction(label, false, null, null, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ private ConfirmationResult(boolean autoApproved, boolean dismissed, Confirmation
this.content = content;
}

/** Creates a result that requires user confirmation with the given content. */
/**
* Creates a result that requires user confirmation with the given content.
*
* @param content the confirmation content to show.
* @return the confirmation result requiring user confirmation.
*/
public static ConfirmationResult needsConfirmation(
ConfirmationContent content) {
return new ConfirmationResult(false, false, content);
Expand All @@ -39,12 +44,20 @@ public boolean isAutoApproved() {
return autoApproved;
}

/** Returns true if the request should be dismissed without showing UI. */
/**
* Returns true if the request should be dismissed without showing UI.
*
* @return true if the request should be dismissed without showing UI.
*/
public boolean isDismissed() {
return dismissed;
}

/** Returns the confirmation content, or null if auto-approved or using defaults. */
/**
* Returns the confirmation content, or null if auto-approved or using defaults.
*
* @return the confirmation content, or null if auto-approved or using defaults.
*/
public ConfirmationContent getContent() {
return content;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public List<String> getInputHistoryList() {

/**
* Add a new input to the history and update the cursor.
*
* @param input the input text to add.
*/
public void add(String input) {
if (StringUtils.isBlank(input) || Objects.equals(input, getLatestInput())) {
Expand All @@ -66,6 +68,8 @@ public void add(String input) {

/**
* Navigate to the last input in the history.
*
* @return the previous input in the history, or an empty string if unavailable.
*/
public String navigateUp() {
if (inputHistory.isEmpty() || atTop()) {
Expand All @@ -79,6 +83,8 @@ public String navigateUp() {

/**
* Navigate to the next input in the history.
*
* @return the next input in the history, or an empty string if unavailable.
*/
public String navigateDown() {
if (inputHistory.isEmpty() || atBottom()) {
Expand All @@ -92,20 +98,26 @@ public String navigateDown() {

/**
* Check if the current position is at the bottom(latest) of the history.
*
* @return true if the current position is at the bottom of the history.
*/
public boolean atBottom() {
return inputHistory.isEmpty() || currentPosition == inputHistory.size();
}

/**
* Check if the current position is at the top(oldest) of the history.
*
* @return true if the current position is at the top of the history.
*/
public boolean atTop() {
return inputHistory.isEmpty() || currentPosition == 0;
}

/**
* Get the latest input from the history.
*
* @return the latest input, or an empty string if the history is empty.
*/
public String getLatestInput() {
if (inputHistory.isEmpty()) {
Expand All @@ -116,13 +128,17 @@ public String getLatestInput() {

/**
* Get the size of the input history.
*
* @return the number of inputs in the history.
*/
public int size() {
return inputHistory.size();
}

/**
* Update the current cursor position in the input history.
*
* @param position the new cursor position.
*/
public void updateCursorPosition(int position) {
if (position < 0 || position > inputHistory.size()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class BuiltInChatModeService {
*
* <p>Note: The LSP requires workspace folders to be passed even for loading built-in modes. While built-in modes
* don't depend on workspace context, the LSP API enforces this parameter.
*
* @return a future containing the loaded built-in chat modes.
*/
public CompletableFuture<List<BuiltInChatMode>> loadBuiltInModes() {
ConversationModesParams params = new ConversationModesParams(Collections.emptyList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ public interface IChatServiceManager {

/**
* Get the referenced file service.
*
* @return the referenced file service.
*/
IReferencedFileService getReferencedFileService();

/**
* Get the MCP config service.
*
* @return the MCP config service.
*/
IMcpConfigService getMcpConfigService();

/**
* Get the customization file service tracking skill/prompt/instruction/agent file locations.
*
* @return the customization file service.
*/
ICustomizationFileService getCustomizationFileService();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ enum CustomizationType {
/**
* Returns the absolute paths of single-file customization files (prompts, instructions, agents).
* The returned set is an immutable snapshot.
*
* @return the absolute paths of single-file customization files.
*/
Set<Path> getCustomizationFiles();

/**
* Returns the absolute paths of skill folders (the directory containing each {@code SKILL.md}).
* A read of any file within one of these folders is a skill read. The returned set is an immutable
* snapshot.
*
* @return the absolute paths of skill folders.
*/
Set<Path> getSkillFolders();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
public interface IMcpConfigService {
/**
* Handles the Dynamic OAuth request from MCP servers.
*
* @param request the OAuth request from the MCP server.
* @return the OAuth response values.
*/
Map<String, String> mcpOauth(McpOauthRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
public interface IReferencedFileService {
/**
* Get the current file being referenced in the Copilot chat.
*
* @return the current referenced file.
*/
IFile getCurrentFile();

/**
* Get the referenced files that is attached by user.
*
* @return the referenced files attached by the user.
*/
List<IResource> getReferencedFiles();

Expand Down
Loading