Closed steinhh closed 1 year ago
I'm not entirely certain what you're trying to get across here. Are you saying that the extension is failing to disable comments under a scenario like:
if (myBoolean) {
doSomeFunction(); // This comment still gets suggestions despite inhibitmatcher rule
}
If so, could you try using this regular expression instead of the one you stated you're using and see if it works?
\/\/
That should match against any line where two slashes are next to one another. The expression you said you were using would only match against lines where there was a semicolon followed immediately by a singular slash.
If I misread your intent in this issue just let me know, and if I didn't but my suggested resolution doesn't work please send some examples for reproduction and I'll see if I can patch it later tonight.
Thanks
Note that you might have to play around with escaping the escape characters since the "expression" is parsed out of the JSON settings, which may result in some weird behaviour making double escaped backslashes necessary (not entirely sure, just woke up and writing this on my phone so I can't test before hitting "send").
Sorry I think I did misread your intent. Do you mean that Copilot is prompting you with a suggestion to leave a comment after a single line of code, before you've written the comment, after you've written the line of code? e.g.:
doSomeFunction(); // copilot suggests the entire comment here, you didn't start typing a comment at all
If so, that's a trickier one to fix. I might suggest using an expression that matches against a semicolon followed by whitespace to EOL, that would probably fix your issue while having minimal side effects, eg
;\s*$
Note that this would only disable suggestions after the semicolon. If your language doesn't require semicolons after each LOC you'd still get suggested completions after lines you didn't end with a semicolon.
Hmm... unfortunately it does not seem to work, when I type the line: const R = a * Math.sin(B); it will suggest " //" as a continuation (and other more complete [nonsense] comments for other lines).
I assume you meant a double escape in your regexp, so my settings.json now contains:
"disable-copilot-comment-completions.inhibitMatchers": [";\s*$", "\bcomment\b"],
(Ok, so these are not my usual variable names - they go together with a geometry drawing labelling all the stuff ;-)
Ah, sorry, I didn't realize I was referencing an (as-of-yet) unreleased feature I have been working on. In it's current state, the extension cannot / does not read the actual text content of what the user is writing to determine what action to take. Currently, the inhibitMatchers
setting is applied entirely and solely to the textmate scopes of the current caret position.
I have been working on a feature to allow the aforementioned feature, though, and I'll see if I can get that live in a release ASAP for you so you can solve this issue here. I'll tag you here in this issue once it's done.
Hello there, sorry for the long wait, I have just pushed version 2.0.0 live which includes the "unreleased feature" I had been working on (and referenced above).
After coming back to this project and finishing said feature, I realized that it might not actually be capable of solving the issue you outlined, as this Extension does not (and as far as I am aware, cannot) receive the actual suggestions Copilot comes up with to apply any filtering based on the content of the suggestion itself-- the Extension can only silence suggestions when certain rules about the content you're writing (e.g. textmate scopes, substrings in actual text content, document file names via glob pattern matching) are met.
If you are aware of any way for the Extension to hook into however VSCode displays inline suggestions and apply filtering to suggestions there, then I could implement that as well, but as far as I know I can't do that.
Regardless, the new release has a bunch of reworked logic and new ways to filter down Copilot's incessant firehose of irrelevant flow-breaking suggestions to a subset that is significantly more relevant, so if you are so inclined, give the Extension another shot and see if it does the trick for you this time around.
Cheers 🎉
Often Copilot suggests a "//" after I'm done writing a statement, i.e. "would you like to comment on this single line of code". Which is not something that should be needed - you're doing it wrong ;-). I've tried but failed to configure this extension to prevent this behavior (adding "\;" to the inhibitMatchers).
So, "stop suggesting comments at all", not just "stop suggesting completions of already-started comments"