paxtonhare / marklogic-sublime Goto Github PK
View Code? Open in Web Editor NEWSublime plugin for MarkLogic XQuery
License: Other
Sublime plugin for MarkLogic XQuery
License: Other
add autocomplete entries for the library modules available in the current project.
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.
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?
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 "1.0-ml"; module namespace controll...", (), <options xmlns="xdmp:eval"><default-xquery-version>app-server</default-xquery-version><stat...</options>) -- Cannot evaluate library module:
Thanks!
Need to have a concept of search paths to resolve file locations.
Need to speed it up too.
Linting is a bit of a hack. Make it work better.
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".
& in a string is tossing an error.
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 :)
when linting on save make the error appear on the status bar
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.
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
Highlight a line and get the plan
Alex suggests we add pretty print to xquery modules.
@patrickmcelwee showed me a similar feature in his vim plugin.
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!
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";
An extra escaped character at the end of the URL, resulting in 404.
The suggestions are two "import" statements.
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!
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.
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.
provide option to lint js code
recognize .sjs file extension
ability to run .sjs files
autocomplete for sjs files
for instance, cts:highlight and cts:walk
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.
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>http://www.w3.org/TR/xquery-30/#doc-xquery30-Annotation
Please support syntax highlighting for "public" and "private" annotations in function and variable declarations.
These are the documentation discrepancies to how the actual marklogic plugin works.
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.
Something is wrong with the regex.
After a user executes a JavaScript program and finds and error, the cursor should moved to the line that has the error in it.
If there are multiple errors, a link in the output should move the the cursor to the correct line.
Should be loading settings as a resource vs from a file.
If I have > 1 Projects open using .ml-sublime-options the plugin gets confused about which one to use. Often it ends up trying to talk to the wrong server/port.
change it from Cmd+shift+R
This would show a list of MarkLogic databases. When the user selects one, the MarkLogic user prefs are updated.
Some of the snippets for autocomplete are wrong.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.