Giter Site home page Giter Site logo

marklogic-sublime's People

Contributors

paxtonhare avatar prestonmcgowan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

marklogic-sublime's Issues

Make error messages easier to read

If there are errors in the JavaScript the full HTML source is displayed in the output pane. A more usable output would only display the actual error message and the line number.

For example an more readable error message might be:

Error on line 4: ReferenceError: foo is not defined

not the following:

<title>500 Internal Server Error</title>

500 Internal Server Error

JS-JAVASCRIPT: Error running JavaScript request: ReferenceError: O is not defined
at 4:0 [JavaScript]
at 4:3,
in xdmp:eval("var o=[];&#10;for (var i =0; i<10; i++)&#10;o.push(i)&#10;foo&#10;", (), <options xmlns="xdmp:eval"><isolation>different-transaction</isolation><database>1406750404...</options>) [JavaScript]
at 4:3 [1.0-ml]

Allow for per-folder XCC configuration for run_file

It would be convenient to allow for folders to be associated with their own XCC configuration, especially for XQuery in non-Roxy projects. This configuration would have the highest priority and would override both the Roxy settings and the MarkLogic user prefs.

Shortcuts/Documentation issue

These are the documentation discrepancies to how the actual marklogic plugin works.

  1. Ctrl + Shift + ' did not open up the webpage and search MarkLogic online docs
  2. attribute name() { () } - in the editor it is returned as attribute name { () }. Not a major issue just the syntax.
  3. similary element name() { () } is coming up as element name { () }. Not a major issue just the syntax.
  4. trigger element fun isn't returning me a function snippet. Instead it returns me something like this
    declare namespace s = "http://www.w3.org/2005/xpath-functions";
    It'll be great if you can revisit all of the shortcuts/documentation and correct these minor issues. Thank you.

Ability to Lint all files (without opening them individually)

Enhancement:

Although xquery is not a compiled language, there are dependencies among files. Currently the plugin only Lints a file if its opened, edited, or saved. Yet there are files that could have issues, but those are not exposed until opened, edited, or saved. If one could "Lint All on open, edit, or save" or "Lint All In the Background" to show all issues, that could be extremely useful. My sense is that the Linting makes a call to the ML server for each file, so this maybe a challenge.

I understand this enhancment is essentially using the Lint to compile your whole xquery "project".

strip multi-line comments when lint'ing library modules

Comments have to be (and are) stripped from library modules before classifying and lint'ing them. However, the regex only matches single line columns, which is a problem for library modules following XQDoc conventions.

Should be a simple fix; I'll try to make a PR once I get setup to test (currently installed through Package Control).

Note: this was discussed in #22, but isn't the focus of the ticket.

Lint, search path for modules?

Hi,
I am having an issue setting up the search_path for the linter.
I set use_roxy_settings to false and have set xcc_port to all the possible ports related to ML 8001,8011,8012, and 8013. I believe it should be either 8012 or 8013, the code and main xdbc ports. When it is set to one of these and I try linting a file, I get a XDMP-MODNOTFOUND error, which sounds reasonable and refers to one of the modules I have declared in the xqy file I am trying to lint.

The trouble is, nothing I try for the seach_path setting to locate these modules seems to work.
I tried absolute paths for the file '/Users/paul/workspace/geyser/lib/config.xqy'
For the project '/Users/paul/workspace/geyser/'
Local paths such as 'lib/config.xqy'
And localhost paths such as 'http://localhost:8011/lib/config.xqy'

None of these seems to work, and I still get the MODNOTFOUND error.

When I try something like 'http://localhost:8011/' (my ML project's main http port) though, I get a message '[Errno 61] Connection refused http://localhost:8041/'. I don't see any reason why it would be trying to access port 8041 though. The only reference I am aware of this port is from the MarkLogic module's default sublime setting for the xcc_port, which is not the port I have set in my user settings.

Any help would be appreciated, thank you!

Display JSON datatypes as JSON, not strings

I might not be using the plugin correctly, however, when I run a simple JavaScript query that returns a JSON file such as:

// sample server-side JavaScript that returns JSON
fn.doc('myFile.json')

the results are returned as a single text string on a single line. This makes large files difficult to read.
Perhaps the result of JSON files could be displayed in the in a similar way that the qconsole displays them, with a datatype on the right side and datatype formatting with newlines and indentation.

Error if local.properties is missing

After setting lint_on_save to true and saving an XQuery file, I got this error:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/dcassel/git/mlu-lms/deploy/local.properties'

Workaround: create an empty local.properties file.

commands to set host and xcc port number

Particularly for non-roxy projects, since we have commands to set the content and modules database, it would complete the picture to have two additional commands: to set the host and to set the xcc app server port. This way one could switch from one database to another, regardless of host, by issuing the commands. Perhaps this could even be consolidated into one operation...to set all 4 parameters in one screen. This together with implementing issue #10 would be a killer combo :)

return autocompletes to other stuff

Sometimes when I type "return" then press the enter key sublime likes to autocomplete some random function.

The reason for this is that the autocomplete delay is too fast. You can fix it by opening your sublime user settings and adding in this:

"auto_complete_delay": 200

Query with file system modules

There appears to be no way to query MarkLogic specifying the file system as modules database, and if a ML app-server is configured with "(file system)" as the modules database, there is no way to query it with a user that doesn't have the xdmp-eval-modules-change permission.

Both would be solved by, e.g. interpreting "modules_database: 0" (or some other defined string) as a request to use the file system (i.e. create the option without calling through the xdmp:database function).

It might also be possible to remove the default "Modules", so that specifying "modules_database: null" will ensure the request uses whatever modules database is defined on the app-server. This doesn't allow users to choose the file system, but does allow all users to defer responsibility for choosing a modules db, which would be enough in some cases (and, as it happens, for me).

Happy to raise a PR, just wanted to get your opinion, in case if there are other concerns I'm not aware of.

xml output indentation

It would be great if the following xquery formatting options would work. Currently, specifying them does not make any difference.

declare option xdmp:output "indent=yes";
declare option xdmp:output "indent-untyped=yes";

cannot use roxy ssettings in roxy project

Hi Paxton,
Great stuff you have here, I want to use the roxy settings in a roxy project but it seems the roxy settings are not picked up? I only get it to work if a set all details in de settings file itself but that cannot be the idea, right?

My settings:
{
// settings for Xcc connection
"xcc": {

    // timeout in seconds for xcc connections
    // can be decimal numbers ex: "1.5"
    "timeout": "1",

    // Use Settings from Roxy's properties files
    // If this is not a Roxy project then the setttings above will be used
    "use_roxy_settings": true,

    // The roxy environment configuration to use
    // Valid choices are usually local, dev, prod but may vary
    "roxy_environment": "hugo",
    // THIS SHOULD BE ALL NEEDED RIGHT? THE STUFF BELOW IS A DUPLICATE FROM ROXY


    // CANNOT GET THIS OUT OF ROXY ...
    // MarkLogic hostname
    "ml_host": "cluey-app-ml1",

    // Xcc port to communicate with for running queries
    "xcc_port": "8041",

    // The content database to use when evaluating queries
    "content_database": "cluey-app-content",

    // The modules database to use when evaluating queries
    "modules_database": "cluey-app-modules",

    // user name to use when authenticating to xcc
    "user": "admin",

    // password name to use when authenticating to xcc
    "password": "admin",

    // Whether or not to use https when communicating with Xcc
    "use_https": false,

    // Local Paths to search for your xquery modules
    "search_paths": [],

    // xquery output options that you want applied when running your query
    // see: http://docs.marklogic.com/guide/xquery/langoverview#id_71572
    "output_options": [
        "indent=yes",
        "indent-untyped=yes"
    ]
}

This works but I want sublime to use my roxy settings so I can work on multiple roxy project without having to type in de details here...

What am I missing?

Add "Run" and "Clear" buttons for New Users

For beginners, it would be nice to have two buttons clearly visible somewhere on the screen. "Run" would execute the current query and "Clear" could clear the text area below the editor. These might be just below the edit panel and above the result panel.

Perhaps this would be a mode for beginners just walking into a training classroom.

Sublime only sees one options file across different projects (=folders)?

Using Sublime 3 (build 3065) on Mac OS 10.7.5.

Paxton, please check this in your system. Open a non-proxy project which .ml-sublime-options file is configured to connect to say, db1. With the first project loaded, then open another non-proxy project which .ml-sublime-options file is configured to connect to say, db2. Do they both work ok as you go back and forth between them?

In my system, the first loaded project's options file (db1) trumps over the second loaded project's options file (db2). I had to actually re-start Sublime and open the original second project (db2) first to have its options file actually be "seen" by Sublime.

Linting library modules?

Apologies if this was already covered elsewhere, but I couldn't find an existing issue.

Is there a way to get MarkLogic to lint library modules? I get this exception:

XDMP-EVALLIBMOD: xdmp:eval("xquery version &quot;1.0-ml&quot;;&#10;module namespace controll...", (), <options xmlns="xdmp:eval"><default-xquery-version>app-server</default-xquery-version><stat...</options>) -- Cannot evaluate library module:

Thanks!

Progress message while query is running

This is one of those usage things that is small but gives a more polished feel to the app. I suggest that you output a string message, say "query is running...", while the user is running a query. This way the user knows that something IS happening. This works well when the timeout config option is bumped up to 5 seconds or more.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.