vscode-language-renpy icon indicating copy to clipboard operation
vscode-language-renpy copied to clipboard

[Suggestion] Script Word Count Feature

Open pjpollina opened this issue 2 years ago • 4 comments

Was wondering if there was any interest in adding something like other VSCode word counter extensions but specifically for Ren'Py scripts, since the more general ones count keywords, character names, etc., and Ren'Py linting only counts the project total (AFAIK). I'm willing to do it, but since I'm not personally familiar with TypeScript or extension development I wanna make sure it's feasible/desired before I start investing the time into it.

pjpollina avatar Jun 09 '22 17:06 pjpollina

In the new-syntax branch I build a tokenizer that can be used to count tokens, so should be very easy to implement a word counter there.

I do wonder what would be the purpose of this and if this would be something others could benefit from.

If me or @LuqueDaniel see a good purpose, we would be more then happy to accept your suggestion. Thanks for the interest in helping us improve the plugin.

duckdoom4 avatar Jun 09 '22 18:06 duckdoom4

I tend to write out a lotta my scenes right into Ren'Py, and since I use quite a few one-off ATL animations combined with large amounts of 2-4 arg layeredimage names it's hard to get an accurate word count on a per-script basis with existing tools. I figured maybe others had this problem but maybe I just do things weird.

Edit: Example of what I mean, for one of my scenes the word count for just dialog is 695, whereas when you check the word count on the script with all the additional coding you get 2240.

pjpollina avatar Jun 09 '22 18:06 pjpollina

Ah I see, so what you're saying is you would like to know specifically, the dialog word count?

I can see a use for that, if we make a tiny status bar field like the Ln x, Col x and Spaces: x. I think that could be a nice feature. You could even make it a button to change view into other types of counts I suppose.

@LuqueDaniel What do you think?

FYI: If you do start working on this, let me know if you come across any issues using the tokenizer. Currently the tokens are placed in a one D array (sorted by start index), but I was thinking it might be better to group the tokens in a node graph. That would be a lot easier when trying to figure out what token goes where.

duckdoom4 avatar Jun 10 '22 06:06 duckdoom4

@JelleInfinity I was just typing my reply and your last comment popped up 😂 . You have said almost everything I was going to comment on.

I agree with the way to implement it, a counter in the status bar and make it a feature that can be disabled through settings (there will be users who don't want to have more labels in the status bar).

I think it could be useful. If someone wants to implement it, go ahead. But first I would like to merge the PR #76 .

LuqueDaniel avatar Jun 10 '22 07:06 LuqueDaniel