mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-56182
This commit is contained in:
+6
@@ -27,9 +27,11 @@ import com.intellij.codeInsight.template.CustomLiveTemplate;
|
||||
import com.intellij.codeInsight.template.CustomLiveTemplateBase;
|
||||
import com.intellij.codeInsight.template.CustomTemplateCallback;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.diagnostic.AttachmentFactory;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
@@ -79,6 +81,10 @@ public class ListTemplatesHandler implements CodeInsightActionHandler {
|
||||
|
||||
public static Map<TemplateImpl, String> filterTemplatesByPrefix(@NotNull Collection<TemplateImpl> templates, @NotNull Editor editor,
|
||||
int offset, boolean fullMatch, boolean searchInDescription) {
|
||||
if (offset >= editor.getDocument().getTextLength()) {
|
||||
Logger.getInstance(ListTemplatesHandler.class).error("Cannot filter templates, index out of bounds. Offset: " + offset,
|
||||
AttachmentFactory.createAttachment(editor.getDocument()));
|
||||
}
|
||||
CharSequence documentText = editor.getDocument().getCharsSequence().subSequence(0, offset);
|
||||
|
||||
String prefixWithoutDots = computeDescriptionMatchingPrefix(editor.getDocument(), offset);
|
||||
|
||||
+2
-2
@@ -65,9 +65,9 @@ public class LiveTemplateCompletionContributor extends CompletionContributor {
|
||||
return;
|
||||
}
|
||||
|
||||
int offset = parameters.getOffset();
|
||||
final List<TemplateImpl> availableTemplates = TemplateManagerImpl.listApplicableTemplates(file, offset, false);
|
||||
Editor editor = parameters.getEditor();
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
final List<TemplateImpl> availableTemplates = TemplateManagerImpl.listApplicableTemplates(file, offset, false);
|
||||
final Map<TemplateImpl, String> templates = filterTemplatesByPrefix(availableTemplates, editor, offset, false, false);
|
||||
if (showAllTemplates()) {
|
||||
final AtomicBoolean templatesShown = new AtomicBoolean(false);
|
||||
|
||||
Reference in New Issue
Block a user