Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pluggable word count provider to Positron #3589

Open
jmcphers opened this issue Jun 18, 2024 · 0 comments
Open

Add pluggable word count provider to Positron #3589

jmcphers opened this issue Jun 18, 2024 · 0 comments
Labels
area: ui Issues related to UI category. enhancement New feature or request
Milestone

Comments

@jmcphers
Copy link
Collaborator

jmcphers commented Jun 18, 2024

There are a few tools already to help count words in Quarto documents.

https://github.com/yunier-olivera/markdown-quarto-word-count
https://github.com/andrewheiss/quarto-wordcount

And there's a word count add-in from Microsoft that counts words in Markdown documents.

https://marketplace.visualstudio.com/items?itemName=ms-vscode.wordcount

However, these tools aren't integrated with the IDE in any meaningful way. They also show the wordcount in the global status bar, which is already overloaded and -- especially in Positron, due to the Console -- some distance from the document whose words are being enumerated.

In this way, it's a bit like spell check -- see #1485.

Word counting can be pretty difficult due to the language-specific context around what counts as a word and what doesn't. I would propose that, as part of our effort to make Positron a first-class environment for scientific authoring, we:

  • Create an API that extensions can use to supply a word count, using the typical *Provider model used to supply other language features. This would be easiest to add to the Positron LSP extensions since they are the right place to efficiently update the word count as the document mutates, without needing to do a full re-scan in most cases.
  • Possibly display the word count, if available, in the editor surface in a small status bar or similar.

Another possibility would be to add an API more generally for contributing to a small status bar that lives on the bottom of the editor.

(originally via slack: https://positpbc.slack.com/archives/C05M2EZCPGR/p1718716125891049)

(interesting project via @hadley: state machine for word counting https://github.com/robertdavidgraham/wc2)

@jmcphers jmcphers added enhancement New feature or request area: ui Issues related to UI category. labels Jun 18, 2024
@petetronic petetronic added this to the Future milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Issues related to UI category. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants