Closed jdanbrown closed 6 years ago
OK, btw, how do you call? Can you share me the repo and code where you call buildCommandSpecsFromKeyBindings
?
Sure, but beware that the repo is still super hacky and not yet published as a proper atom package:
And here's how I call it (copied from the link in the previous comment):
// 'keystroke ...' keymaps automatically work only for the user's ~/.atom/keymap.cson keymaps. We have to manually
// register them for our own package keymap/*.cson keymaps.
keystroke.main.registerCommands(keystroke.main.buildCommandSpecsFromKeyBindings(
atom.keymaps.getKeyBindings().filter(k =>
// Check exists because builtin sources aren't valid paths, e.g. 'core:...'
fs.existsSync(k.source) &&
// Use realpath in case any ~/.atom/packages/foo are symlinks
fs.realpathSync(k.source).startsWith(`${atom.packages.resolvePackagePath('hydrogen-extras')}/keymaps/`)
)
)),
After checking your package and usage of buildCommandSpecsFromKeyBindings
, what you want is service provided by keystroke pkg.
I don't want keystroke pkg's function directly imported and used by outer-pkg.
It will be break when I forget it is used in other place.
So I will provide service function which you can depend on from your pkg. Give me one or two days for that.
To be clear. I won't merge this PR, but will keep open until I implement service feature.
Sounds great! This definitely felt like a brittle hack, and I'd be happy to rely on a proper service instead.
Will close, and see changes in #10 and updated readme to check how to use.
'keystroke ...'
in my keymaps, so I'd like for the package to be able to callbuildCommandSpecsFromKeyBindings(...)
on its own keymaps