nicosantangelo / sublime-gulp

Run Gulp tasks and use snippets from Sublime Text
https://sublime-gulp.nicosantangelo.com/
MIT License
155 stars 18 forks source link

"results_in_new_tab": true not working #96

Open Rick-Lannan-A139973-AGL opened 6 years ago

Rick-Lannan-A139973-AGL commented 6 years ago

The "results_in_new_tab": true setting isn't working. I can see the setting is applied by running Settings().get('results_in_new_tab') in the Console but it's not opening in a new tab. The following is being output into the Console when I run a gulp command:

Traceback (most recent call last): File "C:\Users\Rick Lannan\AppData\Roaming\Sublime Text 3\Packages\Gulp\gulp.py", line 204, in task_list_callback self.run_gulp_task() File "C:\Users\Rick Lannan\AppData\Roaming\Sublime Text 3\Packages\Gulp\gulp.py", line 207, in run_gulp_task task = self.construct_gulp_task() File "C:\Users\Rick Lannan\AppData\Roaming\Sublime Text 3\Packages\Gulp\gulp.py", line 211, in construct_gulp_task self.show_running_status_in_output_panel() File "C:\Users\Rick Lannan\AppData\Roaming\Sublime Text 3\Packages\Gulp\gulp.py", line 234, in show_running_status_in_output_panel self.show_output_panel("Running '%s'%s...\n" % (self.task_name, with_flag_text)) File "C:\Users\Rick Lannan\AppData\Roaming\Sublime Text 3\Packages\Gulp\base_command.py", line 78, in show_output_panel new_tab_path = os.path.join(self.gulp_results_path(), "Gulp Results") File "C:\Users\Rick Lannan\AppData\Roaming\Sublime Text 3\Packages\Gulp\base_command.py", line 90, in gulp_results_path return next(folder_path for folder_path in self.searcheable_folders if self.working_dir.find(folder_path) != -1) if self.working_dir else ""

Rick-Lannan-A139973-AGL commented 6 years ago

I'm on a windows machine and I was able to temporarily workaround the issue by replacing line 78 with: new_tab_path = os.path.join(os.environ['USERPROFILE'], "Gulp Results")

Seems the error was coming was from the gulp_results_path function

nicosantangelo commented 6 years ago

Hello, thanks for the report!

gulp_results_path can definitely throw, but it really shouldn't in that scenario so, can I ask you for a favor? What's the value of self.sercheable_folders (typo fixed no master 😅 ) and working_dir here:

def gulp_results_path(self):
    print(self.searcheable_folders) # <--- here
    print(self.working_dir) # <--- here
    return next(folder_path for folder_path in self.searcheable_folders if self.working_dir.find(folder_path) != -1) if self.working_dir else ""

I don't have a Windows box handy and that would really help debugging, so I don't just add a try:except blind

Thanks!

Rick-Lannan-A139973-AGL commented 6 years ago

They both have values. Here is the output ['C:\projects\AGL\AGL.Digital.Sitecore\src\Project\Primary\AGL.Digital.Web.Project.Primary.LivingStyleGuide\styleguide'] C:\projects\AGL\AGL.Digital.Sitecore\src\Project\Primary\AGL.Digital.Web.Project.Primary.LivingStyleGuide