Remove getAllKeyMappings

This commit is contained in:
probablycorey 2013-11-14 14:46:21 -08:00
parent dd0938dca6
commit c43f277c5b
2 changed files with 3 additions and 42 deletions

View File

@ -323,17 +323,6 @@ describe "Keymap", ->
expect(Object.keys(bindings).length).toBe 1
expect(bindings['g']).toEqual "command-and-grandchild-node"
describe ".getAllKeyMappings", ->
it "returns the all bindings", ->
keymap.bindKeys path.join('~', '.atom', 'packages', 'dummy', 'keymaps', 'a.cson'), '.command-mode', 'k': 'c'
mappings = keymap.getAllKeyMappings()
expect(mappings.length).toBe 1
expect(mappings[0].source).toEqual 'dummy'
expect(mappings[0].keystroke).toEqual 'k'
expect(mappings[0].command).toEqual 'c'
expect(mappings[0].selector).toEqual '.command-mode'
describe ".determineSource", ->
describe "for a package", ->
it "returns '<package-name>'", ->

View File

@ -61,29 +61,6 @@ class Keymap
firstKeystroke = keystroke.split(' ')[0]
_.remove(@bindingSetsByFirstKeystroke[firstKeystroke], bindingSet)
# Private: Returns a user friendly description of where a keybinding was
# loaded from.
#
# * filePath:
# The absolute path from which the keymap was loaded
#
# Returns one of:
# * `Core` indicates it comes from a bundled package.
# * `User` indicates that it was defined by a user.
# * `<package-name>` the package which defined it.
# * `Unknown` if an invalid path was passed in.
determineSource: (filePath) ->
return 'Unknown' unless filePath
pathParts = filePath.split(path.sep)
if _.contains(pathParts, 'node_modules') or _.contains(pathParts, 'atom') or _.contains(pathParts, 'src')
'Core'
else if _.contains(pathParts, '.atom') and _.contains(pathParts, 'keymaps') and !_.contains(pathParts, 'packages')
'User'
else
packageNameIndex = pathParts.length - 3
pathParts[packageNameIndex]
bindKeys: (args...) ->
name = args.shift() if args.length > 2
[selector, bindings] = args
@ -129,6 +106,9 @@ class Keymap
shouldBubble ? true
# Public: Returns an array of objects that represent every keystroke to
# command mapping. Each object contains the following keys `source`,
# `selector`, `command`, `keystroke`, `index`, `specificity`.
allMappings: ->
mappings = []
@ -217,14 +197,6 @@ class Keymap
# Deprecated
#
# Public: Returns an array of objects that represent every keystroke to
# command mapping. Each object contains the following keys `source`,
# `selector`, `command`, `keystroke`.
getAllKeyMappings: ->
@allMappings().map (mapping) =>
mapping.source = @determineSource(mapping.source)
mapping
bindingsForElement: (element) ->
keystrokeMap = {}
mappings = @mappingsMatchingElement(@allMappings(), element)