Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language support for hosts files #6391

Merged
merged 9 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2812,6 +2812,15 @@ HolyC:
codemirror_mode: clike
codemirror_mime_type: text/x-csrc
language_id: 928121743
Hosts File:
type: data
color: "#308888"
filenames:
- HOSTS
- hosts
tm_scope: source.hosts
ace_mode: text
language_id: 231021894
Hy:
type: programming
ace_mode: text
Expand Down Expand Up @@ -2870,7 +2879,9 @@ INI:
- ".coveragerc"
- ".flake8"
- ".pylintrc"
- HOSTS
- buildozer.spec
- hosts
- pylintrc
tm_scope: source.ini
aliases:
Expand Down
2 changes: 2 additions & 0 deletions samples/Hosts File/filenames/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
127.0.0.1 localhost
::1 localhost
13 changes: 13 additions & 0 deletions samples/INI/filenames/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[dev]
dev-rhel8-55 ansible_host=192.168.100.4

[nodes]
node1 ansible_host=192.168.56.25

[nodes:vars]
ansible_ssh_private_key_file=/home/ansible/.ssh/id_rsa
ansible_user=devops

[dev:vars]
ansible_ssh_private_key_file=/home/ansible/.ssh/id_rsa
ansible_user=devops
6 changes: 5 additions & 1 deletion test/test_samples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_filename_listed
Samples.each do |sample|
if sample[:filename]
listed_filenames = Language[sample[:language]].filenames
listed_filenames -= ["HOSTS"] if ["Hosts File", "INI"].include?(sample[:language])
assert_includes listed_filenames, sample[:filename], "#{sample[:path]} isn't listed as a filename for #{sample[:language]} in languages.yml"
end
end
Expand Down Expand Up @@ -90,6 +91,9 @@ def test_filename_listed
end

language.filenames.each do |filename|
# Kludge for an unusual edge-case; see https://bit.ly/41EyUkU
next if ["Hosts File", "INI"].include?(language.name) && filename == "HOSTS"

# Check for samples if more than one language matches the given filename
if Language.find_by_filename(filename).size > 1
sample = "samples/#{language.name}/filenames/#{filename}"
Expand All @@ -99,7 +103,7 @@ def test_filename_listed
end
end
end

def case_insensitive_glob(extension)
glob = ""
extension.each_char do |c|
Expand Down
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Haxe:** [vshaxe/haxe-TmLanguage](https://github.com/vshaxe/haxe-TmLanguage)
- **HiveQL:** [adidonato/language-hql](https://github.com/adidonato/language-hql)
- **HolyC:** [codingdandy/holyc.tmbundle](https://github.com/codingdandy/holyc.tmbundle)
- **Hosts File:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc)
- **Hy:** [tshakalekholoane/vscode-hy](https://github.com/tshakalekholoane/vscode-hy)
- **IDL:** [mgalloy/idl.tmbundle](https://github.com/mgalloy/idl.tmbundle)
- **IGOR Pro:** [byte-physics/language-igor](https://github.com/byte-physics/language-igor)
Expand Down
2 changes: 1 addition & 1 deletion vendor/grammars/language-etc
Submodule language-etc updated 1 files
+1 −1 grammars/bc.cson
2 changes: 1 addition & 1 deletion vendor/licenses/git_submodule/language-etc.dep.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: language-etc
version: 3105677722c633c6d2c4220c560332cf5c732b91
version: e20bdb25727c1c2828372d065d752aeeb9ee39dd
type: git_submodule
homepage: https://github.com/Alhadis/language-etc
license: isc
Expand Down