From 70484b3d31736fcb8f07c56e4f71c1e631bdca68 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 23 Aug 2020 21:10:37 -0700 Subject: [PATCH] Cleanup config options --- README.md | 13 ++++++++++--- package.json | 6 +++--- src/constants.ts | 4 ++-- src/parse.ts | 16 ++++++++++++++-- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8e46725..ec67459 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Show Implicit Parentheses (JavaScript) +Clarify operator precedence by showing implicit parentheses as inline decorations. + When reading complex expressions, it can be hard to understand how the subexpressions will be grouped. This extensions shows you how the sub expression are grouped by visually including the implicit parentheses as decorations. ## Command Pallet Commands @@ -12,17 +14,22 @@ When reading complex expressions, it can be hard to understand how the subexpres This extension contributes the following settings: -- `implicitparens.enabled`: enable/disable this extension +- `Implicit Parentheses.Enable`: Show implicit parentheses +- `Implicit Parentheses.Show in Menu Bar`: Show a button in the menu bar to show/hide implicit parentheses +- `Implicit Parentheses.Parser Config`: Paser configuration to use +- `Implicit Parentheses.Debounce Timeout`: Number of milliseconds that the plugin will wait after a file changes before it parses the file. ## TODO - [ ] Figure out how to configure colors -- [ ] Set default color for light mode - [ ] Ensure plugin has name +- [ ] Do we need to ignore non-js files? +- [ ] Log to output when parse fails ## Possible Future Features -- Enable/disable menu bar item in config - Allow user to configure which parens are shown - Provide automated fixes for adding parens, or even extracting expressions to variables. - Use the menu bar item to indicate if parsing has failed. +- Suggest changing parser when we get a parse error that indicates we're using the wrong parser +- Use Flow/Typescript parser when possible to get increpental parsing. diff --git a/package.json b/package.json index 1b335af..86ea04d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "configuration": { "title": "Implicit Parentheses", "properties": { - "Implicit Parentheses.enable": { + "Implicit Parentheses.Enable": { "type": "boolean", "default": true, "description": "Show implicit parentheses" @@ -45,10 +45,10 @@ "default": true, "description": "Show a button in the menu bar to show/hide implicit parentheses" }, - "Implicit Parentheses.parser": { + "Implicit Parentheses.Parser Config": { "type": "string", "default": "TypeScript", - "description": "Parser to use", + "description": "Parser configuration to use", "enum": [ "JavaScript", "TypeScript", diff --git a/src/constants.ts b/src/constants.ts index 62d7dd4..4b9d05e 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,7 +2,7 @@ export const TOGGLE_COMMAND = "implicitparens.toggleParens"; export const SHOW_COMMAND = "implicitparens.showParens"; export const HIDE_COMMAND = "implicitparens.hideParens"; -export const ENABLED_CONFIG = "Implicit Parentheses.enable"; -export const PARSER_CONFIG = "Implicit Parentheses.parser"; +export const ENABLED_CONFIG = "Implicit Parentheses.Enable"; +export const PARSER_CONFIG = "Implicit Parentheses.Parser Config"; export const DEBOUNCE_CONFIG = "Implicit Parentheses.Debounce Timeout"; export const MENU_BAR_CONFIG = "Implicit Parentheses.Show in Menu Bar"; diff --git a/src/parse.ts b/src/parse.ts index 080ffae..291807e 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -104,8 +104,20 @@ function babelOptions({ "partialApplication", ["decorators", { decoratorsBeforeExport: false }], "privateIn", - ["moduleAttributes", { version: "may-2020" }], - ["recordAndTuple", { syntaxType: "hash" }], + [ + "moduleAttributes", + { + // @ts-ignore + version: "may-2020", + }, + ], + [ + "recordAndTuple", + { + // @ts-ignore + syntaxType: "hash", + }, + ], "decimal", "jsx", ...extraPlugins,