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

vscode: add support for valueSelection in InputBox #12050

Conversation

jonah-iden
Copy link
Contributor

@jonah-iden jonah-iden commented Jan 9, 2023

Signed-off-by: Jonah Iden jonah.iden@typefox.io

What it does

Fixes: #12016.

it adds a new field to the InputBox with which a specific range of text from the InputBox can be slected

How to test

i build a small vscode extension for testing found here: https://github.com/jonah-iden/inputBox-ValueSelection-test
and as vsix value-selection-test-0.0.1.zip

it just opens up a input box which selects all text until the firs space character when the text is changed

Review checklist

Reminder for reviewers

@jonah-iden jonah-iden marked this pull request as draft January 9, 2023 13:33
@jonah-iden jonah-iden force-pushed the jiden/support-InputBox-valuesSelection-12016 branch from 6b63df0 to 1905e2f Compare January 9, 2023 14:01
@jonah-iden jonah-iden marked this pull request as ready for review January 9, 2023 14:01
packages/plugin-ext/src/plugin/quick-open.ts Outdated Show resolved Hide resolved
packages/plugin/src/theia.d.ts Outdated Show resolved Hide resolved
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind rebasing your changes to the latest master, just to have the theia.d.ts styling fixes out of the way.

packages/plugin/src/theia.d.ts Outdated Show resolved Hide resolved
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
@jonah-iden jonah-iden force-pushed the jiden/support-InputBox-valuesSelection-12016 branch from d7b9c35 to 8b3eced Compare January 10, 2023 15:47
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonah-iden please take a look at the linting errors due to missing semicolons: https://github.com/eclipse-theia/theia/actions/runs/3884942760/jobs/6628169768#step:6:832.

If you haven't already I'd suggest installing the dbaeumer.vscode-eslint extension which highlights eslint errors and warnings directly in the editor.

@vince-fugnitto vince-fugnitto changed the title added support for valueSeleciton in InputBox for vs code extension api vsode: add support for valueSelection in InputBox Jan 10, 2023
@vince-fugnitto vince-fugnitto added the vscode issues related to VSCode compatibility label Jan 10, 2023
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Co-authored-by: Paul Maréchal <paul.marechal@ericsson.com>
@paul-marechal
Copy link
Member

paul-marechal commented Jan 11, 2023

Despite what the typings for the getter say, I believe that valueSelection can be undefined until someone explicitly sets it somehow. I'm also confused with how the setter accepts undefined wen the getter says it's always defined??

Please make sure it's all consistent.

edit: Apparently TypeScript is happy with different types between setters and getters, so I guess this part is fine?

@jonah-iden
Copy link
Contributor Author

your totally right though. ValueSelection can be undefined until the setter is called. I think it was this way in the vs code code

packages/plugin/src/theia.d.ts Outdated Show resolved Hide resolved
packages/plugin-ext/src/plugin/quick-open.ts Outdated Show resolved Hide resolved
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
@vince-fugnitto vince-fugnitto changed the title vsode: add support for valueSelection in InputBox vscode: add support for valueSelection in InputBox Jan 11, 2023
Is done automaticly by the underlying quickInput

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

  • The API is marked as supported
  • The extension works as expected

@jonah-iden
Copy link
Contributor Author

if this PR is okay someone else would have to merge it since i don't have write access rights yet

Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InputBox#valueSelection shouldn't be undefined according to the VS Code API.

edit: Turns out vscode.d.ts allows undefined but not the web documentation...

@paul-marechal paul-marechal merged commit 72e70c1 into eclipse-theia:master Jan 13, 2023
@paul-marechal paul-marechal added this to the 1.34.0 milestone Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[vscode] Support InputBox#valueSelection
4 participants