Stopped language-excluded docs from showing up undocumented in the 'this' area of the spell palette.

This commit is contained in:
Nick Winter 2014-07-15 18:54:55 -07:00
parent 03cc2d1af0
commit 906ab3ac2b

View file

@ -55,9 +55,12 @@ module.exports = class SpellPaletteView extends View
createPalette: -> createPalette: ->
lcs = @supermodel.getModels LevelComponent lcs = @supermodel.getModels LevelComponent
allDocs = {} allDocs = {}
excludedDocs = {}
for lc in lcs for lc in lcs
for doc in (lc.get('propertyDocumentation') ? []) for doc in (lc.get('propertyDocumentation') ? [])
continue if doc.codeLanguages and not (@options.language in doc.codeLanguages) if doc.codeLanguages and not (@options.language in doc.codeLanguages)
excludedDocs[doc.name] = doc
continue
allDocs['__' + doc.name] ?= [] allDocs['__' + doc.name] ?= []
allDocs['__' + doc.name].push doc allDocs['__' + doc.name].push doc
if doc.type is 'snippet' then doc.owner = 'snippets' if doc.type is 'snippet' then doc.owner = 'snippets'
@ -100,9 +103,11 @@ module.exports = class SpellPaletteView extends View
doc = _.find (allDocs['__' + prop] ? []), (doc) -> doc = _.find (allDocs['__' + prop] ? []), (doc) ->
return true if doc.owner is owner return true if doc.owner is owner
return (owner is 'this' or owner is 'more') and (not doc.owner? or doc.owner is 'this') return (owner is 'this' or owner is 'more') and (not doc.owner? or doc.owner is 'this')
console.log 'could not find doc for', prop, 'from', allDocs['__' + prop], 'for', owner, 'of', propGroups unless doc if not doc and not excludedDocs[prop]
doc ?= prop console.log 'could not find doc for', prop, 'from', allDocs['__' + prop], 'for', owner, 'of', propGroups unless doc
@entries.push @addEntry(doc, shortenize, tabbify, owner is 'snippets') doc ?= prop
if doc
@entries.push @addEntry(doc, shortenize, tabbify, owner is 'snippets')
groupForEntry = (entry) -> groupForEntry = (entry) ->
return 'more' if entry.doc.owner is 'this' and entry.doc.name in (propGroups.more ? []) return 'more' if entry.doc.owner is 'this' and entry.doc.name in (propGroups.more ? [])
entry.doc.owner entry.doc.owner