Skip to content

Commit

Permalink
Add extra JSX case
Browse files Browse the repository at this point in the history
In JSX, a multi-line call expression should have the normal js
`commentstring`. For example:

```jsx
<div>
  {hello({
    foo: 'bar',
  })}
</div>
```

Commenting the line with `foo: 'bar',` shouldn't use the JSX comment
style.

There are other similar cases that might fail though, for example, a
multi-line array or string, but those are even rarer cases.

Related to #22
  • Loading branch information
JoosepAlviste committed Sep 9, 2021
1 parent 72a3f45 commit a2283cf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/ts_context_commentstring/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ M.config = {
jsx_fragment = '{/* %s */}',
jsx_attribute = '// %s',
comment = '// %s',
call_expression = '// %s',
statement_block = '// %s',
},
javascript = {
__default = '// %s',
jsx_element = '{/* %s */}',
jsx_fragment = '{/* %s */}',
jsx_attribute = '// %s',
comment = '// %s',
call_expression = '// %s',
statement_block = '// %s',
},
}

Expand Down

0 comments on commit a2283cf

Please # to comment.