Skip to content

Commit 60afd1d

Browse files
committed
deprecate old getCompletions signature
1 parent b3d0893 commit 60afd1d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8-
## [4.2.0] - 2025-02-13
8+
## [4.2.0] - 2025-02-14
99
### Changed
1010
- Upgrade to JRuby 9.4.12.0 (Ruby 3.1.4)
1111
- Upgrade to Groovy 4.0.25
1212
- Upgrade to Kotlin 2.1.10
1313

14+
### Deprecated
15+
- `DragonPlugin.getCompletions(String cmd)` in favor of
16+
`DragonPlugin.getCompletions(String cmd, int caretPos)`. This mirrors the
17+
deprecation of the same method in
18+
`ghidra.app.plugin.core.interpreter.InterpreterConnection`.
19+
1420

1521
## [4.1.0] - 2024-11-08
1622
### Changed
@@ -34,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3440
- Warnings and `launch.properties` files for broken JRuby support in older
3541
versions of Ghidra.
3642

43+
3744
## [3.3.0] - 2024-03-28
3845
### Changed
3946
- Upgrade to JRuby 9.4.6.0 (Ruby 3.1.4)

src/main/java/com/goatshriek/rubydragon/DragonPlugin.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public abstract class DragonPlugin extends ProgramPlugin implements InterpreterC
6767
* @since 2.2.0
6868
*/
6969
public static final String OPTION_CATEGORY_NAME = "Ruby Dragon Interpreters";
70-
70+
7171
/**
7272
* The name of the plugin category used by DragonPlugins.
7373
*
@@ -197,12 +197,30 @@ public String getAutoImportOptionName() {
197197
* @param cmd The command to try to complete.
198198
*
199199
* @return A list of possible code completions.
200+
*
201+
* @deprecated Move to using {@link #getCompletions(String, int)}.
200202
*/
201-
@Override
203+
@Deprecated
202204
public List<CodeCompletion> getCompletions(String cmd) {
203205
return getInterpreter().getCompletions(cmd);
204206
}
205207

208+
/**
209+
* Gets a {@link List} of {@link CodeCompletion code completions} for the given
210+
* command relative to the given caret position.
211+
*
212+
* @param cmd The command to get code completions for
213+
* @param caretPos The position of the caret in the input string 'cmd'. It
214+
* should satisfy the constraint
215+
* {@literal "0 <= caretPos <= cmd.length()"}
216+
* @return A {@link List} of {@link CodeCompletion code completions} for the
217+
* given command
218+
*/
219+
@Override
220+
public List<CodeCompletion> getCompletions(String cmd, int caretPos) {
221+
return getInterpreter().getCompletions(cmd.substring(0, caretPos));
222+
}
223+
206224
/**
207225
* The icon for this plugin.
208226
*/

0 commit comments

Comments
 (0)