[
https://issues.apache.org/jira/browse/GROOVY-12785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18146024#comment-18146024
]
ASF GitHub Bot commented on GROOVY-12785:
-----------------------------------------
codeconsole opened a new pull request, #3310:
URL: https://github.com/apache/groovy/pull/3310
https://issues.apache.org/jira/browse/GROOVY-12785
Since GROOVY-12448, groovysh and the Groovy Console complete through the
language engine. For an unqualified name it offered keywords, snippets, locals,
the members the file's own classes declare and workspace types, but nothing the
implicit receiver inherits, so in groovysh `printl` + Tab stopped completing to
`println` (Groovy 6.0.0's groovysh completes it).
An unqualified name now also gets:
- the members the enclosing class inherits; for a script, `Script`'s
`print`, `println` and `printf`
- the extension methods for it, such as `sleep` and `sprintf`
```
groovy> printl<Tab> -> println
groovy> sle<Tab> -> sleep
groovy> prin<Tab><Tab> -> print(Object) printf(String, Object...)
println() ...
```
A script's top-level statements, which are not inside a method of the
source, use the script class. Inside a static method the class's instance
members are left out (`hashCode` is not offered), while the extension methods
still are, as they are called on the `Class` object. Names already offered are
skipped, and an unloaded class waits for two characters before the extension
catalog is searched, as completion after a dot does. An empty prefix adds
nothing.
> Completion of an unqualified name omits the implicit receiver's methods, such
> as println
> ----------------------------------------------------------------------------------------
>
> Key: GROOVY-12785
> URL: https://issues.apache.org/jira/browse/GROOVY-12785
> Project: Groovy
> Issue Type: Bug
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> Since GROOVY-12448 groovysh and the Groovy Console complete through the
> in-process language engine (groovy-lsp). For an unqualified name it offers
> keywords, snippets, locals, the members the file's own classes declare, and
> workspace types, but nothing the implicit receiver inherits or gains from
> extension methods.
> In groovysh, {{printl}} + Tab no longer completes to {{println}}, and
> {{prin}}, {{sle}} and {{sprin}} offer nothing, although Groovy 6.0.0's
> groovysh completes all of them. {{this.printl}} does offer {{println}}.
> An unqualified name should also offer the members of the enclosing class's
> supertypes (for a script, {{Script}}'s {{print}}, {{println}} and {{printf}})
> and the extension methods that apply to it ({{sleep}}, {{sprintf}}). Inside a
> static method the class's instance members do not apply, while the extension
> methods still do.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)