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

Detect file type from modelines #1477

Open
1 task done
nkh opened this issue Nov 29, 2024 · 3 comments
Open
1 task done

Detect file type from modelines #1477

nkh opened this issue Nov 29, 2024 · 3 comments

Comments

@nkh
Copy link

nkh commented Nov 29, 2024

Duplicates

  • I have searched the existing issues

Current behavior 😯

on https://github.com/nkh/ftl, the tool report 500 lines of code, maybe detecting bash code lines needs to looked at

Expected behavior 🤔

report a more accurate number of lines

Steps to reproduce 🕹

clone https://github.com/nkh/ftl
run the tool

Additional context/Screenshots 🔦

No response

Possible Solution 💡

No response

@nkh nkh added the bug Something isn't working label Nov 29, 2024
@spenserblack
Copy link
Collaborator

report a more accurate number of lines

Thanks for the report! Can you provide some more information? Why does the number of lines look inaccurate to you? What number were you expecting?

@nkh
Copy link
Author

nkh commented Dec 4, 2024

Hi, the problem arrises from the fact that the code is Bash and that notoriously difficult to count, sometimes "# vim: set filetype=bash :" is added at the end of the files and can be used at a hint.

I guess it's at least ten times more code than reported. (506 reported)

@spenserblack
Copy link
Collaborator

spenserblack commented Dec 4, 2024

Oh, I see what you mean. For example, this is a bash file, but won't be detected.

Right now, these are the hints used to detect a file's type:

  • extension (e.g. .bash)
  • shebang (e.g. #!/bin/bash)

Right now this project still uses tokei for language detection, which does not check for things like modelines.


I'm going to convert this bug report into a feature request to detect modelines

@spenserblack spenserblack added feature request upstream and removed bug Something isn't working labels Dec 4, 2024
@spenserblack spenserblack changed the title wrong number of line reported Detect file type from modelines Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants