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

ctrl-clicking queries navigates to generated code #2052

Closed
angusholder opened this issue Oct 16, 2020 · 4 comments · Fixed by #2054
Closed

ctrl-clicking queries navigates to generated code #2052

angusholder opened this issue Oct 16, 2020 · 4 comments · Fixed by #2054

Comments

@angusholder
Copy link
Contributor

Build Environment
SQLDelight version: 1.4.4
IDE version: Android Studio 4.1, Windows
Dialect: SQLite

Describe the bug
Ctrl-clicking a query method navigates to the generated code instead of the .sq file.
Ctrl-clicking a query label in the .sq file says "No usages found in Project Files"

I wonder if this could be another path separator regression on Windows like #1594

@AlecStrong you mentioned here enabling IDE plugin tests on Windows, and enabled that in #1599, looking at that thread it looks like the tests actually passed on Windows straight away, but they should have failed until you rebased my PR? Or am I misreading?

@angusholder
Copy link
Contributor Author

In case it's relevant, I've noticed one crash of the plugin, which got reported in #2045

@angusholder
Copy link
Contributor Author

I've narrowed down the issue: FileIndexMap.fileIndices's keys use OS-specific path separators (\ for me), but FileIndexMap.get does a lookup into fileIndices using the result of ExternalSystemApiUtil.getExternalProjectPath(module) (which has / path separators), so there's no matching element andget returns defaultIndex because it couldn't find the correct index

@AlecKazakova
Copy link
Collaborator

AlecKazakova commented Oct 17, 2020 via email

@angusholder
Copy link
Contributor Author

I'm working on it now, just trying to make sure the tests for GoToDeclarationHandler fail before I commit the fix, but I'm having trouble getting the tests to actually run at all due to an exception during init, do you have any idea what this is?:

com.squareup.sqldelight.intellij.gotodeclaration.GoToDeclarationHandlerTest > initializationError FAILED
    java.lang.ExceptionInInitializerError
        at com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.<clinit>(LightJavaCodeInsightFixtureTestCase.java:60)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at junit.framework.TestSuite.createTest(TestSuite.java:60)
        at junit.framework.TestSuite.addTestMethod(TestSuite.java:307)
        at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150)
        at junit.framework.TestSuite.<init>(TestSuite.java:129)
        at org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:74)
        at org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:11)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
        at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
        at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:78)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
        at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:119)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)
        Caused by:
        java.util.MissingResourceException: Can't find bundle for base name messages.JavaCoreBundle, locale en_GB
            at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1573)
            at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
            at java.util.ResourceBundle.getBundle(ResourceBundle.java:782)
            at com.intellij.core.JavaCoreBundle.getBundle(JavaCoreBundle.java:45)
            at com.intellij.core.JavaCoreBundle.message(JavaCoreBundle.java:33)
            at com.intellij.pom.java.LanguageLevel.<clinit>(LanguageLevel.java:24)
            ... 45 more
1 test completed, 1 failed
> Task :sqldelight-idea-plugin:test FAILED

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