- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.3k
 
Feat: Ability to filter comments and strings from text completer #5233
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
base: master
Are you sure you want to change the base?
Conversation
          Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 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     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
9d297d3    to
    c1cdbe0      
    Compare
  
    c1cdbe0    to
    ed90389      
    Compare
  
            
          
                src/autocomplete/text_completer.js
              
                Outdated
          
        
      | return wordScores; | ||
| } | ||
| 
               | 
          ||
| function filterStringsFromCompletions(session, pos) { | 
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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'sfalse)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.