Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rval = new Promise((resolve, reject) => {
// Sometimes vscode freaks out and sends the whole source as the prefix
// so I check for newlines and reject them here.
if (prefix == "") {
let ci = new CompletionItem("");
resolve(new CompletionList([], true));
} else {
// get string match completions
let allWords = src.match(/[^\s\(\)"',;~@#$%^&{}\[\]\\`\n]+/g);
let wordSet = new core.Set(allWords);
let words = core.Array.from(wordSet);
// find the actual matching words
let matches = words.filter((val: string): boolean => {
return (val.substr(0, prefix.length) == prefix);
}).sort();
let textCompletions = matches.map((val: string) => {
let ci = new CompletionItem(val);
ci.kind = CompletionItemKind.Text;
return ci;
});
// Call Compliment to get the completions
// TODO - add optimization to check the length of the prefix and set isInComplete in the CompletionList
// to false if the length is > 3 chars (or whatever length namespace show up in the list at).
self.connection.findCompletions(ns, prefix, src, offset, (err: any, result: any) => {
var _toArray = function (arr) {
return Array.isArray(arr) ? arr : _core.Array.from(arr);
};
'use babel';
import { Point, Range } from 'atom';
import core from 'core-js/library';
const { find } = core.Array.prototype;
const disposables = [];
const Lang = (rLangScope, openCommentToken, closeCommentToken) => ({
test: (scope) => rLangScope.test(scope),
commentTokens: { open: openCommentToken, close: closeCommentToken },
});
const langs = [
Lang(/^source\.js\.?/ , '/*' , '*/' ),
Lang(/^source\.css\.?/, '/*' , '*/' ),
Lang(/^source\.php\.?/, '/*' , '*/' ),
Lang(/^text\.html\.?/ , ''),
Lang(/^source\.python\.?/, "'''", "'''"),
];
export const config = {