ModernPerl-sublime
ModernPerl-sublime copied to clipboard
Keeps going back to Perl syntax
It seems like all of the old files keep going back to regular Perl, even though I have selected "always use ModernPerl for these filetypes". Is there a way to force ModernPerl to be always used? I read in the description that because it comes first in ASCII sorting, it should always come first, but it doesn't seem to be so.
I think it's an issue with Sublime storing and caching the language each file is opened with. Try closing and reopening any afflicted files. If the problem is happening for a Sublime project of yours, I'd probably try closing all the Perl files, deleting the project's .sublime-workspace file, and then reopening them. Tell me if that works!
If none of this works, then my last suggestion is to slightly edit the regular Perl syntax file. Go to Sublime > Preferences > Browse Packages > Perl > and then open the file Perl.tmLanguage. Near the top of the file you'll see:
<key>fileTypes</key>
Delete everything between the <array>
and </array>
straight after this.
Also delete these two lines:
<key>firstLineMatch</key>
<string>^#!.*\bperl\b</string>
After that ModernPerl will definitely be picked by all newly opened Perl files.
I also experienced this issue. I was able to fix it by doing the following:
View -> Syntax -> Open all with current extension as... -> ModernPerl
When I had a pl
and pm
file open. (You can also do the same by clicking on 'Perl' in the lower right.)
Yeah, I've done that. But it seems to open files that have been open before with Perl still. But only newly opened files open with ModernPerl. Even if I close the file and re-open, just because it was open with Perl before, it stays.
Sorry about that. I missed that you mentioned that you did that in your original post.
So far, it appears to work for me. The lexical ordering mentioned in the readme didn't seem to do anything at all though (but maybe it works for new projects).
Not sure how to fix it opening files that have been set to read with the Perl syntax as ModernPerl. There must be some cache to delete, but I don't know what. I've added a settings file to the package now which should definitely force ModernPerl syntax for new files. But I can't do much about old files.
New idea.
Close all the Perl files that keep going back to the original syntax. Then go to Preferences > Browse Packages. Close Sublime Text at this point. Then inside the Packages folder you just opened up, go to the Default folder. Inside there, delete all .cache files. Then reopen Sublime. I reckon that just might do it!
Tell me if it worked.