Updated to new Aether range info, fixing error line numbers.

This commit is contained in:
Nick Winter 2014-02-03 13:58:25 -08:00
parent 912b6140ac
commit 738b791683
9 changed files with 21 additions and 18 deletions

View file

@ -28,7 +28,6 @@ module.exports = class WizardSprite extends IndieSprite
super thangType, options super thangType, options
@isSelf = options.isSelf @isSelf = options.isSelf
@targetPos = @thang.pos @targetPos = @thang.pos
console.log "have @targetPos", @targetPos
if @isSelf if @isSelf
@setNameLabel me.displayName() @setNameLabel me.displayName()
@setColorHue me.get('wizardColor1') @setColorHue me.get('wizardColor1')

View file

@ -24,6 +24,9 @@
&:hover, &:focus &:hover, &:focus
@include opacity(1) @include opacity(1)
.problem-hint
font-size: 80%
//&.alert-error //&.alert-error
&.alert-warning &.alert-warning

View file

@ -83,7 +83,7 @@
.problem-marker-error .problem-marker-error
background-color: rgba(110, 45, 27, 0.25) background-color: rgba(110, 45, 27, 0.25)
.ace_gutter-cell.executing .ace_gutter-cell.executing:not(.ace_error)
margin-left: 1px margin-left: 1px
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy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tZW50SUQ9InhtcC5kaWQ6MDI4MDExNzQwNzIwNjgxMThBNkRFOENDNTEzNTJCMUYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7SazaGAAAAiElEQVR42mL8//8/AzUBEwOVweA3kAWboI2jCyhgDwBx4ZH9ey5Qy4UOQHweaHg/EAtQ08sFUIMDqBmGCkC8HmgoCCtQM1ICoK5toGYsg8KzHmjo+UGbDj8AcSMwORkSnQ7xgA3QtPmApISNBTyAGrSBGl6eAMSGxBhGyIVkZT3G0fKQYgAQYACL+C2ZM6PC7AAAAABJRU5ErkJggg==)
background-position: 0px center background-position: 0px center

View file

@ -1,3 +1,5 @@
button.close(type="button", data-dismiss="alert") × button.close(type="button", data-dismiss="alert") ×
span span.problem-message= message
!= message if hint
br
span.problem-hint= hint

View file

@ -20,8 +20,8 @@ module.exports = class Problem
text = @aetherProblem.message.replace /^Line \d+: /, '' text = @aetherProblem.message.replace /^Line \d+: /, ''
start = @aetherProblem.ranges[0][0] start = @aetherProblem.ranges[0][0]
@annotation = @annotation =
row: start[0], row: start.row,
column: start[1], column: start.col,
raw: text, raw: text,
text: text, text: text,
type: @aetherProblem.level ? "error" type: @aetherProblem.level ? "error"
@ -35,7 +35,7 @@ module.exports = class Problem
return unless @aetherProblem.ranges return unless @aetherProblem.ranges
[start, end] = @aetherProblem.ranges[0] [start, end] = @aetherProblem.ranges[0]
clazz = "problem-marker-#{@aetherProblem.level}" clazz = "problem-marker-#{@aetherProblem.level}"
@markerRange = new Range(start[0], start[1], end[0], end[1]) @markerRange = new Range start.row, start.col, end.row, end.col
@markerRange.start = @ace.getSession().getDocument().createAnchor @markerRange.start @markerRange.start = @ace.getSession().getDocument().createAnchor @markerRange.start
@markerRange.end = @ace.getSession().getDocument().createAnchor @markerRange.end @markerRange.end = @ace.getSession().getDocument().createAnchor @markerRange.end
@markerRange.id = @ace.getSession().addMarker @markerRange, clazz, "text" @markerRange.id = @ace.getSession().addMarker @markerRange, clazz, "text"

View file

@ -18,6 +18,7 @@ module.exports = class ProblemAlertView extends View
getRenderData: (context={}) => getRenderData: (context={}) =>
context = super context context = super context
context.message = @problem.aetherProblem.message.replace("\n", "<br>") context.message = @problem.aetherProblem.message.replace("\n", "<br>")
context.hint = @problem.aetherProblem.hint?.replace("\n", "<br>")
context context
afterRender: -> afterRender: ->

View file

@ -65,6 +65,7 @@ module.exports = class Spell
aetherOptions = aetherOptions =
problems: problems:
jshint_W040: {level: "ignore"} jshint_W040: {level: "ignore"}
jshint_W030: {level: "ignore"} # aether_NoEffect instead
aether_MissingThis: {level: (if thang.requiresThis then 'error' else 'warning')} aether_MissingThis: {level: (if thang.requiresThis then 'error' else 'warning')}
functionName: @name functionName: @name
functionParameters: @parameters functionParameters: @parameters

View file

@ -288,10 +288,12 @@ module.exports = class SpellView extends View
return unless aether = @spellThang?.aether return unless aether = @spellThang?.aether
source = @getSource() source = @getSource()
codeHasChangedSignificantly = force or @spell.hasChangedSignificantly source, aether.raw codeHasChangedSignificantly = force or @spell.hasChangedSignificantly source, aether.raw
return unless codeHasChangedSignificantly or @spellThang isnt @lastUpdatedAetherSpellThang needsUpdate = codeHasChangedSignificantly or @spellThang isnt @lastUpdatedAetherSpellThang
return if not needsUpdate and aether is @displayedAether
castAether = @spellThang.castAether castAether = @spellThang.castAether
codeIsAsCast = castAether and not @spell.hasChangedSignificantly source, castAether.raw codeIsAsCast = castAether and not @spell.hasChangedSignificantly source, castAether.raw
aether = castAether if codeIsAsCast aether = castAether if codeIsAsCast
return if not needsUpdate and aether is @displayedAether
# Now that that's figured out, perform the update. # Now that that's figured out, perform the update.
@clearAetherDisplay() @clearAetherDisplay()
@ -307,6 +309,7 @@ module.exports = class SpellView extends View
@highlightCurrentLine {} # This'll remove all highlights @highlightCurrentLine {} # This'll remove all highlights
displayAether: (aether) -> displayAether: (aether) ->
@displayedAether = aether
isCast = not _.isEmpty(aether.metrics) or _.some aether.problems.errors, {type: 'runtime'} isCast = not _.isEmpty(aether.metrics) or _.some aether.problems.errors, {type: 'runtime'}
@problems = [] @problems = []
annotations = [] annotations = []
@ -379,7 +382,7 @@ module.exports = class SpellView extends View
#console.log thangID, "got new castAether with raw", aether.raw, "problems", aether.problems #console.log thangID, "got new castAether with raw", aether.raw, "problems", aether.problems
spellThang.castAether = aether spellThang.castAether = aether
spellThang.aether = @spell.createAether e.world.getThangByID(thangID) spellThang.aether = @spell.createAether e.world.getThangByID(thangID)
console.log thangID, @spell.spellKey, "ran", aether.metrics.callsExecuted, "times over", aether.metrics.statementsExecuted, "statements, with max recursion depth", aether.metrics.maxDepth, "and full flow/metrics", aether.metrics, aether.flow #console.log thangID, @spell.spellKey, "ran", aether.metrics.callsExecuted, "times over", aether.metrics.statementsExecuted, "statements, with max recursion depth", aether.metrics.maxDepth, "and full flow/metrics", aether.metrics, aether.flow
@spell.transpile() @spell.transpile()
@updateAether false, false @updateAether false, false
@ -427,12 +430,6 @@ module.exports = class SpellView extends View
#console.log "got call index", currentCallIndex, "for time", @thang.world.age, "out of", states.length #console.log "got call index", currentCallIndex, "for time", @thang.world.age, "out of", states.length
# TODO: don't redo the markers if they haven't actually changed # TODO: don't redo the markers if they haven't actually changed
text = @aceDoc.getValue()
offsetToPos = (offset) ->
# TODO: use the nice conversion utils David put into Aether
rows = text.substr(0, offset).split '\n'
{row: rows.length - 1, column: _.last(rows).length}
for markerRange in (@markerRanges ?= []) for markerRange in (@markerRanges ?= [])
markerRange.start.detach() markerRange.start.detach()
markerRange.end.detach() markerRange.end.detach()
@ -451,7 +448,7 @@ module.exports = class SpellView extends View
marked = {} marked = {}
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex? lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
for state, i in lastExecuted for state, i in lastExecuted
[start, end] = [offsetToPos(state.range[0]), offsetToPos(state.range[1])] [start, end] = state.range
clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed' clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed'
if clazz is 'executed' if clazz is 'executed'
continue if marked[start.row] continue if marked[start.row]
@ -460,7 +457,7 @@ module.exports = class SpellView extends View
else else
@debugView.setVariableStates state.variables @debugView.setVariableStates state.variables
markerType = "text" markerType = "text"
markerRange = new Range(start.row, start.column, end.row, end.column) markerRange = new Range start.row, start.col, end.row, end.col
markerRange.start = @aceDoc.createAnchor markerRange.start markerRange.start = @aceDoc.createAnchor markerRange.start
markerRange.end = @aceDoc.createAnchor markerRange.end markerRange.end = @aceDoc.createAnchor markerRange.end
markerRange.id = @aceSession.addMarker markerRange, clazz, markerType markerRange.id = @aceSession.addMarker markerRange, clazz, markerType

View file

@ -32,7 +32,7 @@
"firepad": "~0.1.2", "firepad": "~0.1.2",
"marked": "~0.3.0", "marked": "~0.3.0",
"moment": "~2.5.0", "moment": "~2.5.0",
"aether": "~0.0.9", "aether": "~0.1.2",
"underscore.string": "~2.3.3", "underscore.string": "~2.3.3",
"firebase": "~1.0.2" "firebase": "~1.0.2"
}, },