Repository: groovy
Updated Branches:
  refs/heads/master 219447d0b -> e1f63023f


GROOVY-7739: Groovsh code-completion should display groovy jdk enhancements of 
java.io.file


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e1f63023
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e1f63023
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e1f63023

Branch: refs/heads/master
Commit: e1f63023fd4d242065e9206dea9682547c3b4c2a
Parents: 219447d
Author: pascalschumacher <[email protected]>
Authored: Fri Jan 29 21:00:31 2016 +0100
Committer: pascalschumacher <[email protected]>
Committed: Fri Jan 29 21:04:51 2016 +0100

----------------------------------------------------------------------
 .../shell/completion/ReflectionCompletor.groovy | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e1f63023/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 4af4889..86ef981 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
@@ -475,6 +475,23 @@ class ReflectionCompletor {
                     'take(', 'takeWhile('
             ].findAll({it.startsWith(prefix)}).each({candidates.add(it)})
         }
+        if (instance instanceof File) {
+            [
+                    'append(',
+                    'createTempDir(',
+                    'deleteDir()', 'directorySize()',
+                    'eachByte(', 'eachDir(', 'eachDirMatch(', 
'eachDirRecurse(', 'eachFile(', 'eachFileMatch(', 'eachFileRecurse(',
+                    'eachLine(', 'eachObject(',
+                    'filterLine(',
+                    'getBytes()', 'getText()',
+                    'leftShift(',
+                    'newInputStream()', 'newOutputStream()', 
'newPrintWriter(', 'newReader(', 'newWriter(',
+                    'readBytes()', 'readLines(', 'renameTo(',
+                    'setBytes(', 'setText(', 'size()', 'splitEachLine(',
+                    'traverse(',
+                    'withInputStream(', 'withOutputStream(', 
'withPrintWriter(', 'withReader(', 'withWriter(', 'withWriterAppend(', 'write('
+            ].findAll({it.startsWith(prefix)}).each({candidates.add(it)})
+        }
         if (instance instanceof Number) {
             [
                     'abs()',
@@ -510,10 +527,6 @@ class ReflectionCompletor {
         return candidates
     }
 
-
-
-
-
     private static Collection<ReflectionCompletionCandidate> 
addClassFieldsAndMethods(final Class clazz,
                                                                             
final boolean includeStatic,
                                                                             
final boolean includeNonStatic,

Reply via email to