Skip to content

Commit

Permalink
Cleanup config options
Browse files Browse the repository at this point in the history
  • Loading branch information
captbaritone committed Aug 24, 2020
1 parent e51a79c commit 70484b3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
13 changes: 10 additions & 3 deletions 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
Expand All @@ -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.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -35,7 +35,7 @@
"configuration": {
"title": "Implicit Parentheses",
"properties": {
"Implicit Parentheses.enable": {
"Implicit Parentheses.Enable": {
"type": "boolean",
"default": true,
"description": "Show implicit parentheses"
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/constants.ts
Expand Up @@ -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";
16 changes: 14 additions & 2 deletions src/parse.ts
Expand Up @@ -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,
Expand Down

0 comments on commit 70484b3

Please sign in to comment.