Dopus JavaScript library to allow autocompletion with IDEs?

I'm currently trying the WebStorm JavaScript IDE to assist my button script coding and I would like to know if there is a Directory Opus library to use with it so unresolved variables or functions can be resolved and the autocompletion feature can work.

I come from the Java programming world and I don't know if there is a Javadoc equivalent to get this to work even if Dopus JavaScript library source code isn't publicly available.

I'm not familiar with WebStorm so I don't know how easy it would be to make one, but no one has made anything like that so far (or if they have, they haven't shared it here).

But this kind of library/JSDoc thing isn't supposed to be made by a third party. You, as the developers of the JavaScript code (i.e. the JScript library) that allows custom buttons to interact with Directory Opus, are the ones that would provide this.

Presumably anyone can make it. We don't know anything about WebStorm IDE, nor is JScript the only language we support, and we aren't web developers so the world of JavaScript IDEs is not something that's really on our radar.

Is it a standard thing that lots of other IDEs can also use? Is there support for API descriptions that also work when editing VBScript or other ActiveScripting languages?

I'm sorry if I sounded a bit rude before. I don't mean to imply that you should have provided this feature, as I understand it is just an aid to make button script coding easier, not by any means necessary. Again, this is my Java background making me think that this could have been provided by you from your own DOpus JScript code documentation (Javadoc-style), but it seems things are a bit different for JavaScript.

Yes, I'm not looking for something specific to WebStorm but for every JavaScript IDE. I've looked into it more thoroughly and found that there is something called TypeScript definition files that are useful for this purpose when the library source code isn't available. I've read they work with Eclipse, Visual Studio Code, Sublime Text, Emacs, etc.

Yesss this would be fantastic; I actually found this thread while googling for DOpus ones (which I've failed to find :slightly_frowning_face:) for the aforementioned WebStorm: The Smartest JavaScript IDE by JetBrains. These *.d.ts files are formally called TypeScript declaration files.

I believe @vikaesar is referring to those DefinitelyTyped TypeScript stubs which can be configured and used as libraries.

Purpose:

  • Improve code completion, resolve symbols for a library/framework too sophisticated for static analysis, and add type information for such symbols.
  • Resolve globally defined symbols from test frameworks.

It would be amazingly useful to have for those writing scripts in JScript -- especially those less familiar with Directory Opus. An introduction to creating them (by example) can be found here, and some templates can be found here.

To actually create the DefinitelyTyped stubs though, the "templates" to look at will probably be the ones that are actually written and stored at the repository here: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types.

Beware that that page has nearly 6000 stubs in it (so it takes a while to load). I'd pick something well known to look at (or something you have a degree of familiarity with). An example might be the one for Atom (the text editor) found here: here (I'm not actually sure if Atom is similar to Directory Opus, just giving a particular example).

I was just looking at the one for writing Google Chrome extensions: here and it seems like a pretty good fit (possibly) for DOpus (just by looks of how chrome.* could be mapped to something like DOpus.*)

I found this pretty interesting tool made by Microsoft hat can generate TypeScript definition files directly from JavaScript objects: GitHub - microsoft/dts-gen: dts-gen creates starter TypeScript definition files for any module or library.

... it simply examines the objects as they appear at runtime, rather than needing the source code that creates the object. This means no matter how the object was written, anything, including native objects, can be given an inferred shape.
... meant to be a starting point for writing a high-quality definition file.

The issue would then be figuring out how to run dts-gen on DOpus' script objects.

I'm not sure how that could really work with ActiveScripting objects as there's no way to know what their possible arguments are. It might give you a list of method names for each object, but it wouldn't know what to pass when calling their methods (unless it just took examples from an existing script, which could give a very incomplete view of things).

There aren't that many objects and methods so that on its own may not save much time vs writing the definition file(s) by hand.

If someone made the definition files we'd certainly consider adopting them and maintaining them going forward, so they don't go out of date. Making them ourselves might happen at one point but we have a lot of other work to do at the moment so if you really want this in the near future then you'll need to make it.

The objects are all documented so there shouldn't be anything extra that we'd know vs what you can find in the docs, in terms of converting the docs to a definition file.