mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Let API properties declare their return values should be captured.
Auto complete will know when to add a variable asingment.
This commit is contained in:
parent
6a28de7c05
commit
f0e1fc1f77
2 changed files with 17 additions and 0 deletions
app
|
@ -97,6 +97,15 @@ PropertyDocumentationSchema = c.object {
|
|||
description: 'How important this property is to autocomplete.'
|
||||
minimum: 0
|
||||
default: 1.0
|
||||
userShouldCaptureReturn:
|
||||
type: 'object'
|
||||
title: 'User Should Capture Return'
|
||||
properties:
|
||||
variableName:
|
||||
type: 'string'
|
||||
title: 'Variable Name'
|
||||
description: 'Variable name this property is autocompleted into.'
|
||||
default: 'result'
|
||||
|
||||
DependencySchema = c.object {
|
||||
title: 'Component Dependency'
|
||||
|
|
|
@ -445,6 +445,14 @@ module.exports = class SpellView extends CocoView
|
|||
else
|
||||
snippetEntries.push entry
|
||||
|
||||
if doc.userShouldCaptureReturn
|
||||
varName = doc.userShouldCaptureReturn.variableName ? 'result'
|
||||
entry.captureReturn = switch e.language
|
||||
when 'io' then varName + ' := '
|
||||
when 'javascript' then 'var ' + varName + ' = '
|
||||
when 'clojure' then '(let [' + varName + ' '
|
||||
else varName + ' = '
|
||||
|
||||
# TODO: Generalize this snippet replacement
|
||||
# TODO: Where should this logic live, and what format should it be in?
|
||||
if attackEntry?
|
||||
|
|
Loading…
Add table
Reference in a new issue