Return-Path: X-Original-To: apmail-groovy-commits-archive@minotaur.apache.org Delivered-To: apmail-groovy-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 90DBD181A2 for ; Sun, 31 Jan 2016 18:19:12 +0000 (UTC) Received: (qmail 40217 invoked by uid 500); 31 Jan 2016 18:19:12 -0000 Delivered-To: apmail-groovy-commits-archive@groovy.apache.org Received: (qmail 40183 invoked by uid 500); 31 Jan 2016 18:19:12 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 40174 invoked by uid 99); 31 Jan 2016 18:19:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Jan 2016 18:19:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 32D91DFF85; Sun, 31 Jan 2016 18:19:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pascalschumacher@apache.org To: commits@groovy.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: Groovsh code-completion should display Groovy JDK enhancements for URL, InputStream and OutputStream Date: Sun, 31 Jan 2016 18:19:12 +0000 (UTC) Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X 10366b4f5 -> 7fc6977e0 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/7fc6977e Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7fc6977e Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7fc6977e Branch: refs/heads/GROOVY_2_4_X Commit: 7fc6977e0b929911e1e10546e186c21b139a3b62 Parents: 10366b4 Author: pascalschumacher Authored: Sun Jan 31 19:18:33 2016 +0100 Committer: pascalschumacher Committed: Sun Jan 31 19:19:00 2016 +0100 ---------------------------------------------------------------------- .../shell/completion/ReflectionCompletor.groovy | 33 ++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/7fc6977e/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()',