Package org.fife.rsta.ac.perl
Class PerlCompletionProvider
java.lang.Object
org.fife.ui.autocomplete.CompletionProviderBase
org.fife.ui.autocomplete.LanguageAwareCompletionProvider
org.fife.rsta.ac.c.CCompletionProvider
org.fife.rsta.ac.perl.PerlCompletionProvider
- All Implemented Interfaces:
org.fife.ui.autocomplete.CompletionProvider,org.fife.ui.rtextarea.ToolTipSupplier
A completion provider for Perl. It provides:
- Auto-completion for standard Perl 5.10 functions (read from an XML file).
- Crude auto-completion for variables. Only variables in scope at the current caret position are suggested, but there may still be issues with variable types, etc.
setUseParensWithFunctions(boolean) method.- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA comparator that compares the input text of twoCompletions lexicographically, ignoring case. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFields inherited from class org.fife.ui.autocomplete.CompletionProviderBase
EMPTY_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddShorthandCompletions(org.fife.ui.autocomplete.DefaultCompletionProvider codeCP) Adds shorthand completions to the code completion provider.private CodeBlockcreateAst(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea) Creates an "AST" for Perl code, representing code blocks and variables inside those blocks.protected org.fife.ui.autocomplete.CompletionProviderReturns the provider to use when editing code.protected org.fife.ui.autocomplete.CompletionProviderReturns the completion provider to use when the caret is in a string.protected List<org.fife.ui.autocomplete.Completion> charOverridden to return the null char (meaning "no end character") if the user doesn't want to use parens around their functions.charOverridden to return the null char (meaning "no start character") if the user doesn't want to use parens around their functions.booleanReturns whether the user wants to use parens around parameters to functions.private SortedSet<org.fife.ui.autocomplete.Completion> Does a crude search for variables up to the caret position.protected StringReturns the name of the XML resource to load (on classpath or a file).private voidparseCodeBlock(TokenScanner scanner, CodeBlock block) Recursively adds code blocks, remembering variables in them.private voidrecursivelyAddLocalVars(SortedSet<org.fife.ui.autocomplete.Completion> completions, CodeBlock block, int dot, int firstChar) Recursively adds any local variables defined before the given caret offset, and in the given code block (and any nested children the caret is in).voidsetUseParensWithFunctions(boolean use) Sets whether the user wants to use parens around parameters to functions.Methods inherited from class org.fife.rsta.ac.c.CCompletionProvider
createCommentCompletionProvider, loadCodeCompletionsFromXmlMethods inherited from class org.fife.ui.autocomplete.LanguageAwareCompletionProvider
clearParameterizedCompletionParams, getAlreadyEnteredText, getCommentCompletionProvider, getCompletionsAt, getDefaultCompletionProvider, getDocCommentCompletionProvider, getParameterizedCompletions, getParameterListSeparator, getStringCompletionProvider, getToolTipText, isAutoActivateOkay, setCommentCompletionProvider, setDefaultCompletionProvider, setDocCommentCompletionProvider, setParameterizedCompletionParams, setStringCompletionProviderMethods inherited from class org.fife.ui.autocomplete.CompletionProviderBase
getCompletions, getListCellRenderer, getParameterChoicesProvider, getParent, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParent
-
Field Details
-
useParensWithFunctions
private boolean useParensWithFunctions -
comparator
-
-
Constructor Details
-
PerlCompletionProvider
public PerlCompletionProvider()
-
-
Method Details
-
addShorthandCompletions
protected void addShorthandCompletions(org.fife.ui.autocomplete.DefaultCompletionProvider codeCP) Description copied from class:CCompletionProviderAdds shorthand completions to the code completion provider.- Overrides:
addShorthandCompletionsin classCCompletionProvider- Parameters:
codeCP- The code completion provider.
-
createAst
Creates an "AST" for Perl code, representing code blocks and variables inside those blocks.- Parameters:
textArea- The text area.- Returns:
- A "code block" representing the entire Perl source file.
-
createCodeCompletionProvider
protected org.fife.ui.autocomplete.CompletionProvider createCodeCompletionProvider()Description copied from class:CCompletionProviderReturns the provider to use when editing code.- Overrides:
createCodeCompletionProviderin classCCompletionProvider- Returns:
- The provider.
- See Also:
-
createStringCompletionProvider
protected org.fife.ui.autocomplete.CompletionProvider createStringCompletionProvider()Description copied from class:CCompletionProviderReturns the completion provider to use when the caret is in a string.- Overrides:
createStringCompletionProviderin classCCompletionProvider- Returns:
- The provider.
- See Also:
-
getCompletionsImpl
- Overrides:
getCompletionsImplin classorg.fife.ui.autocomplete.LanguageAwareCompletionProvider
-
getParameterListEnd
public char getParameterListEnd()Overridden to return the null char (meaning "no end character") if the user doesn't want to use parens around their functions.- Specified by:
getParameterListEndin interfaceorg.fife.ui.autocomplete.CompletionProvider- Overrides:
getParameterListEndin classorg.fife.ui.autocomplete.LanguageAwareCompletionProvider- Returns:
- The end character for parameters list, or the null char if none.
- See Also:
-
getParameterListStart
public char getParameterListStart()Overridden to return the null char (meaning "no start character") if the user doesn't want to use parens around their functions.- Specified by:
getParameterListStartin interfaceorg.fife.ui.autocomplete.CompletionProvider- Overrides:
getParameterListStartin classorg.fife.ui.autocomplete.LanguageAwareCompletionProvider- Returns:
- The start character for parameters list, or the null char if none.
- See Also:
-
getUseParensWithFunctions
public boolean getUseParensWithFunctions()Returns whether the user wants to use parens around parameters to functions.- Returns:
- Whether to use parens around parameters to functions.
- See Also:
-
getVariableCompletions
Does a crude search for variables up to the caret position. This method does not care whether the variables are in scope at the caret position.- Parameters:
comp- The text area.- Returns:
- The completions for variables, or
nullif there were none.
-
getXmlResource
Description copied from class:CCompletionProviderReturns the name of the XML resource to load (on classpath or a file).- Overrides:
getXmlResourcein classCCompletionProvider- Returns:
- The resource to load.
-
parseCodeBlock
Recursively adds code blocks, remembering variables in them.- Parameters:
scanner- The scanner to read from.block- The code block update.
-
recursivelyAddLocalVars
private void recursivelyAddLocalVars(SortedSet<org.fife.ui.autocomplete.Completion> completions, CodeBlock block, int dot, int firstChar) Recursively adds any local variables defined before the given caret offset, and in the given code block (and any nested children the caret is in).- Parameters:
completions- The list to add to.block- The code block to search through.dot- The caret position.
-
setUseParensWithFunctions
public void setUseParensWithFunctions(boolean use) Sets whether the user wants to use parens around parameters to functions.- Parameters:
use- Whether to use parens around parameters to functions.- See Also:
-