When I move a file or directory, IntelliJ fixes all relative import paths according to the new path.
Since last update the package imports also get changed, for example:
import { fromJS } from 'immutable';
import glamorous from 'glamorous';
changes to
import { fromJS } 'immutable/dist/immutable-nonambient';
import glamorous from 'glamorous/typings/glamorous';
I get that the named imports (or lack of) probably match in both cases, but since the imports are absolute it doesn't really make sense to change the import paths.
Is there any way to disable this?
Related
I use (don't care about versions, I use platform to manage versions):
testCompile("org.jetbrains.kotlin:kotlin-test-testng")
testCompile("org.jetbrains.kotlin:kotlin-test")
testCompile("org.jetbrains.kotlin:kotlin-test-common")
But cannot import kotlin.test.Test:
import kotlin.test.Test
Test shows red in IDEA, means not found, Why? something I ignored?
In my router/index.js I have a reference that looks like that:
import SingleVignette from '#/components/Vignette'
I guess # stays for a base directory, right? But I try to Command+click on the reference in VSCode it doesn't refer me to an original file (while ../components/Vignette does. How to make it work?
I'm working with Vue.js single file components in PhpStorm. When I move a component file into another directory, PhpStorm is adding /type to the end of any vuex import statement, (which blows them up until I do a find/replace to set them all back).
For example:
import {mapActions} from 'vuex';
gets changed to:
import {mapActions} from 'vuex/types';
Anyone know what is causing this or how to fix it? Seems like an odd glitch or maybe setting in the refactoring abilities of PhpStorm ???
It appears to have been a bug in version 2019.1.2, upgrading to 2019.1.3 fixed it.
I have this in my script
import groovy.io.FileType
.....
derp = new File("blah")
The script works but inetillij complains it cant resolve "File" and it suggested I import a totally different wrong library for it (com.jidesoft.icons.IconSet)
I already tried invalidating cache and restarting
How do I get intelllij to import groovy.io.FileType? I cant even find a way to suppress error either it doesnt give me that option
groovy.io.FileType is an enum class. It appears your variable derp would be of type File, not FileType.
You can statically import enums from the FileType class (for example):
import static groovy.io.FileType.*
In my Intellij on Java 8 the File class comes from the java.io package in a .groovy file.
I am not allowed to use FileUtils in the program and error is shown when doing so. Even no suggestion is showing to import this pre-defined Class. I tried to search the solution but what I found was to import the class. But in my case even suggestion is not showing to import any class. Hovering on the "FileUtils" shows the suggestion to create FileUtils class/interface. Below is my code:
package captureScreenshot;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils; //Getting Error at this line
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import com.google.common.io.Files;
public class FacebookScreenshot {
#Test
public void captureScreenshot() throws IOException
{
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com");
driver.findElement(By.xpath("//input[#name='firstname']")).sendKeys("Anil Kumar");
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyfile(source,new File("./Screenshots/facebook.png")); //Getting error at this line
driver.quit();
}
}
FileUtils Class
FileUtils Class is defined in org.apache.commons.io.FileUtils which provides the general file manipulation utilities in the following areas :
writing to a file
reading from a file
make a directory including parent directories
copying files and directories
deleting files and directories
converting to and from a URL
listing files and directories by filter and extension
comparing file content
file last changed date
calculating a checksum
org.apache.commons.io is bundled along with selenium-server-standalone-x.y.z by default and available ready to use.
But the behavior you are observing is pretty much inline with your usecase where you mentioned that you are not allowed to use FileUtils in the program. It can be either of the scenarios as mentioned below :
Incase you are using JARs from selenium-java-3.9.1 client, the JAR containing org.apache.commons.io is not being added to your project.
Incase you are using Maven with selenium-java-3.9.1 client dependency the modules containing FileUtils Class have been excluded.
For the following above mentioned reasons, when you mention FileUtils in your program it doesn't show any suggestion to import the class. Moreover if you forcefully provide the import, it will show error on that line.
The line FileUtils.copyFile(); has been updated to FileHandler.copy()
Yes with Selenium Latest version we should use FileHandler.copy()
It works and doesn't throw any error.
// Take Screenshots example
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileHandler.copy(scrFile, new File("<your path>\\screenshot.png"));
download maven commons-io jars from: https://mvnrepository.com/artifact/commons-io/commons-io
and add jars to your build Path in your project
In the above FileHandler.copy(scrFile, new File("\screenshot.png"));
here copy -the method copy(File, File) is undefined for the type FileHandler is occured