8178013: Finetuning of merged tab and shift tab completion
authorjlahoda
Thu, 06 Apr 2017 11:55:58 +0200
changeset 44569 b1accf8b2aed
parent 44568 3d870d326626
child 44570 7fec4e13a5cf
8178013: Finetuning of merged tab and shift tab completion Summary: Fixing mistakes in localization bundle, fixing completion after /help set. Reviewed-by: rfield
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties
langtools/test/jdk/jshell/CommandCompletionTest.java
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Wed Apr 05 14:34:15 2017 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Apr 06 11:55:58 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1440,7 +1440,7 @@
                                 : c.command) + " ")
                         .toArray(String[]::new))
                         .completionSuggestions(code, cursor, anchor);
-            } else if (code.startsWith("/se")) {
+            } else if (code.startsWith("/se") || code.startsWith("se")) {
                 result = new FixedCompletionProvider(SET_SUBCOMMANDS)
                         .completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor);
             } else {
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Wed Apr 05 14:34:15 2017 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Apr 06 11:55:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -500,11 +500,11 @@
 Shift-<tab> v\n\t\t\
         After a complete expression, hold down <shift> while pressing <tab>,\n\t\t\
         then release and press "v", the expression will be converted to\n\t\t\
-        a variable declaration whose type is based on the type of the expression.\n\t\t\
+        a variable declaration whose type is based on the type of the expression.\n\n\
 Shift-<tab> i\n\t\t\
         After an unresolvable identifier, hold down <shift> while pressing <tab>,\n\t\t\
         then release and press "i", and jshell will propose possible imports\n\t\t\
-        which will resolve the identifier based on the content of the specified classpath.\n\t\t\
+        which will resolve the identifier based on the content of the specified classpath.
 
 help.context.summary = the evaluation context options for /env /reload and /reset
 help.context =\
@@ -928,5 +928,5 @@
 /set format silent display ''    \n
 
 jshell.fix.wrong.shortcut =\
-Invalid <fix> character.  Use "i" for auto-import or "v" for variable creation.  For more information see:\n\
+Unexpected character after Shift-Tab.  Use "i" for auto-import or "v" for variable creation.  For more information see:\n\
    /help shortcuts
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Wed Apr 05 14:34:15 2017 +0530
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Thu Apr 06 11:55:58 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8144095 8164825 8169818 8153402 8165405 8177079
+ * @bug 8144095 8164825 8169818 8153402 8165405 8177079 8178013
  * @summary Test Command Completion
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -173,6 +173,8 @@
                 "/save ", "/set "),
                 a -> assertCompletion(a, "/help /set |", false,
                 "editor", "feedback", "format", "mode", "prompt", "start", "truncation"),
+                a -> assertCompletion(a, "/help set |", false,
+                "editor", "feedback", "format", "mode", "prompt", "start", "truncation"),
                 a -> assertCompletion(a, "/help /edit |", false),
                 a -> assertCompletion(a, "/help dr|", false,
                 "drop ")