Skip to content

Update nvim-ts-context-commentstring example - #64

Merged
numToStr merged 1 commit into
numToStr:masterfrom
JoosepAlviste:patch-1
Nov 4, 2021
Merged

numToStr merged 1 commit into
numToStr:masterfrom
JoosepAlviste:patch-1

Conversation

@JoosepAlviste

Copy link
Copy Markdown
Contributor

Hey! nvim-ts-context-commentstring got a new configuration parameter for calculate_commentstring which allows configuring the location where the commentstring is calculated from. By default it is the start of the cursor's line, but we can make it smarter based on if the user is visually selecting something or is performing a motion.

This helps in this case in a Vue file for example:

                v---------v injected TypeScript
<button @click="handleClick">Hello</button>
                   ^ cursor

Performing gciw would now correctly result in the following:

<button @click="/* handleClick */">Hello</button>

Instead of:

<button @click="<!-- handleClick -->">Hello</button>

Related PR: JoosepAlviste/nvim-ts-context-commentstring#28

Also fixes this case: #10 (comment)

`nvim-ts-context-commentstring` got a new configuration parameter for `calculate_commentstring` which allows configuring the location where the `commentstring` is calculated from. By default it is the start of the cursor's line, but we can make it smarter based on if the user is visually selecting something or is performing a motion.

This helps in this case in a Vue file for example:

```vue
                            v----------v injected TypeScript
<button @click="handleClick">Hello</button>
                                  ^ cursor
```

Performing `gciw` would now correctly result in the following:

```vue
<button @click="/* handleClick */">Hello</button>
```

Instead of:

```vue
<button @click="<!-- handleClick -->">Hello</button>
```

Related PR: JoosepAlviste/nvim-ts-context-commentstring#28
@numToStr

numToStr commented Nov 4, 2021

Copy link
Copy Markdown
Owner

This is wonderful, Thanks!. And To be honest I initially thought I could add a simple version of your plugins inside my plugin. But after seeing jsx bells and whistles, Now I am not considering adding it 😆. I'll just let my plugin sing together with yours 😄.

@numToStr
numToStr merged commit 57421d3 into numToStr:master Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants