spellsitter.nvim icon indicating copy to clipboard operation
spellsitter.nvim copied to clipboard

Spelling in code

Open kuznetsss opened this issue 3 years ago • 4 comments

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.

kuznetsss avatar Nov 13 '21 12:11 kuznetsss

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?

lewis6991 avatar Nov 14 '21 14:11 lewis6991

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.

kuznetsss avatar Nov 14 '21 20:11 kuznetsss

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

vydimitrov avatar Jul 28 '22 14:07 vydimitrov

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

lewis6991 avatar Jul 28 '22 14:07 lewis6991