Search code examples
sublimetext3sublimetextsyntax-highlightingsublime-syntax

When do changes to Sublime Text 3 syntax files take effect?


I'm writing a syntax definition for Sublime Text 3, using the new YAML fornat and not the deprecated one. I'm not seeing changes to the text I'm trying to highlight, though. When are changes to my syntax definition file applied to the files it's meant to highlight? And if I can force a definition reload, how can I do so?


Solution

  • Changes to .sublime-syntax files take effect as soon as they are saved - ST detects any changes made when the file is within the Packages folder structure. You can see this in the ST console (View menu -> Show Console) when saving the file:

    generating syntax summary

    Unfortunately, there is no timestamp on the entries, so sometimes it can help to manually enter something into the console to help visually separate the lines. i.e.

    import time; time.asctime(time.localtime())
    

    'Mon Jan 8 09:11:06 2018'

    then, you know any lines that appear under that in the console happened after that time.

    One caveat is that ST currently doesn't detect changes automatically when the files are in a symlinked folder: https://github.com/SublimeTextIssues/Core/issues/1154

    In such cases, the only way to get ST to reload modified/new files is by restarting ST.