mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-13 13:35:30 -04:00
Fixed some schema issues related to snippets and code languages.
This commit is contained in:
parent
7e0da9f12a
commit
9ee373428f
4 changed files with 16 additions and 9 deletions
app
lib/surface
schemas
views/play/level/tome
|
@ -698,7 +698,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
AudioPlayer.playInterfaceSound 'coin_1', 0.25
|
||||
if @thang.actionActivated and (action = @thang.getActionName()) isnt 'say'
|
||||
@playSound action, withDelay, volume
|
||||
if @thang.sayMessage and withDelay # don't play sayMessages while scrubbing, annoying
|
||||
if @thang.sayMessage and withDelay and not @thang.silent # don't play sayMessages while scrubbing, annoying
|
||||
offsetFrames = Math.abs(@thang.sayStartTime - @thang.world.age) / @thang.world.dt
|
||||
if offsetFrames <= 2 # or (not withDelay and offsetFrames < 30)
|
||||
sound = AudioPlayer.soundForDialogue @thang.sayMessage, @thangType.get 'soundTriggers'
|
||||
|
|
|
@ -27,27 +27,29 @@ PropertyDocumentationSchema = c.object {
|
|||
type: c.shortString(title: 'Type', description: 'Intended type of the property.')
|
||||
description:
|
||||
oneOf: [
|
||||
{title: 'Description', type: 'string', description: 'Description of the property.', maxLength: 1000, format: 'markdown'}
|
||||
{
|
||||
type: 'object',
|
||||
title: 'Language Descriptions',
|
||||
description: 'Property descriptions by code language.',
|
||||
additionalProperties: {type: 'string', description: 'Description of the property.', maxLength: 1000, format: 'markdown'}
|
||||
format: 'code-languages-object'
|
||||
default: {javascript: ''}
|
||||
}
|
||||
{title: 'Description', type: 'string', description: 'Description of the property.', maxLength: 1000, format: 'markdown'}
|
||||
]
|
||||
args: c.array {title: 'Arguments', description: 'If this property has type "function", then provide documentation for any function arguments.'}, c.FunctionArgumentSchema
|
||||
owner: {title: 'Owner', type: 'string', description: 'Owner of the property, like "this" or "Math".'}
|
||||
example:
|
||||
oneOf: [
|
||||
{title: 'Example', type: 'string', description: 'An optional example code block.', format: 'javascript'}
|
||||
{
|
||||
type: 'object',
|
||||
title: 'Language Examples',
|
||||
description: 'Examples by code language.',
|
||||
additionalProperties: {type: 'string', description: 'An example code block.', format: 'code'}
|
||||
format: 'code-languages-object'
|
||||
default: {javascript: ''}
|
||||
}
|
||||
{title: 'Example', type: 'string', description: 'An optional example code block.', format: 'javascript'}
|
||||
]
|
||||
snippets: {type: 'object', title: 'Snippets', description: 'List of snippets for the respective programming languages', additionalProperties: c.codeSnippet, format: 'code-languages-object'}
|
||||
returns: c.object {
|
||||
|
@ -59,25 +61,27 @@ PropertyDocumentationSchema = c.object {
|
|||
type: c.shortString(title: 'Type', description: 'Type of the return value')
|
||||
example:
|
||||
oneOf: [
|
||||
c.shortString(title: 'Example', description: 'Example return value')
|
||||
{
|
||||
type: 'object',
|
||||
title: 'Language Examples',
|
||||
description: 'Example return values by code language.',
|
||||
additionalProperties: c.shortString(description: 'Example return value.', format: 'code')
|
||||
format: 'code-languages-object'
|
||||
default: {javascript: ''}
|
||||
}
|
||||
c.shortString(title: 'Example', description: 'Example return value')
|
||||
]
|
||||
description:
|
||||
oneOf: [
|
||||
{title: 'Description', type: 'string', description: 'Description of the return value.', maxLength: 1000}
|
||||
{
|
||||
type: 'object',
|
||||
title: 'Language Descriptions',
|
||||
description: 'Example return values by code language.',
|
||||
additionalProperties: {type: 'string', description: 'Description of the return value.', maxLength: 1000}
|
||||
format: 'code-languages-object'
|
||||
default: {javascript: ''}
|
||||
}
|
||||
{title: 'Description', type: 'string', description: 'Description of the return value.', maxLength: 1000}
|
||||
]
|
||||
|
||||
DependencySchema = c.object {
|
||||
|
|
|
@ -163,30 +163,34 @@ me.FunctionArgumentSchema = me.object {
|
|||
type: me.shortString(title: 'Type', description: 'Intended type of the argument.')
|
||||
example:
|
||||
oneOf: [
|
||||
me.shortString(title: 'Example', description: 'Example value for the argument.')
|
||||
{
|
||||
type: 'object',
|
||||
title: 'Language Examples',
|
||||
description: 'Examples by code language.',
|
||||
additionalProperties: me.shortString(description: 'Example value for the argument.')
|
||||
format: 'code-languages-object'
|
||||
default: {javascript: ''}
|
||||
}
|
||||
me.shortString(title: 'Example', description: 'Example value for the argument.')
|
||||
]
|
||||
description:
|
||||
oneOf: [
|
||||
{title: 'Description', type: 'string', description: 'Description of the argument.', maxLength: 1000}
|
||||
{
|
||||
type: 'object',
|
||||
title: 'Language Descriptions',
|
||||
description: 'Example argument descriptions by code language.',
|
||||
additionalProperties: {type: 'string', description: 'Description of the argument.', maxLength: 1000}
|
||||
format: 'code-languages-object'
|
||||
default: {javascript: ''}
|
||||
}
|
||||
{title: 'Description', type: 'string', description: 'Description of the argument.', maxLength: 1000}
|
||||
]
|
||||
'default':
|
||||
title: 'Default'
|
||||
description: 'Default value of the argument. (Your code should set this.)'
|
||||
'default': null
|
||||
|
||||
me.codeSnippet =
|
||||
me.codeSnippet = me.object {description: 'A language-specific code snippet'},
|
||||
code: {type: 'string', title: 'Snippet', default: '', description: 'Code snippet. Use ${1:defaultValue} syntax to add flexible arguments'}
|
||||
tab: {type: 'string', title: 'Tab Trigger', description: 'Tab completion text. Will be expanded to the snippet if typed and hit tab.'}
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ module.exports = class DocFormatter
|
|||
obj[prop] = null
|
||||
|
||||
formatPopover: ->
|
||||
console.log "gotta do the popover", @doc
|
||||
content = popoverTemplate doc: @doc, language: @options.language, value: @formatValue(), marked: marked, argumentExamples: (arg.example or arg.default or arg.name for arg in @doc.args ? [])
|
||||
owner = if @doc.owner is 'this' then @options.thang else window[@doc.owner]
|
||||
content = content.replace /#{spriteName}/g, @options.thang.type ? @options.thang.spriteName # Prefer type, and excluded the quotes we'd get with @formatValue
|
||||
|
|
Loading…
Add table
Reference in a new issue