This PR fixes semanticolor's tree-sitter support in beta and nightly builds, which is currently broken because of how the Atom's version is being checked by semver.
The problematic code snippet is semver.satisfies(atom.getVersion(), '>=1.52.0'). This works fine for regular builds, where the version string is a bare semver string like 1.59.0, but beta and nightly builds return a version string ending in ...-beta0 and ...-nightly0, resp, and semver doesn't understand them.
This results in beta and nightly users of sematicolor not having access to the tree-sitter support and always being forced to use the TM grammars.
This PR fixes semanticolor's tree-sitter support in beta and nightly builds, which is currently broken because of how the Atom's version is being checked by
semver
.The problematic code snippet is
semver.satisfies(atom.getVersion(), '>=1.52.0')
. This works fine for regular builds, where the version string is a bare semver string like1.59.0
, but beta and nightly builds return a version string ending in...-beta0
and...-nightly0
, resp, and semver doesn't understand them. This results in beta and nightly users of sematicolor not having access to the tree-sitter support and always being forced to use the TM grammars.My solution is to just use
semver.coerce(atom.getVersion())
to chop off the trailing build type. Docs forcoerce
are at https://github.com/npm/node-semver#coercionI've poked around at this locally and it's working just fine: semanticolor is working w/ tree-sitter grammars as expected.
Thanks!