Bin/condense node_modules and codemirror


#1

I have been investigating using codemirror with tern the usage scenario is for a user to write anonymous functions that will be run on a node instance running remotely. As part of the functionality there are several non standard node modules that they can require, and it would be good if we could include completions for these.

so I have started by creating some JSON defs I have created one for our internal modules by hand without too much issue however I have been trying to use condense to speed things up. this works sometimes for example.

node ../../bin/condense --plugin node --name soap soap/lib/soap.js  > ../soap.json

returns a usable definition that needs a little tweaking, but

node ../../bin/condense --plugin node --name request request/request.js > ../request.json

produces json that throws

Unrecognized type spec: fn(options: !modules.request/request`js.!0)

when complete is called. the definition causing the problem is

"!modules.request/request`js.!0": {
  "!span": "1864[61:15]-1866[61:17]",
  "!doc": "Filter out properties that are functions and are reserved.\nReserved values are passed in at call site."
}

there is no !type but can you see any obvious reason why the Unrecognised type spec is thrown? The declaration is within !define at the same level as !modules


#2

I guess the slash in the module name is causing problems. The integration between condense and the module plugins is somewhat shaky and ad-hoc in some points.


#3

I have replaced request/request\jswithrequest` no error :slight_smile: but also no completions :confused:

the soap def json also has a slash
{
"!name": “soap”,
"!define": {
"!modules": {
“soap/lib/soap`js”: {

but never refers to in a named type and appears to work as expected

is it perhaps because the definition is
"!modules.request/request`js.!0": {
"!span": “1864[61:15]-1866[61:17]”,
"!doc": “Filter out properties that are functions and are reserved.\nReserved values are passed in at call site.”
}
rather than

 "!modules": {
     "request/request\`js":{
        "!0": {
            "!span": "1864[61:15]-1866[61:17]",
            "!doc": "Filter out properties that are functions and are reserved.\nReserved values are passed in at call site."
        }
    }
}