plugin/efmls-configs: Map languages to filetypes (#564)

This commit is contained in:
traxys 2023-08-28 23:44:42 +02:00 committed by GitHub
parent e704db3064
commit 6c656c14d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 17 deletions

View file

@ -11,6 +11,62 @@ tools = {
"formatters": {}, "formatters": {},
} }
identity_langs = [
"bash",
"c",
"clojure",
"cmake",
"crystal",
"csh",
"css",
"d",
"dart",
"fish",
"gitcommit",
"go",
"haskell",
"html",
"java",
"javascript",
"json",
"ksh",
"less",
"lua",
"markdown",
"nix",
"pawn",
"php",
"python",
"roslyn",
"ruby",
"rust",
"sass",
"scss",
"sh",
"slim",
"sml",
"solidity",
"toml",
"typescript",
"vala",
"vim",
"yaml",
"zsh",
"misc",
]
lang_map = {
"c#": "cs",
"c++": "cpp",
"docker": "dockerfile",
"objective-c": "objc",
"objective-c++": "objcpp",
"terraform": "tf",
}
for lang in identity_langs:
lang_map[lang] = lang
for kind in ["linters", "formatters"]: for kind in ["linters", "formatters"]:
for file in os.listdir(tool_path + "/" + kind): for file in os.listdir(tool_path + "/" + kind):
tool_name = file.removesuffix(".lua") tool_name = file.removesuffix(".lua")
@ -19,7 +75,8 @@ for kind in ["linters", "formatters"]:
for line in f.readlines(): for line in f.readlines():
if line.startswith("-- languages:"): if line.startswith("-- languages:"):
languages = [ languages = [
l.strip() for l in line.split(":")[1].strip().split(",") lang_map[l.strip()]
for l in line.split(":")[1].strip().split(",")
] ]
break break
tools[kind][tool_name] = languages tools[kind][tool_name] = languages

View file

@ -5,7 +5,7 @@
], ],
"astyle": [ "astyle": [
"c", "c",
"c++" "cpp"
], ],
"autopep8": [ "autopep8": [
"python" "python"
@ -25,11 +25,11 @@
], ],
"clang_format": [ "clang_format": [
"c", "c",
"c++" "cpp"
], ],
"clang_tidy": [ "clang_tidy": [
"c", "c",
"c++" "cpp"
], ],
"dartfmt": [ "dartfmt": [
"dart" "dart"
@ -38,7 +38,7 @@
"d" "d"
], ],
"dotnet_format": [ "dotnet_format": [
"c#" "cs"
], ],
"dprint": [ "dprint": [
"javascript", "javascript",
@ -153,16 +153,16 @@
"lua" "lua"
], ],
"terraform_fmt": [ "terraform_fmt": [
"terraform" "tf"
], ],
"uncrustify": [ "uncrustify": [
"c", "c",
"c++", "cpp",
"c#", "cs",
"d", "d",
"java", "java",
"objective-c", "objc",
"objective-c++", "objcpp",
"pawn", "pawn",
"vala" "vala"
], ],
@ -192,21 +192,21 @@
], ],
"clang_tidy": [ "clang_tidy": [
"c", "c",
"c++" "cpp"
], ],
"clazy": [ "clazy": [
"c++" "cpp"
], ],
"clj_kondo": [ "clj_kondo": [
"clojure" "clojure"
], ],
"cppcheck": [ "cppcheck": [
"c", "c",
"c++" "cpp"
], ],
"cpplint": [ "cpplint": [
"c", "c",
"c++" "cpp"
], ],
"dartanalyzer": [ "dartanalyzer": [
"dart" "dart"
@ -245,7 +245,7 @@
], ],
"gcc": [ "gcc": [
"c", "c",
"c++" "cpp"
], ],
"gitlint": [ "gitlint": [
"gitcommit" "gitcommit"
@ -260,7 +260,7 @@
"go" "go"
], ],
"hadolint": [ "hadolint": [
"docker" "dockerfile"
], ],
"joker": [ "joker": [
"clojure" "clojure"
@ -278,7 +278,7 @@
"lua" "lua"
], ],
"mcs": [ "mcs": [
"c#" "cs"
], ],
"mypy": [ "mypy": [
"python" "python"