IntelliJ IDEA does not find operators of Observable in rxjs5 - intellij-idea

I just installed rxjs 5 beta 3 via npm i rxjs#5.0.0-beta.3.
I have the following example code:
import {Observable} from "rxjs"
new Observable(o => o.next(42)).filter(() => true);
This code compiles perfectly well when using ts-node for example.
But when looking at this code inside IntelliJ IDEA, the filter() operator is not found.
When using operators on an Observable instance, they are not found either.
The suggested static members of Observable are:
create()
if()
throw()
The suggested members of an instance of Observable are:
_isScalar()
forEach()
lift()
subscribe()
I also tried to import only what I need, but still my IDE tells me that filter() does not exist on the Observable instance:
import {Observable} from "rxjs/Observable"
import "rxjs/add/operator/filter"
new Observable(o => o.next(42)).filter(() => true);
Any suggestions how to make IntelliJ IDEA know about the operators?

To fix this issue you need to add RxJS as a javascript library in IntelliJ:
Go to Settings -> Languages and frameworks -> JavaScript -> Libraries
Click Add...
Add node_modules/rxjs by clicking the + button
Click all the OK buttons until you are back in your editor.
This solution is tested to work on IDEA 2016.1.3

Please, check IDEA 2016.1.2 or higher
Note: Directory node_modules must be not excluded from the project.
Otherwise, see answer https://stackoverflow.com/a/38499577/1057218
Note 2: File package.json must contain the direct dependency (or devdependency) 'rxjs'

Accepted answer doesn't work. I have tested IntelliJ IDEA 2016.2.1 EAP (ideaIU-162.1447.7) and the problem still persist.
The rabbit hole goes as follows:
In the accepted answer you find a link to version 2016.1, but that doesn't fix the problem.
Then you see a comment with a link to the IntelliJ bugtracker, where OP has the first/top comment.
At the bottom of that issue/bug thread you find a comment saying IDEA 2016.2 162.426.1 EAP will definitely fix the problem, it doesn't.
Bottom line, if you import all of what RxJS has to offer with import {Observable} from 'rxjs/Rx'; IntelliJ will still complain that it can't find methods like .map and .filter

Related

How to create a Kotlin console application with Gradle in Intellij IDEA

I found this tutorial from JetBrains: https://www.jetbrains.com/help/idea/create-your-first-kotlin-app.html?section=Gradle%20Kotlin
It is dated August 19th, 2020.
I am using the same IntelliJ IDEA version as in their documentation: 2020.2.
However, my project creation wizard looks quite different from theirs.
They provide this screenshot:
But for me, it looks like this:
and when I click on Next:
I don't see where I can choose the Console Application template, or Gradle.
I found a second tutorial - https://kotlinlang.org/docs/tutorials/jvm-get-started.html , which shows yet a third variation of the New Project wizard:
Are the tutorials out of date? Am I doing anything wrong? How do I create a Kotlin project, based on a console application template, with Gradle?
The wizard you have seems to be obsolete now. There was a brand-new one, released as a part of Kotlin 1.4 recently(see here). Most probably, the problem is caused by the Kotlin IDE plugin being outdated or something. Please try to delete in and re-install using the Preferences -> Plugins menu. Comment here with the results, please. I'd like to know if this would help.
Indeed it's quite weird, I've never seen the dialog to look like yours (mine looks like the one in the tutorials). However, choosing the template doesn't do anything special - it simply creates the main file, which you can do so yourself.
So create a new project with the "JVM/IDEA" option. If it already opens up a main.kt file, you don't need to do anything else. If it didn't, look in the src folder - you should see a folder named main with a folder named kotlin (with a blue icon instead of grey) inside - here's where you wanna create your main file (right click -> new kotlin file/class -> main.kt and make it a file, not a class). Finally, put this in the file:
fun main(args: Array<String>) {
println("Hello world!")
}
Note: if you don't have a kotlin folder, create the file in the folder with the blue icon (might even be src). Also, if this doesn't use Gradle (for some reason), create a Gradle project instead, and at the "Additional libraries and frameworks" option, uncheck Java and check Kotlin, then continue with creating main.kt if it isn't created.
You may create a Kotlin + gradle project from the terminal:
$mkdir myProject; cd myProject; gradle init
follow the tutorial.
And then start the Intellij & open the dir
You're good to go
Same process like this
The same happened to me but I figured out how to fix it:
Just disable Material Theme UI.

WebStorm Vue Unresolved variable or type

I have upgraded my WebStorm to version 2019.2.1 yesterday.
After that I have some issues with Vuex methods:
Methods and computed added locally works fine and are recognized by WebStorm (green arrows)
But getters and actions are not: Unresolved variable or type... (blue and red arrows)
This is misleading + I can't use shortcut to jump to method.
How can I make it work?
UPDATE
Adding this. before like: changing canBeEdited to this.canBeEdited solves the error but it seems to be a hack (not very comfortable though)
Submitted to developers as WEB-40929, please follow it for updates

Gridsome build fails when used with vue2-leaflet plugin

When running gridsome build I get window is not defined. Anyone has an example of making vue2-leaflet work with the client only option for gridsome?
Wrap your component inside template with <ClientOnly> tag, more info in my other answer
I've been struggling with the same problem (but with other libraries) and the only solution i've found was to copy the package into src/. Something like :
cp -a node_modules/package-giving-me-headaches src/plugins
and
// main.js
import PackageGivingMeHeadaches from "~/plugins/package-giving-me-headaches"
Depending on the package, you may need to target a specific entry point :
// main.js
import PackageGivingMeHeadaches from "~/plugins/package-giving-me-headaches/src"
You know you need to do that when Gridsome tells you :
"export 'default' (imported as 'PackageGivingMeHeadaches') was not found in '~/plugins/package-giving-me-headaches'
Edit : Yes, i know its not ideal and ugly, but i don't have time to fight for it.

Intellij Flutter - Import via Alt+Enter not working

My team members and me often face the problem in Intellij that we cannot import some classes via Alt+Enter because Intellij hasn't indexed them successfully.
Our set up
We have different Flutter projects which belong and work together.
ProjectFolder:
our_project/customer_app
our_project/provider_app
our_project/server_app
our_project/model_app
Some of these projects have dependencies to other projects which are declared in the pubspec.yaml file.
Problem
E.g. the customer_app has a dependency to the model_app.
Now we add this new class in model_app such as class MyModel.
Later in the process we want to use MyModel inside of the customer_app.
If we type something like MyModel() and try to press Alt+Enter it doesn't find the class immediately. (it works miracously only sometimes)
What we have to do then is to copy the path of MyModel and do the import manually. Which is often time consuming.
We even tried to run flutter packages get which also doesn't help to find this import of MyModel. Ideally we want that Intellij find the import automatically by indexing it without copying the path out of the other project.
This is a known issue and planned to be fixed eventually.
You can upvote https://github.com/dart-lang/sdk/issues/25820

Intellij idea deprecated no strikeout/strikethrough

I'm using IntelliJ IDEA v12. When I import a project, there’s a strikeout/strikethrough line on the method which has the annotation #Deprecated, but I used alt+enter to disable it. So, how can I reactivate this feature? I want to display that strikethrough, thanks!
Open Settings -> Type Inspections to go to inspection settings -> Type Deprecated to find out all deprecated related inspection settings -> Check Deprecated API usage.
IntelliJ had a bug in 2018.3, 2018.2.2 (182.4129.33). It was fixed in builds 191.65, 183.3691.
Setting -Dide.text.effect.new.metrics=false in the .vmoptions fixes the problem.
In addition to Ionghua's answer .....
If you find that IntelliJ is still not striking out deprecated methods, even though you have enabled the inspection as above, check to make sure that your code is not ignoring deprecation warnings with #SuppressWarnings("deprecation").
In addition to longhua's answer... and vegemite4me...
Another possible source for this problem might be custom color themes.
If you are using a custom theme, make sure that it contains strikethrough. I was using monokai-sublime and there is no strikethrough for #Deprecated annotations. When I changed the color theme from monokai to darcula strikethrough worked as expected.
I found that the only thing that worked for me with version 2019.2 192.5728.98, runtime 11.0.3+12-b304.10 was to use Help | Edit VM Options and add -Dide.text.effect.new.metrics=false