Intellij Rust Plugin Incorrect 'Unresolved Reference' Errors - intellij-idea

I'm trying out building desktop apps in rust, with the OrbTK framework. However, my IntelliJ can't find certain declarations in the orbtk crate. I'm just running the basic example on OrbTK's github page:
extern crate orbtk;
use orbtk::prelude::*;
fn main() {
Application::new()
.window(|ctx| {
Window::new()
.title("Hello, world!")
.position((100.0, 100.0))
.size(420.0, 730.0)
.child(TextBlock::new().text("Hello, world!").build(ctx))
.build(ctx)
})
.run();
}
The code runs fine, but IntelliJ is giving me an error, saying that Window and TextBlock does not exist. This is very hard to work with, since I can't tell when there is actually an error, and I can't autocomplete and check what methods are available on these structs.
So far, I have tried restarting my IDE several times, reinstalling the IntelliJ rust plugin, trying different versions of OrbTK, but none of these seemed to work. Also, this has never happened to me with any crate other than orbtk, so I have no idea if this problem is coming from IntelliJ, cargo, or otherwise.
Has anyone experienced a similar issue, or have any ideas for a solution? I would be grateful for any input. Thanks :)

Related

Geb DSL Modules unrecognized within Intellij

Going off the documentation here are Modules and other Geb DSL not expected to be recognized within a Spock Spec with IntelliJ? This makes using Geb with IntelliJ a bit cumbersome with no DSL reference. I noticed from this question that the asker did some custom work to get IntelliJ to wrap and notice the Geb DSL.
My questions is am I doing something wrong or is this expected and has there been any progress on getting the Geb DSL recognized by IntelliJ?
If not does anyone have a workaround for this issue/limitation and or another IDE that does recognized the Geb DSL?
IntelliJ has support for Geb DSL, I've been using it for years and there are even tests in IntelliJ's codebase that confirm it's there.
If you could share how your code looks like and what exactly does not work for you then maybe we can find a problem with your setup or expectations. It would also be good to know whether you are using community edition or professional edition.
Please note that the issue discussed in the question you linked to has been fixed by me in this PR and is no longer present since IntelliJ 2018.2.
EDIT:
After reading your comments under my response I now understand what the problem is. Your expectation is that IntelliJ will be able to figure out what the page type at runtime is and provide you with autocompletion. I'm afraid that is simply not possible - you need to track current page instance in your code for IntelliJ to be able to infer types.
Note that tests in geb-example-gradle are written in the very concise, yet dynamic style which means that IntelliJ is not able to infer types. What you need to do is to use the strongly typed style as described in the documentation. That section of the docs could do with a bit of improvement because it's not precise - I've created a Github issue to track that.
Essentially, if you tweak GebishOrgSpec from geb-example-gradle to:
class GebishOrgSpec extends GebSpec {
def "can get to the current Book of Geb"() {
when:
def homePage = to GebishOrgHomePage
and:
homePage.manualsMenu.open()
then:
homePage.manualsMenu.links[0].text().startsWith("current")
when:
homePage.manualsMenu.links[0].click()
then:
at TheBookOfGebPage
}
}
then IntelliJ will provide you with autocompletion.

When i click on the Kotlin Repl in IntelliJ Idea , the window never opens . Nothing happens . Please anyone tell me how to fix this

Kotlin Repl does not open ,nothing happens on clicking it
My solution/workaround. What happens is, and by the way the Intellij ide warns you about this, that you create the project and when naming it you use a space or similar unsupported character and the ide still seems to create the project just fine but actually it doesn't. Your project comes out misconfigured and you can't use Kotlin Repl. The simplest solution is to replace any spaces (or similar forbidden characters) with a hyphen "-" or an underscore "_" or simply use cammelCase. Best of luck to everybody and hope future learners of kotlin see this and spend less time troubleshooting such a simple issue.
Do you have a project open when you click it? This post states: "At this time the Kotlin REPL requires you to have a project open. You don't need to configure anything specific in the project; a Java project with the default settings will run just fine.
If you want to try Kotlin without configuring anything, you can use the online IDE at http://try.kotlinlang.org/"

Intellij IDEA 2017.1.5 with the Go plugin wrongly Reports Unused Functions and Variables

I'm using Intellij IDEA 2017.1.5 with the Golang Plugin.
When I run Analyze > Inspect Code > Whole Project, the Inspection Results always include "Unused Exported Function" warnings, even though my project codes clearly use those functions. The same goes for some Global Variables and Constants.
When I comment-out those "unused" functions and variables, I encounter "Undefined Function" and "Undefined Variable" errors, and when I put them back, the errors disappear, so I know they are actually being used within my project.
Is there a way to make these wrong warnings go away, or "refresh" the compiler's Code Analysis? And is this a known issue with Intellij IDEA or the Golang Plugin in general, and has anybody else encountered this?
It's really annoying because I'm aiming for 0 Warnings and these ones never go away.
Upgrade to IDEA Ultimate 2017.3+ or use GoLand and see if the error still happens.
The plugin for 2017.1 is really old and a lot of changes have happened since then.
If the issue still happens, then report it to https://youtrack.jetbrains.com/issues/Go and make sure to include a way to reproduce issue.

Rust IDE not detecting Result from error_chain, thinks I'm using the std::result::Result

I have an errors.rs file with error_chain! {}, which exports Result, ResultExt, Error and ErrorKind.
If I use self::errors::*, IntelliJ thinks that I'm using the default Result (std::result::Result, I think). However, if I explicitly import the types using use self::errors::{Result, ...}, everything works out hunky dory.
I can tell because the standard result has two type params, but the error_chain one has only one.
In either case, it still compiles.
I'm using the standard Rust IntelliJ plugin, version 0.1.0.1991.
Help! Does anyone know how to get the plugin to understand what the macro is doing?
The IntelliJ-Rust plugin uses its own code parser. It allows to leverage all the IntelliJ platform capabilities (like code navigation, formatting, refactoring, inspections, quick documentation, markers and many others) but requires implementing all the language features, which is not a simple task for Rust (you can find a more in-depth discussion of the Rust compiler parser versus IDE parser in this reddit post).
Macros expansion is probably the biggest language feature that is not supported by the plugin parser at the moment. That is, the plugin sees this error_chain! call, can resolve it to its definition, but doesn't expand it to the actual code and hence doesn't know about the new Result struct that shadows the one from stdlib. Unfortunately, in some cases it leads to such false positive error messages.
I've converted this error annotation into an inspection, so in the next plugin version you'll be able to switch it off entirely or for the particular code block. The work on macros expansion is also in progress.

Baffling Xcode Plugin build trouble

I'm trying to build an Xcode plugin using this template. As a matter of fact the template works perfectly, but the problem is that something strange happened and it stopped loading the plugin. After 3 hours of trial & error, I pinpointed the problem but I cannot get my head around this...
I have a class called MHStatement and when I build without including this class, the plugin works fine and appears in the Xcode menu bar as expected.
However, when I include the MHStatement.h and MHStatement.m files in the project and then build, the plugin fails to load.
Now the fun part is that if I rename MHStatement to Statement and build it still doesn't work.
But if I make a new interface & implementation Statement overwriting the above Statement files it works again.
Moreover, creating new classes named _MHStatement, __MHStatement, MXStatement, MBStatment, MHFatment also make it fail, but XXStatement, DDStatement, XHStatement is OK.
But when I create a class XXStatement, and refactor->rename it to MHStatement and build,
the plugin loads normally.
This is obviously some weird runtime or linking error, but I don't know how to even start looking for what exactly is happening.
I am not sure if this is reproducible by any means, so I would just kindly ask for any advice that might come to your minds.
Cheers!
EDIT
I tried creating a new class MHStatement and adding it to BBUncustify plugin. Building the plugin like this also prevents it to load, but now I'm getting this warning
objc[6278]: Class MHStatement is implemented in both /Users/marko/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin/Contents/MacOS/UncrustifyPlugin and /Users/marko/Library/Application Support/Developer/Shared/Xcode/Plug-ins/PluginTest3.xcplugin/Contents/MacOS/PluginTest3. One of the two will be used. Which one is undefined.
with tail -f /var/log/system.log
I ended up creating a new project from scratch, and now have 3 separate targets, a framework for the code base that actually does all the work, test cases for the framework, and a simple one class plugin target, which works fine with that setup.
I hope some day someone will be able to answer what exactly was happening, and Apple will become kinder to Xcode modding community.