Sublime Forum

AutoSetSyntax v2

#1

AutoSetSyntax v2 has been released.
It’s thoroughly rewritten to provide new features and utilize ST 4 APIs and Python 3.8.

If you are new, AutoSetSyntax helps you set the syntax for a view automatically in various ways:

  • Default syntax for new files.
  • Detecting the syntax when modifying the file.
  • Trimming unimportant suffixes from the filename.
  • Assigning syntax by the first line.
  • User-defined rules.

Installation

This package is available on Package Control by the name of AutoSetSyntax.

If you are already using v1 with ST 4, it will be auto upgraded to v2.
To migrate your v1 settings, check the migration guide.

Documentation

2 Likes

No File Type Options When saving
#2

Version 2.3.0

1 Like

#3

Hi Jack. I use Windows, and my nodeJS was installed through Scoop. It is in the variable PATH. For some reason, I can’t download the AutoSetSyntax: Guesslang package from the command palette.

Any suggestions?

0 Likes

#4

The server tarball is hosted on GitHub. If somehow you cannot download the server via the command palette, you can manually download https://github.com/jfcherng-sublime/ST-AutoSetSyntax/archive/refs/tags/server-0.0.1.zip and decompress it so that the file/folder structure is like

Snipaste_2021-09-17_03-02-54

1 Like

#5

Thanks for the assist. The funniest thing happened:

  1. I downloaded the Guesslang package manually and put it in AppData/Local/Sublime/Package Storage.

  2. Renamed the directory to AutoSetSytax. It didn’t work.

  3. I decided to try the command palette again. And this time, the Guesslang downloaded.

TL;DR: All I needed to do was to create a folder named AutoSetSyntax in Package Storage directory.

1 Like

#6

thanks! culprit found. will fix tomorrow!

1 Like

#7

Version 2.4.0

Inspired by https://discord.com/channels/280102180189634562/280157083356233728/939405434157146142.

This release allows you to set a default syntax for the build / exec output panel. By default, AutoSetSyntax uses a bundled syntax which dims out messages like [Finished in xxx] by giving them a comment scope. Hopefully, this makes you less distracted.

Snipaste_2022-02-05_19-23-14

If you want to customize the color, its scope is comment.status.autosetsyntax.exec.

1 Like

#8

AutoSetSyntax v3 has been released.

The old gusslang (or actually https://github.com/microsoft/vscode-languagedetection) has been removed and replaced by Google’s magika (https://github.com/google/magika), which can be used as a python lib directly and luckily py38 can use it.

Although I say it’s an experimental feature but I highly recommend you to try it (see https://jfcherng-sublime.github.io/ST-AutoSetSyntax/experimental/dl-based-syntax-detection/).

2 Likes