Sublime Forum

Auto-detecting syntax on paste doesn't fully work

#1
  1. Say I’m editing a .sql file in Sublime. Syntax highlighting and syntax-specific settings are working fine.
  2. I copy some code from it.
  3. I open a new Sublime tab. I look in the lower right and see that the syntax starts out as “plain text.” Makes sense.
  4. I paste my SQL code into the new tab. The indicator in the lower right changes to “SQL” automatically, and it is indeed highlighting the SQL syntax. Sweet! But wait a minute, the new window is still acting as if it’s a plain-text file from the standpoint of what settings are being applied to it. For instance, my plain text color scheme is being shown, not my default color scheme (which is what it should be using for SQL code). And my SQL-specific rulers aren’t showing, and my SQL-specific wrap-width is also wrong.
  5. I manually set the syntax to “SQL,” and now everything works fine.

Is this a bug? Sublime seems to be smart enough to know that pasting from a known syntax to a blank file should trigger a syntax-highlighting change, but then it doesn’t fully follow through on it.

I’m running version 3.1.1.

1 Like

#2

Sounds like a bug to me. Would you mind reporting this at https://github.com/SublimeTextIssues/Core/issues so we don’t lose track of it, after confirming there isn’t a similar issue already?

0 Likes