IntelliJ IDEA 2021.2.1 Ultimate
Plugin XQuery and XSLT v1.9.1.212
I can't seem to work out how to get IntelliJ to find the module declarations I've set up in my .xqy modules. The MarkLogic server can find the location, but not IntelliJ. How do I adjust the options of IntelliJ to properly find the references to my modules?
In the "modules" database, the module is at "/code/test/testRecord.xqy"
The modules declaration is thus:
import module namespace testRecord = "testRecord.xqy" at "/code/test/testRecord.xqy"
Locally, the file is located at c:/project/src/main/xquery/testRecord.xqy
Again, the import module works fine in QConsole and when running the module doing the import, but IntelliJ just says "cannot find declaration to go to"
The plugin is using the at path hint to locate the file. That is, it is looking for a path that ends in /code/test/testRecord.xqy. Therefore, you need to ensure that the filesystem path matches, e.g. c:/project/src/main/xquery/code/test/testRecord.xqy.
If the file importing testRecord.xqy is located anywhere under /xquery, you shouldn't need to do anything else -- the plugin should be able to locate the file.
If you are using ml-gradle or roxy to manage the project, the plugin should automatically look in the specified module source root path for those files.
Note: If you want to get the plugin to recognize /MarkLogic paths, you can go to the "Languages & Frameworks > XQuery and XSLT > Modules and Paths" Settings page and set the "Database installation path:" to the root MarkLogic path, e.g. "C:\Program Files\MarkLogic".
If you want to customize this you can specify IntelliJ modules as described in https://rhdunn.github.io/xquery-intellij-plugin/tutorials/module-paths.html.
Related
I'm trying to set up and share maven run configurations in my team and I have this problem. Every team member has different project path. I would like to use path variable in order to define working directory for maven run config. Looks like IntelliJ doesn't evaluate this path variable. Any ideas how to solve this problem?
Error:"the working directory '$MODULE_DIR$' does not exist". "$MODULE_DIR$" is default IntelliJ path variable.
You do not need to do anything. Just use the default value which is a real path to the module inside your project. IDE will automatically use the Path Variable for the Run Configuration xml file.
Note that path variables can not be used in the UI for specifying paths. IDE automatically substitutes them when you use real paths.
I have been using IntelliJ Idea for a while now, but I have always had a problem with the following:
Show Intention Actions (or Option + Enter) > Inject Language/Reference > File Reference
Whenever I try to use this, it acts like the root directory is the same directory as the Java class. However, the way I have IntelliJ set up is so the root directory for the program is the project directory.
This means that whenever I try to inject a file reference, I can not get the file completion, and I get an error but the code still compiles.
How can I make the file reference feature use the project root for its base directory?
I have a situation where my module names need to be in a certain format. Typescript is fine when I do this:
// knockout interfaces, this is knockout.d.ts
declare var ko: KnockoutStatic;
declare module "core!lib/knockout" {
export = ko;
}
And then in my file that uses it:
import ko = require('core!lib/knockout');
IntelliJ doesn't like it though. It says "cannot find external module 'core!lib/knockout'. I'm using the latest stable version (14.1) and this happens with the in-built 1.4 compiler and a custom one.
I guess this may be a Jetbrains bug?
If you add this to the file with the import statement the error will probably go away
/// <reference path="test.ts" />
The real problem I think is that the configuration isn't fully correct. Is the config root correct or are you maybe using version control?
Relevant bits from the link:
From the Scope drop-down list, choose the scope to apply the compiler in. The available options are: – Project Files: all the files within the project content roots (see Content Root and Configuring Content Roots).
– Project Production Files: all the files within the project content roots excluding test sources.
– Project Test Files: all the files within the project test source roots.
– Open Files: all the files that are currently opened in the editor.
VCS Scopes: these scopes are only available if your project is under version control.
– Changed Files: all changed files, that is, all files associated with all existing changelists.
– Default: all the files associated with the changelist
See https://www.jetbrains.com/idea/help/transpiling-typescript-to-javascript.html
I have been trying everything to make IntelliJ allow the use of Struts2 taglib. However it keeps on complaining about <%# taglib prefix="s" uri="/struts-tags"%>. The error it shows in the IDE is:
Cannot resolve the uri /struts-tags
I have set up a new project from scratch and included the struts2 facet (which added the struts.xml file to src/META-INF and the struts2-core jar to myApp/lib).
Is there anything wrong with my project setup ?
Any help is appreciated as I have been stuck with this for a day now!
Environment: IntelliJ IDEA 12.1.6
The issue seemed to be due to IntelliJ caching and the problem is gone after invalidating cache and restart.
Re-indexing the project did the trick.
File > Invalidate Cache
Seems you are not configured a project feature Struts2 properly. You should add File Sets. Right click on the module in the project structure, use Module Config (F4), use Facets, use Struts2 Facet, use File Sets. Press + button to add configuration files. Make sure struts.xml and struts-default.xml, and struts-plugin.xml are added. The struts.xml should not be in src/META-INF but in src like shown in your picture. But struts2-core-x.x.x.x.jar should be on build path. Make sure you have properly configured a project build path, and it should be a valid file containing TLD files inside the jar in the META-INF folder.
I have an xml configuration file located into my plugin resources. I want to update this file whenever in the plugin happens some event. I found some methods to find and read the contents of a file located my plugin classpath, but I'm looking for a way to write into such a file.
Is there any way?
Many thanks.
That location (the install directory) is intended to be read-only since it may be shared in a network install scenario. I suggest you instead write the XML file to your plugin's state location which is intended for just this purpose:
String path = Activator.getDefault().getStateLocation().toString();
I should add that this gives you a fully qualified path to the directory created by Eclipse for any files your plugin wants to store. This directory is unique to your plugin.