Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Sep 29, 2024
1 parent ee91c07 commit 411236f
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
import com.python.pydev.analysis.refactoring.tdd.NullPyCreateAction;
import com.python.pydev.analysis.refactoring.tdd.PyCreateClass;
import com.python.pydev.analysis.refactoring.tdd.PyCreateMethodOrField;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInInexistentModule;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule;

/**
* This participant will add a suggestion to create class/methods/attributes when an undefined variable error is found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateClassOrMethodOrField;
import com.python.pydev.analysis.refactoring.tdd.TddCodeGenerationQuickFixWithoutMarkersParticipant;
import com.python.pydev.analysis.refactoring.tdd.TemplateInfo;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule;

/**
* @author Fabio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import com.python.pydev.analysis.refactoring.refactorer.Refactorer;
import com.python.pydev.analysis.refactoring.tdd.TddCodeGenerationQuickFixWithoutMarkersParticipant;
import com.python.pydev.analysis.refactoring.tdd.TemplateInfo;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule;

/**
* @author Fabio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,18 @@ ICompletionProposalHandle createMoveImportsToLocalCompletionProposal(

ShellId getCythonShellId();

ICompletionProposalHandle createTddRefactorCompletion(String markerContents, IImageHandle iImageHandle,
String displayString, Object object, Object object2, int priorityCreate, IPyEdit edit,
int locationStrategyBeforeCurrent, List<String> parametersAfterCall,
/*PyCreateMethodOrField*/ Object pyCreateMethod,
ICompletionProposalHandle createTddRefactorCompletion(String replacementString, IImageHandle image,
String displayString,
/*IContextInformation*/Object contextInformation, String additionalProposalInfo, int priority, IPyEdit edit,
int locationStrategy, List<String> parametersAfterCall, /*PyCreateMethodOrField*/Object pyCreateAction,
PySelection ps);

ICompletionProposalHandle createTddRefactorCompletionInModule(String string, IImageHandle iImageHandle,
String displayString, Object object, String displayString2, int priorityCreate, IPyEdit edit, File file,
List<String> parametersAfterCall, /*PyCreateMethodOrField*/ Object pyCreateMethod, PySelection callPs,
int locationStrategyFirstMethod);
ICompletionProposalHandle createTddRefactorCompletionInModule(String replacementString, IImageHandle image,
String displayString,
/*IContextInformation*/ Object contextInformation, String additionalProposalInfo, int priority,
IPyEdit edit,
File module, List<String> parametersAfterCall, /*AbstractPyCreateAction*/ Object pyCreateAction,
PySelection ps,
int locationStrategy);

}
1 change: 1 addition & 0 deletions plugins/org.python.pydev/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Export-Package: com.python.pydev.actions,
com.python.pydev.analysis.ctrl_1,
com.python.pydev.analysis.indexview,
com.python.pydev.analysis.ui,
com.python.pydev.refactoring.tdd.completions,
com.python.pydev.ui.hierarchy,
org.python.copiedfromeclipsesrc,
org.python.pydev.ast.codecompletion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.refactoring.tdd.completions;

import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
import org.eclipse.jface.text.contentassist.IContextInformation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.refactoring.tdd.completions;

import java.util.List;

Expand Down Expand Up @@ -39,7 +39,7 @@ public final class TddRefactorCompletion extends AbstractTddRefactorCompletion {
private PySelection ps;
private TemplateInfo templateInfo;

TddRefactorCompletion(String replacementString, IImageHandle image, String displayString,
public TddRefactorCompletion(String replacementString, IImageHandle image, String displayString,
IContextInformation contextInformation, String additionalProposalInfo, int priority, IPyEdit edit,
int locationStrategy, List<String> parametersAfterCall, AbstractPyCreateAction pyCreateAction,
PySelection ps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.refactoring.tdd.completions;

import java.io.ByteArrayInputStream;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.tdd;
package com.python.pydev.refactoring.tdd.completions;

import java.io.File;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.python.pydev.editor.codecompletion.proposals;

import java.io.File;
import java.util.List;

import org.eclipse.jface.text.IRegion;
Expand Down Expand Up @@ -35,6 +36,10 @@
import org.python.pydev.shared_core.string.FastStringBuffer;
import org.python.pydev.shared_ui.ImageCache;

import com.python.pydev.analysis.refactoring.tdd.AbstractPyCreateAction;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletion;
import com.python.pydev.refactoring.tdd.completions.TddRefactorCompletionInModule;

public class DefaultCompletionProposalFactory implements ICompletionProposalFactory {

@Override
Expand Down Expand Up @@ -273,4 +278,31 @@ public ICompletionProposalHandle createMoveImportsToLocalCompletionProposal(Obje
importHandleInfo, iImageHandle, displayString);
}

@Override
public ICompletionProposalHandle createTddRefactorCompletion(String replacementString, IImageHandle image,
String displayString,
/*IContextInformation*/ Object contextInformation, String additionalProposalInfo, int priority,
IPyEdit edit,
int locationStrategy, List<String> parametersAfterCall, /*AbstractPyCreateAction*/ Object pyCreateAction,
PySelection ps) {
return new TddRefactorCompletion(replacementString, image, displayString,
(IContextInformation) contextInformation, additionalProposalInfo,
priority, edit, locationStrategy, parametersAfterCall, (AbstractPyCreateAction) pyCreateAction, ps);
}

@Override
public ICompletionProposalHandle createTddRefactorCompletionInModule(String replacementString, IImageHandle image,
String displayString,
/*IContextInformation*/ Object contextInformation, String additionalProposalInfo, int priority,
IPyEdit edit,
File module, List<String> parametersAfterCall, /*AbstractPyCreateAction*/ Object pyCreateAction,
PySelection ps,
int locationStrategy) {
return new TddRefactorCompletionInModule(replacementString, image, displayString,
(IContextInformation) contextInformation,
additionalProposalInfo, priority, edit, module, parametersAfterCall,
(AbstractPyCreateAction) pyCreateAction, ps,
locationStrategy);
}

}

0 comments on commit 411236f

Please sign in to comment.