Error loading tmLanguage and tmTheme files in Sublime Text 3
Asked Answered
E

1

0

With Sublime Text 2 I was able to style an output panel with

MyOutputView.set_syntax_file("/Path_to/my.tmLanguage")
MyOutputView.settings().set("color_scheme", "/Path_to/my.tmTheme")

in the current beta (3047) of Sublime Text 3 two windows pop up with the following messages (they also get printed to the console):

Error loading syntax file "/Path_to/my.tmLanguage": Unable to open /Path_to/my.tmLanguage

and:

Error loading colour scheme /Path_to/my.tmTheme: Unable to open /Path_to/my.tmTheme

Is this a bug that I should report, did the API change, did sublime move away from tm files?

Earthman answered 25/10, 2013 at 18:40 Comment(3)
try using paths like "Packages/MyStuff/My.tmLanguage" and see if that works - I'm not sure if those functions can accept absolute paths...Choi
I deleted my previous comment, what you suggest actually works! If you make it an answer, I'll accept it! Thanks so much, this has frustrated me for the past hour.Earthman
you're quite welcome :)Choi
C
1

From the ST3 API docs, it seems that most of the paths are relative, either to Packages or Installed Packages, depending on the class/method you're looking at. Since plugins should be designed for portability between 3 different platforms, and between standard and portable installs, relative paths are a good idea. Try setting your code to:

MyOutputView.set_syntax_file("Packages/MyLang/my.tmLanguage")
MyOutputView.settings().set("color_scheme", "Packages/MyColorScheme/my.tmTheme")

and you should be all set.

Choi answered 25/10, 2013 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.