Giter Club home page Giter Club logo

mlxprs's People

Contributors

billfarber avatar bshalke avatar dependabot[bot] avatar jmckean17 avatar mikrovvelle avatar rjrudin avatar zzzwan avatar

Stargazers

 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  avatar  avatar  avatar

mlxprs's Issues

Watch logs

As a developer, I want to be able to inspect the logs on a remote DHS instance so that I can get access this valuable debugging info more readily during development in VS Code.

Automated testing

Last-mile integration testing of the extension. This is complementary to the extensive back-end testing that happen as part of the MarkLogic release cycle.

The minimum we should aim for is a single command that can run all of the tests in one shot. Next step is to hook up CI/CD so that it happens automatically on PRs and releases. (I’ll create a separate issue for that.)

If there are problems with the test library we‘re using we should investigate how others handle this, for example, the extensions that Microsoft delivers.

inline mlxprs settings configuration

I have mlxprs installed with the default settings.
I would like the ability to override those settings in my javascript file so I can better stay in my editor and support multiple projects.

Therefore my database settings is set to Documents.
My code could have the following comment block

/* Settings:mlxprs
  mlxprs.database='data-hub';
  mlxprs.username='some-disadvantaged-user';
  mlxprs.password='shillingForADaysWork';
*/

JSON formatting skipped

I have a search that returns a few documents.

The first time I execute the search I get something like this:
image

The next time I execute I get something like this:
image

If I keep executing the search, the JSON formatting will toggle back and forth between formatted and not formatted.

With much larger results I have seen where spaces are injected inline and the JSON is partially corrupted. This one is harder to reproduce.

Default connectServer to DHS

Input to connectServer is the name of an app server in the MarkLogic configuration. In DHS the app servers are pre-defined and static. Thus, we should be able to use this as the default value. On-prem will have to change this to reflect their custom app server, just as today.

Document JavaScript debugging

Update the README with a getting started guide quickly covering the “why” and the “how”, including the configuration options and a screenshot showing the debugger in action. Also include a link to MarkLogic documentation about required privileges.

2.0.0 release checklist

Attach workflow needs to connect server first

Attach case needs an app server to be connected to jsdebugger first. Only after that, requests launched on the server can be paused and debugged. It does not apply to any running request, but only to the ones launched after the server is connected

Debugger not launching

From @alan-johnson

I have a Mac with a nightly build of 10.0. I've checked the debugger setting for the app server (data-hub-FINAL) and it is set to true. I have the mlxprs extension installed from the marketplace. I downloaded the project, took the "JSDebugger" folder and put inside the "Client" folder for the mlxprs extension. I set up the launch.json settings as per the example. When I select the VS Code debug then pick the "Launch Debug Request" configuration, I get a message box with 'Configured debug type "ml-jsdebugger" is not supported.' My settings point to my data-hub-FINAL database with admin credentials. I can run code with the mlxprs extension just fine. Just not debug.

Do I have to uninstall the mlxprs extension, build from the source then install that package?

Debug a JavaScript Data Service

As a MarkLogic Developer, I wan to be able to debug my Data Services deployed to a DHS instance in order to diagnose a problem or understand what my (or someone else’s) code is doing.

Expected interaction:

  • Checked out source code locally in VS Code
  • Deploy local changes to remote DHS instance (with ml-gradle)
  • Set a breakpoint in the code as it exists locally
  • “Hit” a Data Service endpoint (for some definition that doesn't involve tracking down a request ID)
  • Stop on a the breakpoint and interactively step through the code
  • Inspect remote state, e.g. in-scope objects
  • Change the code locally and GOTO step 2

Human-readable query plans

As a developer tuning queries, I’d like a simpler way to interpret what the database is doing under-the-covers to help me optimize my code.

MarkLogic provides various query plan reports. They provide low-level details of resource usage and optimization strategies. This information is precise and expansive, but difficult for a human to interpret, especially one without deep MarkLogic expertise. We should provide a visual summary of this information that progressively reveals the details for learning and tuning.

Better feedback on connectServer errors

  • Details about the nature of the problem when there’s a connection error
  • Make connectServer idempotent. Is there a way to show “connection” status visually, so you know whether you need to connect?

Launch configuration labels

  • MarkLogic: Evaluate Current JavaScript Module
  • MarkLogic: Attach to Remote JavaScript Request

And then if/when we implement XQuery debugging, s/JavaScript/XQuery/ above.

Profiling

A VS Code update today announced a new JavaScript debugger. One of the new features is visual profiling. This would definitely provide huge benefits to MarkLogic developers. @zzzwan, can you take a quick look at what we’d need to do to enable this?

Autocomplete doesn't activate in JS only

If you start working in JavaScript without going to into XQuery mode, you may not get SJS autocompletion hints. This is because the language server only seems to get activated by switching to the "XQuery (ML)" language mode.

Steps to reproduce:

  1. Start a new VS Code session (in a project without any XQuery docs open).
  2. Open a new editor buffer for a JavaScript file, or switch manually to the JavaScript language mode.
  3. Start typing "cts.agg"

You would expect some helpful SJS suggestions and documentation snippets about cts.aggregate(), but instead you only see other non-ML-related suggestions.

Workaround is to switch to the "XQuery (ML)" language mode at least one time in the editor, and then switch back to JS. This will activate the language server, and suggestions should then work.

Handling text results (returned as binary?)

When, for example, you fire a doc()[1] query to a modules database to get an xquery file as a result, you would expect to see the text document laid out as readable source code. Instead, you get a bunch of numbers displayed, apparently representing the character codes of the document retrieved.

Need to fix the results handler to interpret/parse these kind of results and make them useful.

Crossing an XQuery eval/invoke boundary

What do we expect the behavior of the debugger to be when trying to debug a request that drops into XQuery? For example, for historical reasons, Data Hub flows and REST Client API Resource Service Extensions are bootstrapped from XQuery, even if the user serviceable code is written in JavaScript.

I wouldn’t expect the debugger to seamlessly cross over this boundary today. What are our options?

  1. Switch back and forth between interactive XQuery and JavaScript debugging in the same request (I don’t know if that’s even feasible)
  2. Continue running the request, but step over any XQuery (Could JavaScript debugging be re-entrant later in the request?)
  3. Cleanly abort the request with a sensible message when it tries to cross the XQuery boundary.

The above is ordered by desirability, descending, but also by complexity/infeasibility. Are there other options? What am I missing?

In the near term and also more generally, I’d suggest extracting the JavaScript from a Data Hub step or a REST Client API Extension into its own library module and debugging it from a unit test (or bootstrap main module). I don’t think we want to encourage debugging framework code in the first place.

Make SJS debug server port configurable

There are likely situations where the user will not be running the SJS debug server on port 8002, or it will be re-mapped to a different port for whatever reason. This should be configurable, but still default to 8002.

Plan to add JS debugger

Planning to add JS debugger functionality into mlxprs.
My current plan is to put debugger related files inside a folder named "JSDebugger" under folder client.
Existing files that will be affected are:
client/extension.ts -- In activate() functions, push debugConfigurationProvider and DebugAdapterDescriptorFactory.
webpack.config.js -- adds one more entry JSDebug for the debug adapter.
package.json -- adds new contributes "breakpoints" and "debugger" and dependencies.

Please advise on where to put the debugger files in the project.

Proposal: JavaScript type hierarchy visualization

The combination of dynamic types and wonky type introspection capabilities in JavaScript make understanding and debugging code more difficult than it should be. (I’m looking at you constructor.name, Object.prototype.toString.call(), and Symbol.hasInstance.) MarkLogic compounds this with own type hierarchies for things like Sequence and Node.

I’ve put together a proof-of-concept visualization that shows any object’s complete type hierarchy, including everything contributed by its prototype chain. This gives a view of what the object is and the available properties/methods.

image

I’d like to propose an enhancement to the eval capability in mlxprs to provide this visualization optionally out-of-the-box, probably as a separate command.

Ideally, this proposal would come in the form of a pull request with a PoC implementation. However, I wanted to get some feedback before I dug in.

My current implementation is a bit of a hack. It does a nested eval and calls a describe() function that’s injected for each request in the E-node to build out a JSON report of the type hierarchy. The browser formats that report as HTML.

Pre-populate the [dis]connectServer server selection dialog

As a user, when I execute the connectServer command, I should be presented with a list of app servers available in my MarkLogic instance.

Ideally, the list should be responsive like other command-palette interactions in VS Code. E.g. if I want "data-hub-STAGING", I should be able to type "s t a enter" to quickly connect.

Currently, I have to type out exactly "data-hub-STAGING" with no auto-complete or other UI assistance. It's just, too daunting.

siblings: #45 and #46

JavaScript debugging demo screencast

  1. Write a quick query-update-map snippet in a new buffer and debug it (“Launch”)
  2. Start with ml-gradle Data Services example
  3. Paste in the snippet from 1
  4. From terminal 1: ./gradlew mlDeploy
  5. From terminal 1: ./gradlew -i mlWatch
  6. Create launch configuration
{
  "type": "ml-jsdebugger",
  "request": "attach",
  "name": "Attach to Debug Request",
  "path": "${workspaceFolder}/src/main/ml-modules/root",
  "debugServerName": "data-services-example"
}
  1. MarkLogic: Connect Debug Server
  2. From terminal 2: ./gradlew -i test
  3. Debug > Attach to Debug Request
  4. Watch expression

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.