From 99412e1c3566928e38bd9631f12b5509866a681b Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 14 Mar 2022 15:05:57 +0800 Subject: [PATCH] 1.6.2 --- .prettierrc.yaml | 10 +++++ .travis.yml | 14 ------ .vscodeignore | 2 + CHANGELOG.md | 5 +++ README.md | 1 - app.yaml | 18 ++++++++ build.js | 8 ++++ data/logs/error.log | 59 +++++++++++++++++++++++++ data/logs/out.log | 33 ++++++++++++++ package.json | 2 +- src/base.js | 27 +----------- src/es.js | 97 ++++++++++++++++++++++++++++++++++++++++- themes/color-theme.json | 86 +++++++++++++++++++++++++----------- 13 files changed, 293 insertions(+), 69 deletions(-) create mode 100644 .prettierrc.yaml delete mode 100644 .travis.yml create mode 100644 app.yaml create mode 100644 data/logs/error.log create mode 100644 data/logs/out.log diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 0000000..c0e277f --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,10 @@ +jsxBracketSameLine: true +jsxSingleQuote: true +semi: false +singleQuote: true +printWidth: 100 +useTabs: false +tabWidth: 2 +trailingComma: none +bracketSpacing: true +arrowParens: avoid \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 038337c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: node_js - -os: - - osx - -node_js: - - node - -cache: - directories: - - "node_modules" - -notifications: - email: false \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore index c32a00a..a7a44e4 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,7 +1,9 @@ .vscode/** .vscode-test/** .gitignore +.prettierrc.yaml src src/** build.js +app.yaml vsc-extension-quickstart.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d9f259d..8d921bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 + +## [1.6.2] 2022-03-14 +- 修复js字符串模板中的着色 +- 优化import代码着色 + ## [1.6.1] 2022-02-22 - 优化列表颜色 diff --git a/README.md b/README.md index 36dd782..12d6d7f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![Version](https://vsmarketplacebadge.apphb.com/version-short/yutent.one-plain.svg)](https://marketplace.visualstudio.com/items?itemName=yutent.one-plain) [![Rating](https://vsmarketplacebadge.apphb.com/rating-short/yutent.one-plain.svg)](https://marketplace.visualstudio.com/items?itemName=yutent.one-plain) [![Installs](https://vsmarketplacebadge.apphb.com/installs/yutent.one-plain.svg)](https://marketplace.visualstudio.com/items?itemName=yutent.one-plain) -[![Build Status](https://travis-ci.org/yutent/one-plain.svg?branch=master)](https://travis-ci.org/yutent/one-plain) ## 截图预览 ![截图](./demo.jpg) diff --git a/app.yaml b/app.yaml new file mode 100644 index 0000000..5dc8ef6 --- /dev/null +++ b/app.yaml @@ -0,0 +1,18 @@ + +script: node ./build.js +cwd: ./ +watch: true +name: oss +ignore_watch: [data, themes, package.json, package-lock.json, node_modules, .git, .gitignore, app.yaml] +exec_mode: fork + +error_file: ./data/logs/error.log +out_file: ./data/logs/out.log +merge_logs: true +min_uptime: 60s +max_restarts: 1 +max_memory_restart: 300M +env: + NODE_ENV: development + + \ No newline at end of file diff --git a/build.js b/build.js index 2f92a68..070a00b 100644 --- a/build.js +++ b/build.js @@ -6,6 +6,7 @@ const fs = require('iofs') const path = require('path') +const readline = require('readline') const colors = require('./src/colors') @@ -32,4 +33,11 @@ const theme = { } fs.echo(JSON.stringify(theme, '', 2), path.join('./themes', 'color-theme.json')) + +// 这个就只是单纯的用来阻止进程结束, 方便pm2 +readline.createInterface({ + input: process.stdin, + output: process.stdout +}) + console.log('Build complete...') diff --git a/data/logs/error.log b/data/logs/error.log new file mode 100644 index 0000000..364e8f3 --- /dev/null +++ b/data/logs/error.log @@ -0,0 +1,59 @@ +/Volumes/extends/www/project/one-plain/src/es.js:105 + 'string.template.js meta.template.expression.js meta.array.literal.js meta.brace.square.js', + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +SyntaxError: Unexpected string + at wrapSafe (internal/modules/cjs/loader.js:915:16) + at Module._compile (internal/modules/cjs/loader.js:963:27) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) + at Module.load (internal/modules/cjs/loader.js:863:32) + at Function.Module._load (internal/modules/cjs/loader.js:708:14) + at Module.require (internal/modules/cjs/loader.js:887:19) + at require (internal/modules/cjs/helpers.js:74:18) + at Object. (/Volumes/extends/www/project/one-plain/build.js:14:12) + at Module._compile (internal/modules/cjs/loader.js:999:30) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) +/Volumes/extends/www/project/one-plain/src/es.js:20 + 'meta.import.ts string.quoted.double.ts' + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +SyntaxError: Unexpected string + at wrapSafe (internal/modules/cjs/loader.js:915:16) + at Module._compile (internal/modules/cjs/loader.js:963:27) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) + at Module.load (internal/modules/cjs/loader.js:863:32) + at Function.Module._load (internal/modules/cjs/loader.js:708:14) + at Module.require (internal/modules/cjs/loader.js:887:19) + at require (internal/modules/cjs/helpers.js:74:18) + at Object. (/Volumes/extends/www/project/one-plain/build.js:14:12) + at Module._compile (internal/modules/cjs/loader.js:999:30) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) +/Volumes/extends/www/project/one-plain/src/es.js:20 + 'meta.import.ts string.quoted.double.ts' + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +SyntaxError: Unexpected string + at wrapSafe (internal/modules/cjs/loader.js:915:16) + at Module._compile (internal/modules/cjs/loader.js:963:27) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) + at Module.load (internal/modules/cjs/loader.js:863:32) + at Function.Module._load (internal/modules/cjs/loader.js:708:14) + at Module.require (internal/modules/cjs/loader.js:887:19) + at require (internal/modules/cjs/helpers.js:74:18) + at Object. (/Volumes/extends/www/project/one-plain/build.js:14:12) + at Module._compile (internal/modules/cjs/loader.js:999:30) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) +readline.js:228 + input.on('data', ondata); + ^ + +TypeError: Cannot read property 'on' of undefined + at new Interface (readline.js:228:11) + at Object.createInterface (readline.js:92:10) + at Object. (/Volumes/extends/www/project/one-plain/build.js:37:10) + at Module._compile (internal/modules/cjs/loader.js:999:30) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) + at Module.load (internal/modules/cjs/loader.js:863:32) + at Function.Module._load (internal/modules/cjs/loader.js:708:14) + at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) + at internal/main/run_main_module.js:17:47 diff --git a/data/logs/out.log b/data/logs/out.log new file mode 100644 index 0000000..4e24608 --- /dev/null +++ b/data/logs/out.log @@ -0,0 +1,33 @@ +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... +Build complete... diff --git a/package.json b/package.json index c832d8c..3eaa7e2 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "one plain", "description": "🔥 米白色主题", "icon": "logo.png", - "version": "1.6.1", + "version": "1.6.2", "publisher": "yutent", "author": "Yutent [@yutent]", "engines": { diff --git a/src/base.js b/src/base.js index f340306..218d7a7 100644 --- a/src/base.js +++ b/src/base.js @@ -274,21 +274,7 @@ module.exports = [ foreground: '#e53935' } }, - { - name: 'entity.name.method.js', - scope: ['entity.name.method.js'], - settings: { - fontStyle: 'italic', - foreground: '#6182B8' - } - }, - { - name: 'meta.method.js', - scope: ['meta.class-method.js entity.name.function.js', 'variable.function.constructor'], - settings: { - foreground: '#6182B8' - } - }, + { name: 'Attributes', scope: ['entity.other.attribute-name'], @@ -330,16 +316,5 @@ module.exports = [ settings: { fontStyle: 'underline' } - }, - { - name: 'Decorators', - scope: [ - 'tag.decorator.js entity.name.tag.js', - 'tag.decorator.js punctuation.definition.tag.js' - ], - settings: { - fontStyle: 'italic', - foreground: '#6182B8' - } } ] diff --git a/src/es.js b/src/es.js index 9c1c449..a4e6b9c 100644 --- a/src/es.js +++ b/src/es.js @@ -1,6 +1,71 @@ const vars = require('./var') module.exports = [ + { + name: 'import constant', + scope: [ + 'meta.import.js variable.other.readwrite.alias.js', + 'meta.import.ts variable.other.readwrite.alias.ts' + ], + settings: { + foreground: vars.blue2 + } + }, + { + name: 'import path', + scope: [ + 'meta.import.js string.quoted.single.js', + 'meta.import.js string.quoted.double.js', + 'meta.import.ts string.quoted.single.ts', + 'meta.import.ts string.quoted.double.ts' + ], + settings: { + fontStyle: 'underline', + foreground: vars.common + } + }, + { + name: 'import path', + scope: [ + 'meta.import.js string.quoted.single.js punctuation.definition.string.begin.js', + 'meta.import.js string.quoted.double.js punctuation.definition.string.begin.js', + 'meta.import.js string.quoted.single.js punctuation.definition.string.end.js', + 'meta.import.js string.quoted.double.js punctuation.definition.string.end.js', + 'meta.import.ts string.quoted.single.ts punctuation.definition.string.begin.ts', + 'meta.import.ts string.quoted.double.ts punctuation.definition.string.begin.ts', + 'meta.import.ts string.quoted.single.ts punctuation.definition.string.end.ts', + 'meta.import.ts string.quoted.double.ts punctuation.definition.string.end.ts' + ], + settings: { + fontStyle: 'none' + } + }, + { + name: 'Decorators', + scope: [ + 'tag.decorator.js entity.name.tag.js', + 'tag.decorator.js punctuation.definition.tag.js' + ], + settings: { + fontStyle: 'italic', + foreground: '#6182B8' + } + }, + { + name: 'meta.method.js', + scope: ['meta.class-method.js entity.name.function.js', 'variable.function.constructor'], + settings: { + foreground: '#6182B8' + } + }, + { + name: 'entity.name.method.js', + scope: ['entity.name.method.js'], + settings: { + fontStyle: 'italic', + foreground: '#6182B8' + } + }, { name: 'Class extends, build-in, dom', scope: [ @@ -53,14 +118,39 @@ module.exports = [ name: 'ts string express', scope: [ 'punctuation.definition.template-expression.begin.ts', - 'punctuation.definition.template-expression.end.ts' + 'punctuation.definition.template-expression.end.ts', + 'punctuation.definition.template-expression.begin.js', + 'punctuation.definition.template-expression.end.js' ], settings: { fontStyle: '', foreground: '#ff5370' } }, - + { + name: 'Punctuation', + scope: [ + 'meta.object.member.js meta.array.literal.js meta.brace.square.js', + 'meta.object.member.js meta.arrow.js meta.brace.round.js', + 'string.template.js meta.template.expression.js meta.array.literal.js meta.brace.square.js', + 'string.template.js meta.template.expression.js meta.brace.round.js', + 'string.template.ts meta.template.expression.ts meta.array.literal.ts meta.brace.square.ts', + 'string.template.ts meta.template.expression.ts meta.brace.round.ts' + ], + settings: { + foreground: vars.common + } + }, + { + name: 'Variables', + scope: [ + 'string.template.js meta.template.expression.js support.variable.property.js', + 'string.template.ts meta.template.expression.ts support.variable.property.ts' + ], + settings: { + foreground: vars.common2 + } + }, { name: 'build-in function', scope: [ @@ -124,6 +214,9 @@ module.exports = [ scope: [ 'constant.other.object.key.js string.unquoted.label.js', 'constant.other.object.key.js string.quoted.label.js', + 'meta.object.member.js meta.object-literal.key.js string.quoted.double.js', + 'meta.object.member.js meta.object-literal.key.js string.quoted.single.js', + 'meta.object.member.js meta.object-literal.key.js constant.numeric.decimal.js', 'meta.objectliteral.js meta.object.member.js meta.object-literal.key.js' ], settings: { diff --git a/themes/color-theme.json b/themes/color-theme.json index 316057f..dadcf6f 100644 --- a/themes/color-theme.json +++ b/themes/color-theme.json @@ -389,21 +389,6 @@ "foreground": "#e53935" } }, - { - "name": "entity.name.method.js", - "scope": "entity.name.method.js", - "settings": { - "fontStyle": "italic", - "foreground": "#6182B8" - } - }, - { - "name": "meta.method.js", - "scope": "meta.class-method.js entity.name.function.js, variable.function.constructor", - "settings": { - "foreground": "#6182B8" - } - }, { "name": "Attributes", "scope": "entity.other.attribute-name", @@ -446,14 +431,6 @@ "fontStyle": "underline" } }, - { - "name": "Decorators", - "scope": "tag.decorator.js entity.name.tag.js, tag.decorator.js punctuation.definition.tag.js", - "settings": { - "fontStyle": "italic", - "foreground": "#6182B8" - } - }, { "name": "HTML Attributes", "scope": "text.html.basic entity.other.attribute-name.html, text.html.basic entity.other.attribute-name, text.xhtml.basic entity.other.attribute-name.xhtml, text.xhtml.basic entity.other.attribute-name", @@ -512,6 +489,51 @@ "foreground": "#70acf7" } }, + { + "name": "import constant", + "scope": "meta.import.js variable.other.readwrite.alias.js, meta.import.ts variable.other.readwrite.alias.ts", + "settings": { + "foreground": "#0096ff" + } + }, + { + "name": "import path", + "scope": "meta.import.js string.quoted.single.js, meta.import.js string.quoted.double.js, meta.import.ts string.quoted.single.ts, meta.import.ts string.quoted.double.ts", + "settings": { + "fontStyle": "underline", + "foreground": "#90a4ae" + } + }, + { + "name": "import path", + "scope": "meta.import.js string.quoted.single.js punctuation.definition.string.begin.js, meta.import.js string.quoted.double.js punctuation.definition.string.begin.js, meta.import.js string.quoted.single.js punctuation.definition.string.end.js, meta.import.js string.quoted.double.js punctuation.definition.string.end.js, meta.import.ts string.quoted.single.ts punctuation.definition.string.begin.ts, meta.import.ts string.quoted.double.ts punctuation.definition.string.begin.ts, meta.import.ts string.quoted.single.ts punctuation.definition.string.end.ts, meta.import.ts string.quoted.double.ts punctuation.definition.string.end.ts", + "settings": { + "fontStyle": "none" + } + }, + { + "name": "Decorators", + "scope": "tag.decorator.js entity.name.tag.js, tag.decorator.js punctuation.definition.tag.js", + "settings": { + "fontStyle": "italic", + "foreground": "#6182B8" + } + }, + { + "name": "meta.method.js", + "scope": "meta.class-method.js entity.name.function.js, variable.function.constructor", + "settings": { + "foreground": "#6182B8" + } + }, + { + "name": "entity.name.method.js", + "scope": "entity.name.method.js", + "settings": { + "fontStyle": "italic", + "foreground": "#6182B8" + } + }, { "name": "Class extends, build-in, dom", "scope": "support.type.object.console.js, support.type.object.module.js, support.type.object.dom.js, support.constant.math, support.constant.json, meta.class.extends.js variable.other.readwrite.js, meta.function-call.static.without-arguments.js variable.other.class.js, meta.function-call.static.with-arguments.js variable.other.class.js, meta.property.class.js variable.other.class.js", @@ -545,12 +567,26 @@ }, { "name": "ts string express", - "scope": "punctuation.definition.template-expression.begin.ts, punctuation.definition.template-expression.end.ts", + "scope": "punctuation.definition.template-expression.begin.ts, punctuation.definition.template-expression.end.ts, punctuation.definition.template-expression.begin.js, punctuation.definition.template-expression.end.js", "settings": { "fontStyle": "", "foreground": "#ff5370" } }, + { + "name": "Punctuation", + "scope": "meta.object.member.js meta.array.literal.js meta.brace.square.js, meta.object.member.js meta.arrow.js meta.brace.round.js, string.template.js meta.template.expression.js meta.array.literal.js meta.brace.square.js, string.template.js meta.template.expression.js meta.brace.round.js, string.template.ts meta.template.expression.ts meta.array.literal.ts meta.brace.square.ts, string.template.ts meta.template.expression.ts meta.brace.round.ts", + "settings": { + "foreground": "#90a4ae" + } + }, + { + "name": "Variables", + "scope": "string.template.js meta.template.expression.js support.variable.property.js, string.template.ts meta.template.expression.ts support.variable.property.ts", + "settings": { + "foreground": "#546e7a" + } + }, { "name": "build-in function", "scope": "source.js support.function.node.js, meta.group.braces.curly.js support.function, meta.function-call.ts support.function.ts, meta.function-call.js support.function.js, support.function.builtin.js", @@ -584,7 +620,7 @@ }, { "name": "object keys", - "scope": "constant.other.object.key.js string.unquoted.label.js, constant.other.object.key.js string.quoted.label.js, meta.objectliteral.js meta.object.member.js meta.object-literal.key.js", + "scope": "constant.other.object.key.js string.unquoted.label.js, constant.other.object.key.js string.quoted.label.js, meta.object.member.js meta.object-literal.key.js string.quoted.double.js, meta.object.member.js meta.object-literal.key.js string.quoted.single.js, meta.object.member.js meta.object-literal.key.js constant.numeric.decimal.js, meta.objectliteral.js meta.object.member.js meta.object-literal.key.js", "settings": { "fontStyle": "italic bold", "foreground": "#90a4ae"