public class PythonLanguageService extends java.lang.Object implements ICompletionService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LANGUAGE_NAME
The language name.
|
protected org.apache.log4j.Logger |
logger
The logger.
|
protected java.util.HashMap<java.lang.String,java.util.ArrayList<CompletionProposal>> |
specialCases
The special cases.
|
Constructor and Description |
---|
PythonLanguageService()
Instantiates a new python language service.
|
Modifier and Type | Method and Description |
---|---|
CompletionResult |
getProposals(java.lang.String document,
java.lang.String curSelection)
Gets the proposals.
|
private int |
isDeclared(java.lang.String doc,
java.lang.String selection)
Determines if the selection refers to an object declared
somewhere else in the script and returns the line number of the
declaration or -1 if not found.
|
private int |
isImport(java.lang.String doc,
java.lang.String selection)
Determines if the selection refers to either a class or module which
is imported and returns the line number of the import.
|
private boolean |
isSpecialCase(java.lang.String declaraction,
CompletionResult result)
Determines if the variable declaration is a special case
existing in the specialCases HashMap and, if so, appends the
List of CompletionPropals to the result making it ready to
return.
|
private java.util.ArrayList<CompletionProposal> |
parseScriptOutput(ScriptResultObject sro,
CompletionResult result)
Internal method for parsing the output of the jython script.
|
private java.lang.String |
prepareScript(java.lang.String document,
java.lang.String selection,
CompletionResult result)
Internal method used to prepare the jython script which returns introspection
information about the module, class, list, dictionary, or string object.
|
public static java.lang.String LANGUAGE_NAME
protected org.apache.log4j.Logger logger
protected java.util.HashMap<java.lang.String,java.util.ArrayList<CompletionProposal>> specialCases
public PythonLanguageService()
public CompletionResult getProposals(java.lang.String document, java.lang.String curSelection)
ICompletionService
getProposals
in interface ICompletionService
document
- the documentcurSelection
- the cur selectionprivate java.lang.String prepareScript(java.lang.String document, java.lang.String selection, CompletionResult result)
document
- the documentselection
- the selectionresult
- the resultprivate java.util.ArrayList<CompletionProposal> parseScriptOutput(ScriptResultObject sro, CompletionResult result)
sro
- result of running the jython scriptresult
- the resultprivate int isImport(java.lang.String doc, java.lang.String selection)
doc
- whole scriptselection
- selected text to run info onprivate int isDeclared(java.lang.String doc, java.lang.String selection)
doc
- whole scriptselection
- selected text to run info onprivate boolean isSpecialCase(java.lang.String declaraction, CompletionResult result)
declaraction
- python variable declarationresult
- the result