atom how to change default syntax highlighting for

2019-06-24 06:57发布

问题:

It's all in the title.. suddenly atom no longer defaults to language-babel for .js files and I'm not sure how to get back to the previous behaviour.

update - current config.cson:

"*":
  core:
    telemetryConsent: "no"
  editor:
    fontFamily: "Operator Mono Lig"
  "exception-reporting":
    userId: "a8f4cc72-fe9c-4093-b562-fcb344219d50"
  "language-dotenv":
    dotenvFileNames: [
      ".env"
      ".env.schema"
    ]
  "linter-eslint": {}
  "linter-ui-default": {}
  "prettier-atom":
    formatOnSaveOptions:
      enabled: true
      isDisabledIfNotInPackageJson: true
    prettierOptions:
      bracketSpacing: false
      semi: false
    useEslint: true
  "tree-view":
    hideVcsIgnoredFiles: true
  welcome:
    showOnStartup: false
".languagebabel.ttlextension":
  editor:
    softWrap: true

I tried a few variations of your suggestion and clearly I messed it up because atom could no longer launch

回答1:

You can create a custom file type by adding following in your config.cson file

  core:
    customFileTypes:
      "source.js.jsx": [
        "jsx"
        "js"
      ]

This will use language-babel for all the .js and .jsx files