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

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mkslanc
Copy link
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

codecov bot commented Jul 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (31bbd6a) 87.23% compared to head (dca29c1) 87.49%.
Report is 242 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.

@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
@@ -36,9 +37,32 @@ function wordDistance(doc, pos) {
return wordScores;
}

function filterStringsFromCompletions(session, pos) {
Copy link
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
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
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants