Fix(command): line/block Comments Incorrectly Parsed as Slash Commands (#6957)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
This commit is contained in:
fuyou
2025-08-26 11:51:27 +08:00
committed by GitHub
parent 97ce197f38
commit 45fff8f9f7
9 changed files with 157 additions and 9 deletions

View File

@@ -102,6 +102,20 @@ describe('commandUtils', () => {
expect(isSlashCommand('path/to/file')).toBe(false);
expect(isSlashCommand(' /help')).toBe(false);
});
it('should return false for line comments starting with //', () => {
expect(isSlashCommand('// This is a comment')).toBe(false);
expect(isSlashCommand('// check if variants base info all filled.')).toBe(
false,
);
expect(isSlashCommand('//comment without space')).toBe(false);
});
it('should return false for block comments starting with /*', () => {
expect(isSlashCommand('/* This is a block comment */')).toBe(false);
expect(isSlashCommand('/*\n * Multi-line comment\n */')).toBe(false);
expect(isSlashCommand('/*comment without space*/')).toBe(false);
});
});
describe('copyToClipboard', () => {