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

D.R.Y up Vim modeline expression #5365

Merged
merged 6 commits into from
May 26, 2021
Merged

D.R.Y up Vim modeline expression #5365

merged 6 commits into from
May 26, 2021

Conversation

Alhadis
Copy link
Collaborator

@Alhadis Alhadis commented May 13, 2021

Description

Fixes:#5347 by updating the Vim Help heuristic with fixes made in #5271 (which should've included heuristics.yml as well… 🤦). I've added a reminder to modeline.rb so something like this doesn't happen again.

(Template removed as it doesn't apply)

@Alhadis Alhadis requested a review from a team as a code owner May 13, 2021 21:12
@lildude
Copy link
Member

lildude commented May 14, 2021

I think we also need to add help as an alias for "Vim Help" in order to fix #5347

@Alhadis
Copy link
Collaborator Author

Alhadis commented May 15, 2021

Derp. 🤦🤦 You're right.

At least one of us is paying attention. 😅

@Alhadis
Copy link
Collaborator Author

Alhadis commented May 15, 2021

@lildude We've hit a snag:

  2) Failure:
TestBlob#test_language [/home/runner/work/linguist/linguist/test/test_blob.rb:266]:
textobj-rubyblock.vba.
Expected: "Vim script"
  Actual: "Vim Help File"

This is failing because a VimBall file (see #4412) ends with a help file modeline:

https://github.com/github/linguist/blob/19b3a9bd7d585be8d6459cfab0a51607b2aee68b/samples/Vim%20script/textobj-rubyblock.vba#L215

As the name suggests, VimBalls are the Vim equivalent of a tarball: a concatenation of several files with headers betwixt each blob of data:

https://github.com/github/linguist/blob/19b3a9bd7d585be8d6459cfab0a51607b2aee68b/samples/Vim%20script/textobj-rubyblock.vba#L62-L66

I'm not sure what to do here.

@lildude
Copy link
Member

lildude commented May 24, 2021

Oh (vim)balls!!!

I'm not sure what to do here.

Yeah, I'm not too sure either. That change is needed in order to fix #5347 (cos of the size of the file) but doing so breaks VimBall detection. I'll need to have a think about it.

@lildude
Copy link
Member

lildude commented May 26, 2021

Got it!! Vimballs are really easy to find thanks to the first few lines always containing UseVimball.

We can use this to our advantage in the modeline strategy with no extra cost.

I'll push my changes to this branch.

@lildude lildude merged commit 19f1dcd into master May 26, 2021
@lildude lildude deleted the dry branch May 26, 2021 11:43
kalkin added a commit to kalkin/file-expert that referenced this pull request Sep 19, 2021
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants