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

Text autocomplete based on column neighbors #1905

Merged
merged 16 commits into from
Oct 2, 2024
Merged

Text autocomplete based on column neighbors #1905

merged 16 commits into from
Oct 2, 2024

Conversation

davidfig
Copy link
Collaborator

@davidfig davidfig commented Sep 23, 2024

  • rust search of all text neighbors into a string[]
  • when one value is found, show it as selected autocomplete in the inline editor
  • when more than one value is found, show it as a dropdown box
  • limited neighboring value list to 1,000 entries
  • make sure it doesn't conflict with validations

Copy link

qa-wolf bot commented Sep 23, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@cla-bot cla-bot bot added the cla-signed label Sep 23, 2024
Copy link

vercel bot commented Sep 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview Oct 2, 2024 11:55pm

@davidfig davidfig added prototype exploring an idea that can be played with and removed cla-signed labels Sep 23, 2024
@davidfig davidfig linked an issue Sep 23, 2024 that may be closed by this pull request
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1905 September 23, 2024 11:00 Inactive
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 98.83721% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.17%. Comparing base (722f4e6) to head (602414e).
Report is 17 commits behind head on qa.

Files with missing lines Patch % Lines
quadratic-core/src/grid/sheet/search.rs 98.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               qa    #1905      +/-   ##
==========================================
+ Coverage   91.16%   91.17%   +0.01%     
==========================================
  Files         246      246              
  Lines       54161    54247      +86     
==========================================
+ Hits        49374    49459      +85     
- Misses       4787     4788       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1905 September 25, 2024 12:31 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1905 September 25, 2024 12:40 Inactive
@davidfig davidfig added status: ready for code review and removed prototype exploring an idea that can be played with labels Sep 25, 2024
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1905 September 25, 2024 12:44 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1905 October 1, 2024 12:02 Inactive
const validations = sheets.sheet.getValidation(pos.x, pos.y);
if (validations?.length) {
const validation = validations[0];
if (validationRuleSimple(validation) === 'logical') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be converted into a switch statement?

const dropdownKeyboard = (key: 'ArrowDown' | 'ArrowUp' | 'Enter' | 'Escape' | 'Tab') => {
if (!filteredList) return;

if (key === 'ArrowDown' || key === 'ArrowUp') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another good candidate for a switch statement (might make it more readable/scanable).

const model = this.getModel();
editor.setModelLanguage(model, language);
this.setBracketConfig(language === 'Formula');
if (this.editor) {
this.editor.updateOptions({
quickSuggestions: language === 'Formula' ? true : { other: 'inline' },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you Monaco for an api that accepts an object or a boolean value 🤯

@@ -111,6 +111,7 @@ export const HtmlValidationList = (props: Props) => {
// handle keyboard events when list is open
useEffect(() => {
const dropdownKeyboard = (key: 'ArrowDown' | 'ArrowUp' | 'ArrowLeft' | 'ArrowRight' | 'Enter' | 'Escape') => {
debugger;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove?

@@ -186,6 +188,44 @@ impl Sheet {
});
results
}

/// Returns a Vec<String> of all the neighboring text in the column. Search
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great documentation 💯

}
text.push(t.clone());
y -= 1;
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may be able to remove this else block, but that might require the moving of y -= 1 outside of the conditional.

Copy link
Collaborator

@ddimaria ddimaria left a comment

Choose a reason for hiding this comment

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

Just left a couple of non-blocking comments.

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1905 October 2, 2024 23:36 Inactive
@davidfig davidfig merged commit 239b8c1 into qa Oct 2, 2024
15 of 16 checks passed
@davidfig davidfig deleted the text-autocomplete branch October 2, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete text using neighboring column values
4 participants