Don't add pane items in built-in resource openers

Calling `workspace.open` in an opener doesn't work properly with options
like `split: left` because it causes the opened item to be added to the
workspace as a side-effect. Since workspace openers are intended to be
used during the process of calling `workspace.open`, we need to use
`openTextFile`, which just creates an editor but does not attach it to
the workspace.
This commit is contained in:
Nathan Sobo
2017-01-09 10:57:31 -07:00
parent 3430040b8d
commit 730c7c82a8

View File

@@ -284,13 +284,13 @@ class AtomEnvironment extends Model
@workspace.addOpener (uri) =>
switch uri
when 'atom://.atom/stylesheet'
@workspace.open(@styles.getUserStyleSheetPath())
@workspace.openTextFile(@styles.getUserStyleSheetPath())
when 'atom://.atom/keymap'
@workspace.open(@keymaps.getUserKeymapPath())
@workspace.openTextFile(@keymaps.getUserKeymapPath())
when 'atom://.atom/config'
@workspace.open(@config.getUserConfigPath())
@workspace.openTextFile(@config.getUserConfigPath())
when 'atom://.atom/init-script'
@workspace.open(@getUserInitScriptPath())
@workspace.openTextFile(@getUserInitScriptPath())
registerDefaultTargetForKeymaps: ->
@keymaps.defaultTarget = @views.getView(@workspace)