File -> Open URL... option disappeared? - intellij-idea

IntelliJ IDEA used to have a option in the File menu to "Open URL...". However, when I went to use this feature today the option is missing:
Did a recent update remove this feature or is there a configuration option to restore it?
I'm running:
IntelliJ IDEA 2019.3.1 (Ultimate Edition)
Build #IU-193.5662.53, built on December 18, 2019

Looks like the File -> Open URL option was provided by the "JavaScript and TypeScript" plugin. Somehow that got disabled which is why the option was missing.
Re-enabling the "JavaScript and TypeScript" plugin fixed the issue.

Related

How to get both absolute and relative line numbers in ideavim for IntelliJ?

I am using IntelliJ IDE for my projects and just installed ideamvim plugin. In the .ideavimrc I added this property
set rnu
with this property I get relative line numbers in my files in intellij which is amazing. But can I ALSO get absolute line numbers? In my vscode, I have both absolute line numbers and relative line numbers, so I was wondering if it was possible to get the same behavior in intellij?
I am fine even if I have to install a new plugin in Intellij for this feature to work.
Thanks
You can do both set relativenumber and set number. This will give you absolute line number for the current line, but relative line numbers for everything else. You can't have two sets of numbers side by side.
You can download and install manual this plugin: https://plugins.jetbrains.com/plugin/7414-relative-line-numbers/versions
And:
Download the latest jar from here
Open Application folder, find the IntelliJ or Android Studio (or other JetBrains IDEs)
Put the relative-line-numbers.jar file into plugins folder
Restart your IntelliJ or Android Studio (or other JetBrains IDEs)
It worked at IntelliJ IDEA 2021.2.2 and windows 11
You can have "hybrid" numbering
Add this line to your ~/.ideavimrc file as per the documentation.
set number relativenumber
You can't have context-sensitive numbering
Automatic toggling between relative / absolute numbering as you can in Vim with
autocmd InsertEnter * : set norelativenumber
autocmd InsertLeave * : set relativenumber
... this doesn't work because IdeaVIM doesn't support autocmd.
I was able to get this to work in Intellij 2019 version. As of today this method doesn't work in latest Intellij version.
Install Relative Line Numbers plugin in intellij, we will use this plugin to simulate relative line numbers.
On the other hand, we will let ideavim simulate absolute line numbers. This can be done by adding set nu to your .ideavimrc file. You can directly open this file by clicking IdeaVim icon in bottom right of intellij. If not just search for this file. For me its in C:\Users\{userName}\.ideavimrc
After doing the above, you should have something that looks like this:
Note: The comments on the plugin website mention that it doesn't work for latest(2020 version) IntelliJ. I am using 2019 version and it works fine so far. The only problem I have noticed so far on my end is that when you open VCS window, you only get relative line numbers(for some reason ideavim buffer doesn't kick in). I will update this answer if I find any other issues. Until then I will keep this question open in case someone else has a working solution for latest intellij version.
https://plugins.jetbrains.com/plugin/7414-relative-line-numbers
For anyone who wants to use this plugins in new version of intelliJ or
AndroidStudio (or other JetBrains IDEs): [on macOS] Download the
latest jar from here Open Application folder, find the IntelliJ or
Android Studio (or other JetBrains IDEs) Right click -> Show Package
Contents Put the relative-line-numbers.jar file
into Contents/plugins folder Restart your IntelliJ or Android Studio
(or other JetBrains IDEs) Find the Relative Line Numbers plugins in
the bundled plugin area Just enable it! Tested by myself, it WORKS
on Android Studio 4.2 Beta
The latest version (0.64) ideavim works. Set number and set relative number.
.

Environment variables not work for IntelliJ IDEA HTTP client

In IntelliJ IDEA, I want to define environment variables for HTTP client, here is the document, but IDEA cannot find my environment when I run a request.
what's wrong?
environment config picture
request config picture
IDEA version:
IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.91, built on April 30, 2020
right click on http-client.env.json and "Override File Type" select JSON.
This helps me.
Make sure you don't have the env.json files located in the .idea folder: https://youtrack.jetbrains.com/issue/IDEA-239351

IntelliJ shows decompiled .class file instead of source code

I am having issues with IntelliJ - it shows me a "decompiled" version of the class instead of its source code if I ctrl+click the class.
This is what I see:
I am trying to open regular JDK source files.
The most relevant issue I found is explained here: Java sources replaced by decompiled files in Intellij
The most detailed answer I've found so far is there as well.
Yet it doesn't work for me:
Bytecode Viewer plugin is off.
Java Bytecode Decompiler plugin is off.
Platform, Project and Module all have same JDK version setup.
I have two JDKs available in IntelliJ: jdk1.8.0_161 and jbsdk8u112b287.2_windows_x86 (bundled with IntelliJ, but comes without src.zip). Tried with both (had to specify src.zip of jdk1.8.0_161 for jbsdk8u112b287.2_windows_x86) - no luck
src.zip is not corrupt - I can open it via WinRAR
When added jdk1.8.0_161 to IntelliJ, it automatically found src.zip. When manually adding src.zip to jbsdk8u112b287.2_windows_x86 Sourcepath tab - it started "Scanning for roots", but warned me that it "cannot determine what kind of files the chosen items contain" and offered me to "attach them as 'Sources'" so I agreed.
Tried File > Invalidate Caches / Restart... - same result.
Same issue in 2017.3 and fresh 2018.1 versions of IntelliJ.
Providing path for Documentation makes IntelliJ look for the documentation in the path specified. So it works as it should for both of JDKs. But not for sources.
Everything else works/compiles properly.
My settings:
1. Get the source files
Make sure you have downloaded and installed the source files of the JDK.
I'm on Arch Linux and installed them with pacman -S openjdk8-src which put a src.zip into /usr/lib/jvm/java-8-openjdk/. We'll use that zip file in the next step.
To list source packages of different JDK versions, do pacman -Ss "openjdk.*-src".
See this question on how to get the source files for your specific platform.
2. Point IntelliJ to the source files
In your module settings (open them with F4) under "Platform Settings" → "SDKs" → "Sourcepath", add the zip file containing the JDK source to your project JDK (be sure to pick the right JDK if IntelliJ lists more than one JDK) using the button with the plus sign:
3. Jump into the source
Select a JDK class, like Comparator, using IntelliJ's Search Everywhere or Ctrl+b with the cursor on the name of the class.
I also have the same problem. The problem for my case is that Project SDK is set to 13 [Invalid]. After I can Project SDK to a valid SDK. My problem is solved.
I tried all the things mentioned at other places for this but at the end I was doing a silly mistake. Intellij was pointing to JDK 11 for which there was no source code (I had both the SDKs 8 & 11). I removed JDK 11 and pointed to JDK 8. JDK had the source code, thus now I can see the source code on ctrl click. Also, I had disabled the bytecode viewer and decompiler plugins. Hope this helps some one.
This also happens for large files - IDEA decides to decompile them instead if indexing sources, which can take ages.
If you're willing to accept the drawdown, adding the following in Help | Edit Custom Properties might fix the problem:
idea.max.intellisense.filesize=4096
On ubuntu there was java version “OpenJDK” when I changed to “Oracle Java”, the error went away and javadoc returned
I meet same problem and finally it gone after I copy JDK to another folder and change config in IntelliJ. I think maybe cause there is a space in path before, because it is installed under "Program Files" folder.
For downloading the source code of class files belong to jar you can use download source option present on top right corner in the de-compiled class file.
On my Windows 10, expand maven:
For me going to File -> Project Structure -> Project -> SDK -> Add SDK -> Download JDK and selecting Oracle OpenJDK solved the problem. Prior to that I had a different JDK selected and apparently it didn't include source code
If you are in a maven project make sure in the project structure all the complied folders are in the excluded section.
I suggest to use Linux Instead of windows. It's easy to find and download Java.
If you are using Linux, you can download SDKMAN
Install Java by SDKMAN
# find version
$ sdk list java
# download
$ sdk install java x.y.z-amzn
ctrl+alt+shift+s add JDK
Switch project JDK
If you are using maven , Right click on Project explorer -> choose Maven -> chick on "reload projects"
This did the trick for me:
Make sure you select the option "Project Files" (instead e.g. "Project").

Cannot import anything in IntelliJ

I am using IntelliJ 15 Ultimate Edition and whenever I try to open an iml file created from a previous version of IntelliJ I get the message 'Cannot import anything from project'. How do I rectify this issue?
I think I have a solution - your Maven plugin must be disabled. (Mine had disabled itself for some reason).
So, go to Settings -> Plugins and enable "Maven 2 Integration" plugin (by ticking the checkbox). Click "Apply" and restart IDEA.
When I tried to import just .iml file I got the same error. Try to import the whole directory and check if you are importing the right files.

Unable to make the module: related gradle configuration was not found. Please, re-import the Gradle project and try again

I use IntelliJ IDEA Ultimate 14 and Gradle 1.2. I manage the project from the console, but I need to debug some of the code from the IDE.
When I try to make the project, this error window appears. When I try to debug the project,
Error: Unable to make the module: idappcli, related Gradle configuration was not found.
Please, re-import the Gradle project and try again.
is written in the message window. How can I add the regular output paths to the project?
Try by opening the gradle task view and then click the refresh button. For me it solved the problem.
I also had a similar problem,
Go to : View -> Tool Windows -> Gradle.
Then press in Refresh Icon
This fixed the issue "Please, re-import the Gradle project and try again." for me (IntelliJ Ultimate 17.3.3):
(1) Detached Gradle project:
(2) Closed the project and (3) re-opened it via File > Open recent. IntelliJ will promt to import the now unlinked Gradle project. (4) Imported it and selected "Use auto-import" in the dialog.
I had the same problem with my Intellij IDEA version 2016.2 (Mac)
The solution was: In Intellij, Click on "View" then "Tool Windows" then "Gradle" then click on
I had to make sure the Use auto-import and the Use default gradle wrapper (recommended) were both checked.
File > Other Settings > Default Settings > Build, Execution, Deployment > Build Tools > Gradle
I faced the similar issue when i update my IntelliJ Idea.
To fix it i ran the below command in terminal and it fixed my problem.
gradle cleanIdea idea
For most people the refresh of Gradle that has already been suggested might solve the issue.
For the others I figured out, that deleting the .idea direcotory and reimporting the project might help.
It can be that your resources directory is not added to classpath when creating a project via Spring Initializr. So your application is never loading the application.properties file that you have configured.
To make a quick test if this is the case, add the following to your application.properties file:
server.port=8081
Now when running your application you should see in the spring boot console output something like this:
INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): **8081** (http) with context path ''
If your port is still default 8080 and not changed to 8081, your application.properties files is obviously not loading.
You can also check if your application runs with gradle bootRun from command line. Which most likely will be work.
Solution:
Close IntelliJ, then inside your project folder delete the ".idea" folder
Reimport your project to IntelliJ like following: "Import Project" -> "select ONLY your build.gradle file to import". (IntelliJ will automatically grab the rest)
build and run your application again
See official answer by IntelliJ Support:
IDEA-221673
This works for me:
Close the IntelliJ Idea
Delete 'gradle' and '.gradle' folders from the project root
Start IntelliJ Idea and import the project as gradle
In my case the root cause was a missing proxy configuration. Once I configured it properly I was able to Refresh gradle projects and it finally downloaded missing files and set up the project correctly.
File > Settings > Appearance & Behaviour > System Settings > HTTP proxy
then
View > Tool Windows > Gradle
and Synchronize button
I went into the IntelliJ Gradle preferences:
Menu: Preferences > Build, Execution, Deployment > Build Tools > Gradle
And under Project Level Settings, switched the radio button to "Use default gradle wrapper (recommended)"
Hit the make button, and was in business!
#user1339 I also had the same problem. Please, read this question Building war with Gradle, Debugging with IntelliJ IDEA. It'll be very helpful for you. And recommendation for the 'Make' task. As message said, I should try to re-import the Gradle project and try again. In my case this advice became very helpful.
I recommend to try to 'Build > Rebuild Project'.