For longer commit messages it would be great to have a spell checker there. Ideally, VSCode would provide that out of the box but if the direction is to leave spell checking up to extensions (and there are already some great ones out there, like Spell Right by @bartosz-antosik), there could be an API for that.
Possibly related: Offline spell checker for VSCode #20266
This could be interesting: https://github.com/electron-userland/electron-spellchecker
This would be a very valuable feature, there is nothing worse than creating a spelling mistake in a commit and discovering many commits later.
@joaomoreno , Working on this and using https://github.com/electron-userland/electron-spellchecker as suggested.
@joaomoreno , I tried various ways of using that module but keep getting an error("Activating extension 'vscode.git' failed: Cannot find module 'electron-spellchecker'.), can you please share any example of how to install and use an external module like electron-spellchecker?
Thanks :)
Is that module special? Does it need to run in Electron itself? Note that extensions do not run in Electron, but in an extension host.
@joaomoreno , I got the point that extensions run in extensions host, is there any way to install and use this module there ?
I also think that "electron-spellchecker" derives some information from electron (https://electron-userland.github.io/electron-spellchecker/docs/class/src/context-menu-builder.js~ContextMenuBuilder.html) as described here.
Also is there any external module used in any extension so that I can refer something from that ?
Thanks :)
I also think that "electron-spellchecker" derives some information from electron (https://electron-userland.github.io/electron-spellchecker/docs/class/src/context-menu-builder.js~ContextMenuBuilder.html) as described here.
That's a very good indication that this will not work. I suggest to pick another issue to work on. :+1:
I'll remove the help wanted
label since this is not trivial and we're not sure how to proceed here.
@joaomoreno Could you maybe provide some "on changed" callback API call with the content of the edit box which e.g. a spell checking extension (like Spell Right of mine) could service? And another "diagnostics" type to provide suggestions?
That would be awesome, I use Spell Right all the time.
@joaomoreno , There is already a validateInput function that validates the input in many ways( e.g commitMessageWhitespacesOnlyWarning in https://github.com/Microsoft/vscode/blob/master/extensions/git/src/repository.ts#L658 ) .
As @bartosz-antosik suggested, is it possible to use Spell Right in validateInput?
I can look at this approach if you suggest me to go ahead :)
Thanks.
@skprabhanjan I was about to suggest we try that. Git now exposes a rich API. We could open that API to let extensions register additional input validators.
@joaomoreno , I will try with that but I have a small doubt,
Are you suggesting me to use some Git API's that are exposed(which still needs to be researched) or something like Spell Right?
We need to expose new Git extension API: one which lets other extensions register input validators.
Though this is not the end, since you'd want the input box to render spell checking warnings/errors inline with the content, which the current widget does not support.
I keep my suggestion to pick another issue to work on. Sorry about that.
@joaomoreno , Okay I will look into how to achieve that.
I will contact you in case of any queries.
Also an example of how to expose a new API would help me go in the rite direction.
Thanks for the help:)
@joaomoreno But it seems half way though: There needs to be some way to correct spelling (underline, right click menu etc.)
Any updates?
Is there any way to open a new editor tab the way Sublime Text does and use that for the commit message?
As a workaround you can open a new file, paste/write the commit message in there and copy it back into the commit afterwords.
Even underlining a spelling error with red would do the trick for 99% of cases. Like in the browser's field - the browser underlines the errors natively; maybe it can be just enabled in VSCode's text field too?
I see in VSCode's developer tools that this commit message is currently represented as a textarea:
<textarea class="input" autocorrect="off" autocapitalize="off"
spellcheck="false" placeholder="Message (press 鈱楨nter to commit)"
title="Message (press 鈱楨nter to commit)"
style="background-color: rgb(60, 60, 60); color: rgb(204, 204, 204); height: 26px;"></textarea>
Any chances to make Git Commit Message editing to use the spellchecker?
Even editing (ammend) the commit message in the full editor does not have spellchecker enabled.
why very basic feature request spread across years?
Electron 8 includes support for the built-in Chromium spellchecker. Maybe now this feature would be easier?
I would also like to see this in the github.vscode-pull-request-github extension as well. Microsoft just improved the spell checker in Chrome recently as well.
Most helpful comment
This would be a very valuable feature, there is nothing worse than creating a spelling mistake in a commit and discovering many commits later.