Repository: groovy Updated Branches: refs/heads/master f7be98a08 -> d6bb5b8ff
Groovsh code-completion should display Groovy JDK enhancements for URL, InputStream and OutputStream Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d6bb5b8f Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d6bb5b8f Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d6bb5b8f Branch: refs/heads/master Commit: d6bb5b8ff84b57c2c337c3db5008103b7c6d13d5 Parents: f7be98a Author: pascalschumacher <[email protected]> Authored: Sun Jan 31 19:18:33 2016 +0100 Committer: pascalschumacher <[email protected]> Committed: Sun Jan 31 19:20:11 2016 +0100 ---------------------------------------------------------------------- .../shell/completion/ReflectionCompletor.groovy | 33 ++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/d6bb5b8f/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy ---------------------------------------------------------------------- diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy index fa17ae7..001e22d 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy +++ b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy @@ -414,7 +414,7 @@ class ReflectionCompletor { /** * Offering all DefaultGroovyMethods on any object is too verbose, hiding all - * removes user-friendlyness. So here util methods will be added to candidates + * removes user-friendliness. So here util methods will be added to candidates * if the instance is of a suitable type. * This does not need to be strictly complete, only the most useful functions may appear. */ @@ -490,7 +490,7 @@ class ReflectionCompletor { 'filterLine(', 'getBytes()', 'getText()', 'getText(', 'newInputStream()', 'newOutputStream()', 'newPrintWriter()', 'newPrintWriter(', 'newReader()', 'newReader(', 'newWriter()', 'newWriter(', - 'readBytes()', 'readLines(', 'renameTo(', + 'readBytes()', 'readLines(', 'setBytes(', 'setText(', 'size()', 'splitEachLine(', 'traverse(', 'withInputStream(', 'withOutputStream(', 'withPrintWriter(', 'withReader(', 'withWriter(', 'withWriterAppend(', 'write(' @@ -512,6 +512,35 @@ class ReflectionCompletor { 'tokenize(', 'tr(' ].findAll({it.startsWith(prefix)}).each({candidates.add(it)}) } + if (instance instanceof URL) { + [ + 'eachLine(', + 'filterLine(', + 'getBytes()', 'getBytes(', 'getText()', 'getText(', + 'newInputStream()', 'newInputStream(', 'newReader()', 'newReader(', + 'readLines()', 'readLines(', + 'splitEachLine(', + 'withInputStream(', 'withReader(' + ].findAll({it.startsWith(prefix)}).each({candidates.add(it)}) + } + if (instance instanceof InputStream) { + [ + 'eachLine(', + 'filterLine(', + 'getBytes()', 'getText()', 'getText(', + 'newReader()', 'newReader(', + 'readLines()', 'readLines(', + 'splitEachLine(', + 'withReader(', 'withStream(' + ].findAll({it.startsWith(prefix)}).each({candidates.add(it)}) + } + if (instance instanceof OutputStream) { + [ + 'newPrintWriter()', 'newWriter()', 'newWriter(', + 'setBytes(', + 'withPrintWriter(', 'withStream(', 'withWriter(' + ].findAll({it.startsWith(prefix)}).each({candidates.add(it)}) + } if (instance instanceof Number) { [ 'abs()',
