Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static imports are overwritten when using content assist #177

Closed
eric-milles opened this issue Apr 22, 2016 · 0 comments
Closed

Static imports are overwritten when using content assist #177

eric-milles opened this issue Apr 22, 2016 · 0 comments

Comments

@eric-milles
Copy link
Member

eric-milles commented Apr 22, 2016

An issue I keep running into in the Groovy editor is that static imports get mangled when using content assist or pasting a block of code that modifies the imports. I have a small example below that should demonstrate the issue. When trying to add "@TypeChecked" using content assist, the static import is cut off, resulting in compiler errors. (I am using 2.9.2 in MarsSR2.)

Before (cursor is after TypeCh and content assist is used to complete):

import static org.mockito.Mockito.mock
import org.junit.Test
@TypeCh
final class WeakReferenceSetTests {
    @Test
    void testAddAndEmpty() {
        WeakReferenceSet set = new WeakReferenceSet()
        assert set.empty
        set << mock(ConcreteType)
        assert !set.empty
    }
}

After (notice the ".mock" has been removed from the static import):

import static org.mockito.Mockito
import groovy.transform.TypeChecked;
import org.junit.Test
@TypeChecked
final class WeakReferenceSetTests
{
    @Test
    void testAddAndEmpty() {
        WeakReferenceSet set = new WeakReferenceSet()
        assert set.empty
        set << mock(ConcreteType)
        assert !set.empty
    }
}

Also, the import keystroke (Ctrl-Shift-M) does not seem to be working for Groovy files. Is this supposed to work or is it unimplemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant