Sublime Forum

Change file type syntax

#1

Hi all,

It would be great to be able to change the syntax for a file extension. The only GDScript syntax package doesn’t appear to be updated for Godot 4, but changing .gd to python would get me part-way there.

Thanks!

0 Likes

#2

You can permanently set the syntax for a specific extension by going to View > Syntax > Open all with current extension as… and selecting the syntax you want for the current file’s extension.

0 Likes

#3

Are we talking about Sublime Merge here?

0 Likes

#4

Thanks for the reply! Unless I’m mistaken this seems to be for Sublime Text, however I’m trying to solve this in Sublime Merge. I found this post, which shows how to use Sublime Text packages in Sublime Merge. But like I said, the GDScript syntax package is unfortunately out of date.

0 Likes

#5

Sublime Merge treats settings files very much like Sublime Text.

The proposed Sublime Text command to re-assign file extensions creates a syntax specific settings file Packages/User/.sublime-settings.

You could create such a file (Python.sublime-settings) manually in SM’s User package.

{
    "extensions": ["gd"]
}

Not very ergonomic, but it should work.

0 Likes

#6

Thanks, this works! (Unfortunately it also correctly displays syntax errors, which means I’m back to square one because GDScript’s syntax isn’t 1:1 with python, hehe.)

0 Likes