Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Spelling in code #38

Open
kuznetsss opened this issue Nov 13, 2021 · 4 comments
Open

Spelling in code #38

kuznetsss opened this issue Nov 13, 2021 · 4 comments

Comments

@kuznetsss
Copy link
Contributor

Hello! Thank you for the plugin.

Do you have any plans to add spell checks for variable names, class names and other namings which are not keywords or names from language's standard library?

Plugin could get variables (and all other words to be checked) from TreeSitter. Then it could try to split each word into separate words by rules of the most popular naming conventions (like CamelCase, shake_case etc) and check spelling of each split.

There is the same plugin written in VimL spelunker.vim but it is not maintained and I think it could work faster written in lua with TreeSitter and asynchronous tasks.

I had the same idea of the spellchecking plugin using TreeSitter. I don't have as much experience in writing nvim plugins as you but I would like to try to contribute. You may have a vision how the plugin should be developed so feel free to assign some tickets on me.

@lewis6991
Copy link
Owner

Do you have any plans to add spell checks for variable names, class names and other namings which are not keywords or names from language's standard library?

Plugin could get variables (and all other words to be checked) from TreeSitter. Then it could try to split each word into separate words by rules of the most popular naming conventions (like CamelCase, shake_case etc) and check spelling of each split.

The plugin is feature complete at this point, and I have little motivation to develop additional features outside what the built-in spellchecker already supports. However, I'm happy to review and merge PR's that add additional features like the ones you mentioned.

I had the same idea of the spellchecking plugin using TreeSitter. I don't have as much experience in writing nvim plugins as you but I would like to try to contribute. You may have a vision how the plugin should be developed so feel free to assign some tickets on me.

The plugin is pretty simple and only relies on a few important functions (nvim_set_decoration_provider, nvim_buf_set_extmark, vim.fn.spellbadword) so it shouldn't be too hard to work with.

The difficult part in my opinion is designing how such features should work and be configured. Do you have any ideas or proposals?

@kuznetsss
Copy link
Contributor Author

The difficult part in my opinion is designing how such features should work and be configured. Do you have any ideas or proposals?

I think additional spellcheck in code could have separate TreeSitter queries and it could be turned on by enabling it in config.

Also there could be an option to choose what naming styles are used in code.

Exactly what to check will not be configurable and it could be just hardcoded in language query.

So for now I'm suggesting to add to options:

code_spellcheck = false, -- enable additional code spellchecks
naming_styles = {'camel_case', 'snake_case'}  -- how to parse names to separate words

Maybe during the development I'll have to add more options.

@vydimitrov
Copy link

Hey there, thanks for the great plugin! Is there a plan to implement soon the naming_styles option as suggested above?

@lewis6991
Copy link
Owner

Sorry, there is no plan. For my personal use, this plugin is feature complete.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants