atom / language-yaml

YAML package for Atom
Other
24 stars 39 forks source link

.asc PGP armor files getting highlighted as YAML #107

Open wesinator opened 5 years ago

wesinator commented 5 years ago

Prerequisites

Description

.asc ascii armor PGP key files are unexpectedly highlighted as YAML.

Steps to Reproduce

  1. Save PGP key to .asc, or open existing .asc PGP

Expected behavior: not highlighted

Actual behavior: Highlighting is set to YAML

Reproduces how often: Always

Versions

apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.34.0
python 2.7.10
git 2.17.2
Atom    : 1.34.0
Electron: 2.0.16
Chrome  : 61.0.3163.100
Node    : 8.9.3

Repro'ed on macOS and Ubuntu

rsese commented 5 years ago

Thanks for the report - though I can reproduce with 1.34.0 on macOS 10.12.6, I believe this will always be the case if a file starts with ---. E.g. if you create a file that's just:

---hello world

That will also open as a YAML file.

The workarounds are either to manually use Grammar Selector: Show to switch to plain text, or you can specifically tell Atom what to do with .asc files:

https://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition

I.e. you can add this to your config.cson file in the core section:

    customFileTypes:
      "text.plain": [
        "asc"
      ]
wesinator commented 5 years ago

Yea, that makes sense.

Personally, I'm not a big fan of autodetection this way. Philosophically I'd rather it not try to guess on the content.

rsese commented 5 years ago

:+1:

I'm assuming that this autodetection isn't something the team would change at this point but I'll double check for you before closing this out.