mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
Test for import intension in kotlin project
GitOrigin-RevId: 5fc4219c54ebadebb2c2caa78db5aa90013b2ba6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
749b148159
commit
7a3982d651
@@ -3,12 +3,13 @@
|
||||
<body>
|
||||
<p>
|
||||
Simulate invocation of alt+enter and pressing item in the list defined by parameter.
|
||||
Optional: it is possible to only open pop up and check if item from pa is presented in list.
|
||||
</p>
|
||||
<p>
|
||||
Syntax: %altEnter [parameters]
|
||||
Syntax: %altEnter <item in list>(Optional)|<invoke>
|
||||
</p>
|
||||
<p>
|
||||
Example: %altEnter Find cause
|
||||
Example: %altEnter Find cause|true
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -39,7 +39,10 @@ public final class ShowAltEnter extends AbstractCommand implements Disposable {
|
||||
@Override
|
||||
protected Promise<Object> _execute(@NotNull PlaybackContext context) {
|
||||
ActionCallback actionCallback = new ActionCallbackProfilerStopper();
|
||||
final String actionName = extractCommandArgument(PREFIX);
|
||||
String extractCommandList = extractCommandArgument(PREFIX);
|
||||
String[] commandList = extractCommandList.split("\\|");
|
||||
final String actionName = commandList[0];
|
||||
final boolean invoke = (commandList.length > 1) ? Boolean.parseBoolean(commandList[1]) : true;
|
||||
ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(() -> {
|
||||
@NotNull Project project = context.getProject();
|
||||
Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
|
||||
@@ -59,10 +62,10 @@ public final class ShowAltEnter extends AbstractCommand implements Disposable {
|
||||
Optional<HighlightInfo.IntentionActionDescriptor>
|
||||
singleIntention = combined.stream().filter(s -> s.getAction().getText().startsWith(actionName)).findFirst();
|
||||
if (singleIntention.isEmpty()) actionCallback.reject(actionName + " is not found among " + combined);
|
||||
singleIntention
|
||||
if (invoke) singleIntention
|
||||
.ifPresent(c -> ShowIntentionActionsHandler.chooseActionAndInvoke(psiFile, editor, c.getAction(), c.getAction().getText()));
|
||||
}
|
||||
else {
|
||||
if (!invoke || actionName.isEmpty()) {
|
||||
CachedIntentions cachedIntentions = CachedIntentions.create(project, psiFile, editor, intentions);
|
||||
IntentionHintComponent.showIntentionHint(project, psiFile, editor, true, cachedIntentions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user