Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!match)
fail(m, "Completion set failed at hint: " + parts[i - 1] +
"\n got: " + resp.completions.join(", ") + "\n wanted: " + args);
});
} else if (kind == "exports:") {
server.request({query: {type: "exports", file: fname}}, function(err, resp) {
if (err) throw err;
if (resp.type != args) fail(m, "Export type failed. Got:\n " + resp.type + "\nwanted:\n " + args);
});
} else {
var start, end;
if (directlyHere) {
for (end = m.index; end && /[\s:,;]/.test(text.charAt(end - 1)); --end) {}
start = null;
} else {
var expr = walk.findNodeBefore(ast, m.index, "Expression");
if (!expr) {
fail(m, "No expresion found");
return;
}
start = expr.node.start; end = expr.node.end;
}
var query = {type: /doc/.test(kind) ? "documentation" : kind == "loc:" ? "definition" : kind == "refs:" ? "refs" : "type",
start: start, end: end,
docFormat: kind == "doc+:" ? "full" : null,
file: fname,
depth: kind == "::" ? 5 : null,
lineCharPositions: true};
server.request({query: query}, function(err, resp) {
if (err) throw err;
if (/doc/.test(kind)) { // Docstring test
function findNodeBefore (node, pos, test, baseVisitor, state) {
return walk.findNodeBefore(node, pos, test, baseVisitor || base, state)
}
function findNodeBefore (node, pos, test, baseVisitor, state) {
return walk.findNodeBefore(node, pos, test, baseVisitor || base, state)
}
function findNodeBefore (node, pos, test, baseVisitor, state) {
return walk.findNodeBefore(node, pos, test, baseVisitor || base, state)
}