finntenzor/change-case

Principle design bug + your question

Opened this issue · 1 comments

First of all, you commented in “extension.ts”:

// I don't know why this line of code doesn't work. :(
// edit.replace(currentWordRange, newText);

I think I can answer why. VSCode reports that edit works only in its callback. Probably, it means, that it can only work in a certain stack frame. If you carry out this object outside of the scope when it is provided as an argument, it doesn't work, this is how it is designed.

Now, the principle design bug is this: /[-_$a-zA-Z0-9]+/. No, this is wrong. You limit the solution to Latin only. The notion of “case” is applicable to many writing systems, not only to Latin. This way, the entire application makes no sense. However, you may argue that this problem is limited to KebabCase. Then why would you have KebabCase limited to Latin at all?

Thank you.
—SA

Thank you for answering my question. I haven't reviewed the code in so long that I've almost forgotten how the program works. I need some time to review the problem.

As for your question about design principles, I really didn't think about the writing system. Or do you think there is any way to solve this problem? What should be a resaonable design principle?

I am very sorry that due to my personal reasons, I have not logged in github for a long time. This has led me to see this problem only recently.

Thank you.
—Finn