Home > Development Tools > atom > If you configure a small program file in Atom, let the code be highlighted!

If you configure a small program file in Atom, let the code be highlighted!

青灯夜游
Release: 2022-01-21 19:24:59
forward
3519 people have browsed it

This article will introduce to you AtomHow to configure code highlighting for WeChat applet files. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

If you configure a small program file in Atom, let the code be highlighted!

The file extensions related to the mini program are .wxml, .wxss, .wxs, However, the Atom editor does not automatically recognize these types of files by default. When you open these files, you can only see anti-human black and white code.

An elegant solution is to modify the configuration of Atom so that Atom treats .wxml as .html and .wxss as .css, treat .wxs as .js. In this way, you will see colored codes when opening these types of files. [Related recommendations: "atom tutorial"]

Operation steps

##1. Open config.cson Configuration file

Press the shortcut keys

Command Shift P to invoke the command panel, enter Application: Open Your Config , click Enter key, the file config.cson

If you configure a small program file in Atom, let the code be highlighted!

will open. 2. Modifyconfig.cson Configuration file

Add

customFileTypes:
  'text.html.basic': [
    'wxml'
  ]
  'source.css': [
    'wxss'
  ]
  'source.js': [
    'wxs'
  ]
Copy after login
below core

The approximate structure of the file

"*":
  core:
    customFileTypes:
      'text.html.basic': [
        'wxml'
      ]
      'source.css': [
        'wxss'
      ]
      'source.js': [
        'wxs'
      ]
Copy after login

This There may be many other attributes in the file, because some plug-ins will automatically add configurations to this file

Configuration completed! Reopen the files with the

.wxml, .wxss, wxs suffix, and you will see the colored codes.

Principle

In fact, Atom does not recognize the

wxml file as a html file, but uses and ## Use the same syntax rules as #html files to highlight code in wxml files. text.html.basic, source.css, source.js are the corresponding grammar rule names. These names can be found in language-xxx Such Atom built-in or found in third-party Packages. For more programming-related knowledge, please visit:

Introduction to Programming

! !

The above is the detailed content of If you configure a small program file in Atom, let the code be highlighted!. For more information, please follow other related articles on the PHP Chinese website!

source:juejin.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template