ligasgr / intellij-xquery

Plugin to support XQuery in Intellij Idea
Apache License 2.0
35 stars 23 forks source link

Unresolvable functions and variables #171

Open millerbill3 opened 8 years ago

millerbill3 commented 8 years ago

Noticed that functions imported from another module are not resolvable within the executing module.

ligasgr commented 8 years ago

Hi,

Thanks for raising the issue. Please give more details on which implementation you're using and an example modules for which it doesn't work.

millerbill3 commented 8 years ago

So, if I have a module myModule.xqy and I import another module (utils.xqy) and then from within myModule I have a reference to some method in utils, the method is highlighted in red and the tooltip displayed states that the method cannot be resolved.

Example: In myModule.xqy import module namespace util = "http://blah.com/util" at "/utils/util.xqy"

Then, later I reference a method within util.xqy util:getDate() - This will be highlighted in red and tooltip displays it cannot be resolved.

I'm using the XQuery Support version 3 plugin in IntelliJ IDEA 15 CE

ligasgr commented 8 years ago

Based on the extension used I assume you're using Marklogic. Please check issue https://github.com/ligasgr/intellij-xquery/issues/80 and see if the instruction in the last comment fixes your problem. If no, please give more detailed contents of the example files.

millerbill3 commented 8 years ago

Based on that, I can select MarkLogic 8, but I'm currently working against a MarkLogic 7 server. Will this be an issue?

ligasgr commented 8 years ago

That shouldn't be an issue. Only that it will give you Marklogic 8 specfic list of functions on auto-completion list (there isn't one for ML7 anyway in the plugin). Please select ML8 and it should be fine.

ligasgr commented 8 years ago

I assume it solved the issue.

willsthompson commented 7 years ago

@ligasgr It appears this issue is still present. I'm running ML8, and under Other Settings > XQuery I have set: Main module: xqy, Library module: xqm, XQuery flavour: MarkLogic 8. When I import a library module into a main module or another library module, functions and variables from the imported module are marked as errors Cannot resolve function/variable 'prefix:local-name' and the imported module resources aren't available from the autocomplete listings. I am using WebStorm, not IntelliJ. Please let me know if I can provide any more information.

ligasgr commented 7 years ago

Can you please post sample project (simplest project/files that recreate the issue) somewhere so that I have it a bit easier to reproduce the issue?

willsthompson commented 7 years ago

@ligasgr I did some more testing, and the issue appears to be related to the fact that the imported module path contains a hyphen. For example, this works:

import module namespace library-module = "http://test.org/library-module"
  at "/test/library-module.xqm";

But this does not:

import module namespace library-module = "http://test.org/library-module"
  at "/test-folder/library-module.xqm";

If you want a more complete test case, let me know.

ligasgr commented 7 years ago

Hi Will, The commit c0c99dc should be fixing this issue. Thanks for raising this.

millerbill3 commented 7 years ago

Is the update from commit c0c99dc available via the IntelliJ IDE yet? Just looking to update ASAP

ligasgr commented 7 years ago

Hey, no it's not available yet. I'm planning a release to happen in the upcoming days, so stay tuned!

millerbill3 commented 7 years ago

Hi there, I have the updated version of the plugin (3.2.0) installed in IntelliJ IDEA (2016.3.3) and it appears the bug is still there. If I have an imported module with a hyphen in the path, the plugin is unable to resolve the imported function/variable.

ligasgr commented 7 years ago

Can you please create a sample project with sample file and expose it somewhere? I'm not able to reproduce the issue on the files with content provided in this issue...

millerbill3 commented 7 years ago

I'm trying to recreate the issue, but before I do can you please remind me what the setting is for Database Port? I can't remember if it needs to point to a WebDAV endpoint or HTTP??? Just want to make sure I have the plugin configured correctly.

Here are my settings currently: Name: MarkLogic-local Host: localhost Port: 8049 (WebDAV port, but have tried HTTP too with no success) Database name: points to my modules database Username: Password:

ligasgr commented 7 years ago

Hey Bill, Sorry for late response. Please find the refreshed instructions on how to configure runner here. You should be using XDBC port (you have to configure it first, more details in the link). To recreate the issue you won't need the runner working. It's only for cases when you actually want to run the main module.