mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-13 01:01:34 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
fcf1060486
3 changed files with 36 additions and 12 deletions
|
@ -122,16 +122,36 @@ module.exports = (SnippetManager, autoLineEndings) ->
|
|||
# meta: displayed right-justfied in popup
|
||||
lang = session.getMode()?.$id?.substr 'ace/mode/'.length
|
||||
line = session.getLine pos.row
|
||||
completions = []
|
||||
|
||||
#If the prefix is a reserved word, don't autocomplete
|
||||
#If the prefix is a member expression, supress completions
|
||||
fullPrefix = getFullIdentifier session, pos
|
||||
fullPrefixParts = fullPrefix.split /[.:]/g
|
||||
word = getCurrentWord session, pos
|
||||
|
||||
if fullPrefixParts.length > 2
|
||||
@completions = []
|
||||
return callback null, completions
|
||||
|
||||
beginningOfLine = session.getLine(pos.row).substring(0,pos.column - prefix.length)
|
||||
|
||||
unless (fullPrefixParts.length < 3 and /^(hero|self|this|@)$/.test(fullPrefixParts[0]) ) or /^\s*$/.test(beginningOfLine)
|
||||
console.log "Bailing", fullPrefixParts, '|', prefix, '|', beginningOfLine, '|', pos.column - prefix.length
|
||||
@completions = completions
|
||||
return callback null, completions
|
||||
|
||||
#If the prefix is a reserved word, make enter just complete it
|
||||
keywords = session.getMode()?.$highlightRules?.$keywordList
|
||||
if keywords and prefix in keywords
|
||||
@completions = []
|
||||
return callback null, @completions
|
||||
completions.push
|
||||
content: prefix
|
||||
caption: prefix
|
||||
snippet: prefix + "\n"
|
||||
score: 100
|
||||
meta: '\u21E5'
|
||||
|
||||
word = getCurrentWord session, pos
|
||||
snippetMap = SnippetManager.snippetMap
|
||||
completions = []
|
||||
|
||||
SnippetManager.getActiveScopes(editor).forEach (scope) ->
|
||||
snippets = snippetMap[scope] or []
|
||||
for s in snippets
|
||||
|
@ -167,6 +187,14 @@ getCurrentWord = (doc, pos) ->
|
|||
start++ if start >= 0
|
||||
text.substring start, end
|
||||
|
||||
getFullIdentifier = (doc, pos) ->
|
||||
end = pos.column
|
||||
start = end - 1
|
||||
text = doc.getLine(pos.row)
|
||||
start-- while start >= 0 and not text[start].match /\s+/
|
||||
start++ if start >= 0
|
||||
text.substring start, end
|
||||
|
||||
scrubSnippet = (snippet, caption, line, input, pos, lang, autoLineEndings, captureReturn) ->
|
||||
# console.log "Zatanna snippet=#{snippet} caption=#{caption} line=#{line} input=#{input} pos.column=#{pos.column} lang=#{lang}"
|
||||
fuzzScore = 0.1
|
||||
|
|
|
@ -11,9 +11,7 @@ defaults =
|
|||
language: 'javascript'
|
||||
languagePrefixes: 'this.,@,self.'
|
||||
completers:
|
||||
keywords: true
|
||||
snippets: true
|
||||
text: true
|
||||
|
||||
|
||||
|
||||
|
@ -87,8 +85,6 @@ module.exports = class Zatanna
|
|||
@completers.snippets = pos: 0
|
||||
# Replace the default snippet completer with our custom one
|
||||
@completers.snippets.comp = require('./snippets') @snippetManager, @options.autoLineEndings
|
||||
if @options.completers.keywords
|
||||
@completers.keywords = pos: 1
|
||||
|
||||
activateCompleter: (comp) ->
|
||||
if Array.isArray comp
|
||||
|
@ -159,7 +155,7 @@ module.exports = class Zatanna
|
|||
|
||||
doLiveCompletion: (e) =>
|
||||
# console.log 'Zatanna doLiveCompletion', e
|
||||
return unless @options.basic or @options.liveCompletion or @options.completers.snippets or @options.completers.text
|
||||
return unless @options.basic or @options.liveCompletion or @options.completers.snippets
|
||||
return if @paused
|
||||
|
||||
TokenIterator = TokenIterator or ace.require('ace/token_iterator').TokenIterator
|
||||
|
|
|
@ -135,7 +135,7 @@ function createUpsertCloseLeadFn(zpContact) {
|
|||
function getZPRepliedContactsPage(contacts, page, done) {
|
||||
// console.log(`DEBUG: Fetching page ${page} ${zpPageSize}...`);
|
||||
const options = {
|
||||
url: `https://www.zenprospect.com/api/v1/contacts/search?codecombat_special_auth_token=${zpAuthToken}&page=${page}&per_page=${zpPageSize}`,
|
||||
url: `https://www.zenprospect.com/api/v1/contacts/search?codecombat_special_auth_token=${zpAuthToken}&page=${page}&per_page=${zpPageSize}&contact_email_replied=true`,
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ function getZPRepliedContacts(done) {
|
|||
for (let i = 1; (i - 1) * zpPageSize < total; i++) {
|
||||
tasks.push(createGetZPLeadsPage(contacts, i));
|
||||
}
|
||||
async.parallel(tasks, (err, results) => {
|
||||
async.series(tasks, (err, results) => {
|
||||
if (err) return done(err);
|
||||
const emailContactMap = {};
|
||||
for (const contact of contacts) {
|
||||
|
|
Loading…
Reference in a new issue