-
Notifications
You must be signed in to change notification settings - Fork 38
feat - support readDirectory for ADT #18
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3e7c5f9
add read directory
xinyi-gong f08f04e
add file header
xinyi-gong 9c9cb63
resolve comments
xinyi-gong 359e36f
resolve comment
xinyi-gong a618a55
resolve comments
xinyi-gong fecb74e
remove comment reference
xinyi-gong 97fa170
Merge branch 'main' of https://github.com/microsoft/copilot-for-eclip…
xinyi-gong 9ec8f92
fix checkstyle
xinyi-gong 5eb2db9
support platform:/ format
xinyi-gong 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
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
135 changes: 135 additions & 0 deletions
135
...eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ReadDirectoryResult.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,135 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package com.microsoft.copilot.eclipse.core.lsp.protocol; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||
|
|
||
| /** | ||
| * Result of reading a directory, containing the directory entries. | ||
| */ | ||
| public class ReadDirectoryResult { | ||
|
|
||
| private List<DirectoryEntry> entries; | ||
|
|
||
| /** | ||
| * Constructor with entries. | ||
| * | ||
| * @param entries the directory entries | ||
| */ | ||
| public ReadDirectoryResult(List<DirectoryEntry> entries) { | ||
| this.entries = entries; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the directory entries. | ||
| * | ||
| * @return the directory entries | ||
| */ | ||
| public List<DirectoryEntry> getEntries() { | ||
| return entries; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the directory entries. | ||
| * | ||
| * @param entries the directory entries | ||
| */ | ||
| public void setEntries(List<DirectoryEntry> entries) { | ||
| this.entries = entries; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(entries); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null || getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| ReadDirectoryResult other = (ReadDirectoryResult) obj; | ||
| return Objects.equals(entries, other.entries); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return new ToStringBuilder(this).append("entries", entries).toString(); | ||
| } | ||
|
|
||
| /** | ||
| * A single directory entry with name and file type. | ||
| */ | ||
| public static class DirectoryEntry { | ||
|
|
||
| /** VS Code FileType constants. */ | ||
| public static final int FILE_TYPE_UNKNOWN = 0; | ||
| public static final int FILE_TYPE_FILE = 1; | ||
| public static final int FILE_TYPE_DIRECTORY = 2; | ||
|
|
||
| private String name; | ||
| private int type; | ||
|
|
||
| /** | ||
| * Constructor with name and type. | ||
| * | ||
| * @param name the entry name | ||
| * @param type the file type (0=Unknown, 1=File, 2=Directory) | ||
| */ | ||
| public DirectoryEntry(String name, int type) { | ||
| this.name = name; | ||
| this.type = type; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the entry name. | ||
| */ | ||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the file type. | ||
| */ | ||
| public int getType() { | ||
| return type; | ||
| } | ||
|
|
||
| public void setType(int type) { | ||
| this.type = type; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(name, type); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null || getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| DirectoryEntry other = (DirectoryEntry) obj; | ||
| return Objects.equals(name, other.name) && type == other.type; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return new ToStringBuilder(this).append("name", name).append("type", type).toString(); | ||
| } | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.