From c4d14b9550ae46902841bdab3809b05cda8e16c7 Mon Sep 17 00:00:00 2001 From: Mitchell Garcia Date: Tue, 3 May 2016 14:06:19 -0400 Subject: [PATCH] Open route.js file if no component found --- EmberComponentSplitView.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/EmberComponentSplitView.py b/EmberComponentSplitView.py index 548d927..87f1d0e 100644 --- a/EmberComponentSplitView.py +++ b/EmberComponentSplitView.py @@ -6,7 +6,10 @@ class EmberComponentSplitViewCommand(sublime_plugin.WindowCommand): # @return {String} newFile - the file to open def findCompanionPodStructure(self): if 'hbs' in self.reference_file_type: - companion_file = self.reference_file_path + '/component.js' + if 'components' in self.reference_file_path: + companion_file = self.reference_file_path + '/component.js' + else: + companion_file = self.reference_file_path + '/route.js' else: companion_file = self.reference_file_path + '/template.hbs' @@ -18,8 +21,12 @@ def findCompanionFolderStucture(self): base_path = self.reference_file_path.rsplit('/app/', 1)[0] + '/app/' if 'hbs' in self.reference_file_type: - companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.js' - companion_file = base_path + 'components/' + self.reference_file_location + '/' + companion_file_name + if 'components' in self.reference_file_path: + companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.js' + companion_file = base_path + 'components/' + self.reference_file_location + '/' + companion_file_name + else: + companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.js' + companion_file = base_path + 'routes/' + self.reference_file_location + '/' + companion_file_name else: companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.hbs' companion_file = base_path + 'templates/' + self.reference_file_location + '/' + companion_file_name