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

.sample files recognized as Shell Script files but not all #12810

Closed
1 task done
Angelk90 opened this issue Jun 8, 2024 · 1 comment
Closed
1 task done

.sample files recognized as Shell Script files but not all #12810

Angelk90 opened this issue Jun 8, 2024 · 1 comment
Labels
bash Bash scripting support support User support (non-defect troubleshooting, documentation, etc)

Comments

@Angelk90
Copy link
Contributor

Angelk90 commented Jun 8, 2024

Check for existing issues

  • Completed

Describe the feature

All the .sample files I have on .git/hooks are recognized as Shell Script, except one fsmonitor-watchman.sample.

The only difference I noticed is that all sample files start with #!/bin/sh, whereas the fsmonitor-watchman.sample file starts with #!/usr/bin/perl.

Going to check the extensions for the path_suffixes for Shell Script I noticed that the sample extension is not found.
So how do sample files get recognized as Shell Script?

name = "Shell Script"
code_fence_block_name = "bash"
grammar = "bash"
path_suffixes = ["sh", "bash", "bashrc", "bash_profile", "bash_aliases", "bash_logout", "profile", "zsh", "zshrc", "zshenv", "zsh_profile", "zsh_aliases", "zsh_histfile", "zlogin", "zprofile", ".env", "PKGBUILD"]

Recognized sample file:

Screenshot 2024-06-08 alle 19 56 44

Unrecognized sample file:

Screenshot 2024-06-08 alle 19 57 05

Going to see how vscode behaves, this file is recognized as perl, as can be seen from its initial wording #!/usr/bin/perl is a perl example file.

So how are other files recognized as Shell script ?

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@Angelk90 Angelk90 added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Jun 8, 2024
@Moshyfawn Moshyfawn added language An umbrella label for all programming languages syntax behaviors and removed triage Maintainer needs to classify the issue labels Jun 10, 2024
@JosephTLyons JosephTLyons removed the admin read Pending admin review label Jun 11, 2024
@notpeter notpeter added bash Bash scripting support support User support (non-defect troubleshooting, documentation, etc) and removed enhancement [core label] language An umbrella label for all programming languages syntax behaviors labels Dec 16, 2024
@notpeter
Copy link
Member

This is working as-designed. That file is not a Shell Script, it is a perl script. If you install the Perl extension it will auto-identify the shebang and toggle the language to Perl.
https://github.com/tree-sitter-perl/zed-perl/blob/master/languages/perl/config.toml

If it were detected as a Shell Script the syntax highlighting would be for the wrong language (POSIX Shell, not Perl).

@notpeter notpeter closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash Bash scripting support support User support (non-defect troubleshooting, documentation, etc)
Projects
None yet
Development

No branches or pull requests

4 participants