Skip to content

Feat: Ability to filter comments and strings from text completer#5233

Open
mkslanc wants to merge 5 commits intoajaxorg:masterfrom
mkslanc:text-completer-mod
Open

Feat: Ability to filter comments and strings from text completer#5233
mkslanc wants to merge 5 commits intoajaxorg:masterfrom
mkslanc:text-completer-mod

Conversation

@mkslanc
Copy link
Copy Markdown
Contributor

@mkslanc mkslanc commented Jul 3, 2023

Issue #, if available: #4100

Description of changes:
Add optional ability to filter all comments/string/doc-comments from text completer.

Option to turn it on - editor.setOption("filterStringsCompletions", true); (by default it's false)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 4, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.49%. Comparing base (31bbd6a) to head (dca29c1).
⚠️ Report is 486 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@ ## master #5233 +/- ## ========================================== + Coverage 87.23% 87.49% +0.26%  ========================================== Files 565 581 +16 Lines 45248 45933 +685 Branches 6920 6958 +38 ========================================== + Hits 39470 40189 +719  + Misses 5778 5744 -34 
Flag Coverage Δ
unittests 87.49% <100.00%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@mkslanc mkslanc force-pushed the text-completer-mod branch from 9d297d3 to c1cdbe0 Compare July 12, 2023 14:10
@mkslanc mkslanc force-pushed the text-completer-mod branch from c1cdbe0 to ed90389 Compare July 12, 2023 14:13
@mkslanc mkslanc changed the title feat: Update text completer, add token filter property Feat: Ability to filter comments and strings from text completer Jul 12, 2023
@mkslanc mkslanc marked this pull request as ready for review July 12, 2023 14:17
return wordScores;
}

function filterStringsFromCompletions(session, pos) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since this has a different behaviour to wordDistance, I think it would make sense to add a basic test that verifies getting completions works as expected with filterStringsCompletions enabled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: the name of the function does not really represent what's going on, it returns wordScores for filtered strings so maybe getWordScoresForFilteredStrings would better suit it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This name really better suits purpose of function, but could you, please, clarify, which tests you are expecting? Current test is checking scenario with and without filterStringsCompletions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We only test that with filterStringsCompletions enabled comments and doc comments are filtered out, but we don't test that completion works as expected with this option enabled and returns results in expected order (or something like that), since the logic now differs significantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants