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

SCM: Support input box spell checking #35571

Closed
borekb opened this issue Oct 4, 2017 · 57 comments
Closed

SCM: Support input box spell checking #35571

borekb opened this issue Oct 4, 2017 · 57 comments
Assignees
Labels
feature-request Request for new features or functionality on-testplan scm General SCM compound issues
Milestone

Comments

@borekb
Copy link

borekb commented Oct 4, 2017

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

UPDATE: since 2020, Electron supports spell checking natively, see below.

@vscodebot vscodebot bot added the api label Oct 4, 2017
@chrmarti chrmarti added scm General SCM compound issues and removed api labels Oct 4, 2017
@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Oct 5, 2017
@joaomoreno
Copy link
Member

This could be interesting: https://github.com/electron-userland/electron-spellchecker

@einarolafs
Copy link

einarolafs commented Apr 12, 2018

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 joaomoreno added the help wanted Issues identified as good community contribution opportunities label Sep 14, 2018
@joaomoreno joaomoreno changed the title Spell check commit messages SCM: Support input box spell checking Sep 14, 2018
@skprabhanjan
Copy link
Contributor

@joaomoreno , Working on this and using https://github.com/electron-userland/electron-spellchecker as suggested.

@skprabhanjan
Copy link
Contributor

@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 :)

@joaomoreno
Copy link
Member

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.

@skprabhanjan
Copy link
Contributor

@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 :)

@joaomoreno
Copy link
Member

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. 👍

I'll remove the help wanted label since this is not trivial and we're not sure how to proceed here.

@joaomoreno joaomoreno removed the help wanted Issues identified as good community contribution opportunities label Sep 25, 2018
@bartosz-antosik
Copy link

@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?

@borekb
Copy link
Author

borekb commented Sep 25, 2018

That would be awesome, I use Spell Right all the time.

@skprabhanjan
Copy link
Contributor

@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.

@joaomoreno
Copy link
Member

@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.

@skprabhanjan
Copy link
Contributor

skprabhanjan commented Sep 25, 2018

@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?

@joaomoreno
Copy link
Member

joaomoreno commented Sep 25, 2018

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.

@skprabhanjan
Copy link
Contributor

@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:)

@bartosz-antosik
Copy link

@joaomoreno But it seems half way though: There needs to be some way to correct spelling (underline, right click menu etc.)

@sreejith-ms
Copy link

Any updates?

@ntrepid8
Copy link

ntrepid8 commented Feb 4, 2019

Is there any way to open a new editor tab the way Sublime Text does and use that for the commit message?

@timbrown5
Copy link

As a workaround you can open a new file, paste/write the commit message in there and copy it back into the commit afterwords.

@lszomoru
Copy link
Member

lszomoru commented Jul 8, 2022

Glad to hear that things are working as expected. Most of the credit goes to @JohnnyCrazy who contributed the new flow to use the full text editor as the commit message editor. In July I will take a look to see if there is a way to expose the document of the SCM input box to extensions to enable spell checking there as well. I will keep this issue updated with my progress.

@mfulton26
Copy link

If anyone else here wants to see Markdown preview support for the new commit message using an editor feature then please upvote #154392. Thanks!

@urenajose
Copy link

urenajose commented Jul 9, 2022

In the latest Insiders release (2022-06-27), if you click on the commit button without a commit message, a full editor will open that can be used as an input for the commit message. This has the side effect that any spellchecker extensions will work in the commit message editor as well.

Next milestone, I will also look into the possibility of leveraging the built-in spellchecker or exposing the document behind the SCM Input so that spellchecker extensions can get access to the document, and provide markers for words that are mistyped.

@lszomoru, I tried to click commit button without a commit message but I get a Bad status code 500 error, is there a setting which I need to enable first?
image

image

@lszomoru
Copy link
Member

lszomoru commented Jul 9, 2022

@urenajose, you are hitting an issue that is currently being tracked as #154449

@talregev
Copy link

talregev commented Jul 9, 2022

@lszomoru, I tried to click commit button without a commit message but I get a Bad status code 500 error, is there a setting which I need to enable first?

Probably you didn't set user name and password for git.
You can check on output of vscode (when you open terminal, check the output tab (different tab))
Then you will see the error msg.

@lszomoru
Copy link
Member

After talking to the team today, as it turns out, extensions already have access to the text document that is associated with the SCM input field which enables extension authors to implement spell check for the SCM input field. The text document is in the workspace.textDocuments array, and the workspace.onDidChangeTextDocument event fires when the text document changes. The text document has the vscode scheme and scminput languageId.

Today I have submitted a pull request to the Spell Right extension, and next I will be looking at the Code Spell Checker extension and will probably reach out to the extension author either with a pull request or with the exact steps that they need to make to their extension.

As soon as diagnostic information is emitted to the text document that is associated with the SCM input field, there are some "papercuts" that I need to address in the "Problems View": 1) the file name associated with the problem should have the repository name, 2) clicking on a problem should focus the SCM input field.

@lszomoru
Copy link
Member

I have also submitted a pull request to the Code Spell Checker extension. The changes to that extension as minimal since all it has to do is remove vscode from the list of blocked schemes. As soon as that happens, spell checking for the SCM input can be enabled by tweaking the settings of the extension.

@lszomoru
Copy link
Member

lszomoru commented Jul 18, 2022

The author of the Code Spell Checker extension published an update (v2.3.1) that contains my proposed changes so you can enable spell checking in the commit input box by adding vscode to the allowed schemas, and scminput to the enabled languages:

  "cSpell.allowedSchemas": ["file", "gist", "sftp", "untitled", "vscode-notebook-cell", "vscode-userdata", "vscode"],
  "cSpell.enabledLanguageIds": ["scminput"],

@Jason3S
Copy link

Jason3S commented Jul 18, 2022

@lszomoru,

It is better to use:

  "cSpell.allowedSchemas": ["file", "gist", "sftp", "untitled", "vscode-notebook-cell", "vscode-userdata", "vscode"],
  "cSpell.enableFiletypes": ["scminput"],

image

Because of limitations in the way VS Code merges settings, lists are overwritten instead of merged. So, setting enabledLanguageIds will disable all other file types.

Jason3S added a commit to streetsidesoftware/vscode-spell-checker that referenced this issue Jul 18, 2022
Related to [SCM: Support input box spell checking · Issue #35571 · microsoft/vscode](microsoft/vscode#35571)
@Jason3S
Copy link

Jason3S commented Jul 18, 2022

@lszomoru,

I'll turn it on by default, but it does generate an error when trying to fix any issues.

image

I'll take a look if it is anything on the extension side of things.

Jason3S added a commit to streetsidesoftware/vscode-spell-checker that referenced this issue Jul 18, 2022
Related to [SCM: Support input box spell checking · Issue #35571 · microsoft/vscode](microsoft/vscode#35571)
@lszomoru
Copy link
Member

@Jason3S, I already have an issue tracking improvements that I need to make to the Problems view in order to fully support problem markers that are being generated for the SCM input text document. If you run in any other issues please add them to that issue. Thanks!

@lszomoru
Copy link
Member

Today's Insiders release (2022-070-26) contains a change so that we adopt a dedicated scheme, vscode-scm for the text document associated with the commit input. This enables extension authors to easily identify such documents. In case you are using the Code Spell Checker extension please update your user settings to:

  "cSpell.allowedSchemas": ["file", "gist", "sftp", "untitled", "vscode-notebook-cell", "vscode-userdata", "vscode-scm"],
  "cSpell.enableFiletypes": ["scminput"],

@Jason3S, with this change, you can add the vscode scheme back to the blocked list and add the vscode-scm scheme to the default list of schemes that are being processed. I have also pushed a commit so that problem markers for documents using the vscode-scm scheme will not appear in the problems view.

@Jason3S
Copy link

Jason3S commented Jul 26, 2022

@lszomoru, I'll update Code Spell Checker.

Jason3S added a commit to streetsidesoftware/vscode-spell-checker that referenced this issue Jul 26, 2022
See: [SCM: Support input box spell checking · Issue #35571 · microsoft/vscode](microsoft/vscode#35571 (comment))
Jason3S added a commit to streetsidesoftware/vscode-spell-checker that referenced this issue Jul 26, 2022
See: [SCM: Support input box spell checking · Issue #35571 · microsoft/vscode](microsoft/vscode#35571 (comment))
joshbolduc added a commit to joshbolduc/vscode-commitlint that referenced this issue Sep 5, 2022
A recent change to VS Code changed the scheme used for the SCM input
from `vscode` to `vscode-scm`. Recognize either scheme as that of the
SCM input.

See:
microsoft/vscode#35571 (comment)
joshbolduc added a commit to joshbolduc/vscode-commitlint that referenced this issue Sep 5, 2022
A recent change to VS Code changed the scheme used for the SCM input
from `vscode` to `vscode-scm`. Recognize either scheme as that of the
SCM input.

See:
microsoft/vscode#35571 (comment)
@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan scm General SCM compound issues
Projects
None yet
Development

No branches or pull requests