Do not require plugins to set 'since' field (#4038)

* Do not require plugins to set 'since' field

* Refactor
master
Lucas Azzola 2018-02-24 19:00:51 +11:00 committed by GitHub
parent 010933375c
commit a0668129da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 6 deletions

View File

@ -255,7 +255,12 @@ function getSupportInfo(version, opts) {
const languages = plugins
.reduce((all, plugin) => all.concat(plugin.languages), [])
.filter(language => language.since && semver.gte(version, language.since))
.filter(
language =>
language.since
? semver.gte(version, language.since)
: language.since !== null
)
.map(language => {
// Prevent breaking changes
if (language.name === "Markdown") {

View File

@ -13,7 +13,8 @@ const languages = [
extensions: [".handlebars", ".hbs"],
tm_scope: "text.html.handlebars",
ace_mode: "handlebars",
language_id: 155
language_id: 155,
since: null // unreleased
}
];

View File

@ -8,7 +8,7 @@ const printer = require("./printer-htmlparser2");
const languages = [
{
name: "HTML",
since: undefined, // unreleased
since: null, // unreleased
parsers: ["parse5"],
group: "HTML",
tmScope: "text.html.basic",

View File

@ -81,7 +81,7 @@ function inferParser(filepath, plugins) {
pluginsLoaded: true
}).languages.find(
language =>
typeof language.since === "string" &&
language.since !== null &&
(language.extensions.indexOf(extension) > -1 ||
(language.filenames &&
language.filenames.find(name => name.toLowerCase() === filename)))

View File

@ -7,8 +7,7 @@ module.exports = {
{
name: "foo",
parsers: ["foo-parser"],
extensions: [".foo"],
since: "1.0.0"
extensions: [".foo"]
}
],
parsers: {