I managed to fix bugs of this extension and published to VSCode Marketplace
Hi there everyone,since we are unable to contact the author and I happened to write some vscode extensions before,
I managed to fix bugs of this extension and have published a patched one to VSCode marketplace .
https://marketplace.visualstudio.com/items?itemName=alpsmonaco.insertnumbersfix
This extension certaily helped my a lot for years,many thanks to @Inori
If you ever encounter any problem or want some new features,contact me:
- Repository: https://github.com/AlpsMonaco/vscode-InsertNumbers
- Email: [email protected]
This is really helpful. The modified pattern now replaces the default, but the final selection now contains 1 too many characters at each selection point.
Edit: @kezhengjie I found the fix.
In NumInserter.ts, change
newSelections.push(new vscode.Selection(
selections[i].start.line,
selections[i].start.character,
selections[i].end.line,
selections[i].end.character + str.length
));
to
newSelections.push(new vscode.Selection(
selections[i].start.line,
selections[i].start.character,
selections[i].start.line,
selections[i].start.character + str.length
));
As it is, it adds the length of the new text to the old selection rather than replacing it. I branched your repo and proved it out, but couldn't commit the branch to open a pull request. If this isn't the right way I apologize. I've never done this before (work with VSCode extensions, TypeScript or contributing to open source).
Edit 2: Realized this does not solve the issue of selections within the same line, not sure what to do about that. :(