ipatalas / vscode-postfix-ts

Postfix notation for TypeScript/Javascript - extension for VS Code
MIT License
159 stars 43 forks source link

infer variable name improvements #72

Closed zardoy closed 2 years ago

zardoy commented 2 years ago

Sep-15-2022 05-01-17

zardoy commented 2 years ago

I thing I'm going to revert last commit as there is no need to display not clean variant. Though it was interesting to explore. I thing it might be useful in future to suggest multiple variants for cases like: users[0].const -> firstUser|user

ipatalas commented 2 years ago

Wow, that's super cool! I love the idea!

zardoy commented 2 years ago

Though I still didn't figure out how to fix something.messages.forof template

ipatalas commented 2 years ago

Though I still didn't figure out how to fix something.messages.forof template

What do you mean? How is it broken? image Seems to work unless you mean to infer message from that - if so then it's super easy, I'll handle that.

ipatalas commented 2 years ago

Two lines of code and one minute later: image

ipatalas commented 2 years ago

Also made another small improvement: image

zardoy commented 2 years ago

From my POV these cases are pretty common and we should support them:

for (let command of MenuRegistry.getCommands()) {
}

Shouldn't be hard since we have both extraction functions in place, try to do this soon or you can handle them

ipatalas commented 2 years ago

Correct, that's a very common case. I'm on my phone now but i already know it's another 2 lines of code so i will implement that if i have 15 minutes this weekend 😉

zardoy commented 2 years ago

Also what do you think of this pattern? Do you think its common and we can handle it?

for (let indexToPatch of indexesToPatch) {
}

index -> indexes Edit: I think it can be related to https://github.com/ipatalas/vscode-postfix-ts/pull/72#issuecomment-1249440174 (not about additional, suggestions)