atom / atom

:atom: The hackable text editor
https://atom.io
MIT License
60.15k stars 17.4k forks source link

HTML Tree-sitter not being picked #19860

Open Aerijo opened 5 years ago

Aerijo commented 5 years ago

Prerequisites

Description

When opening an HTML file with existing content, the TextMate grammar will have a higher score than the Tree-sitter grammar.

Looking at how the score is calculated, both get +4 for path match (file extension, etc.). But then, the TextMate grammar has a firstLineRegex, which matches and gives it a +0.5 boost. The Tree-sitter grammar does not have this, and only gets the +0.1 boost from being Tree-sitter. Neither gain any more points, so TextMate wins.

Steps to Reproduce

  1. Open an HTML file. E.g., https://github.com/atom/atom/blob/master/static/index.html
  2. Check the grammar being used.

Expected behavior:

Use Tree-sitter

Actual behavior:

Use TextMate

Reproduces how often:

100%

Versions

Atom    : 1.40.1
Electron: 3.1.10
Chrome  : 66.0.3359.181
Node    : 10.2.0
stale[bot] commented 4 years ago

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. Because the Atom team treats their issues as their backlog, stale issues are closed. If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of Atom
  2. Comment that the issue is still reproducible and include:
    • What version of Atom you reproduced the issue on
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue

Issues that are labeled as triaged will not be automatically marked as stale.

aminya commented 4 years ago

Unstale!