Skip to content

Commit

Permalink
Stream chinese text in chat character-by-character
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed May 31, 2024
1 parent 6b5e725 commit 2db0241
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/chat/common/chatWordCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IWordCountResult {

export function getNWords(str: string, numWordsToCount: number): IWordCountResult {
// Match words and markdown style links
const allWordMatches = Array.from(str.matchAll(/\[([^\]]+)\]\(([^)]+)\)|[^\s\|\-]+/g));
const allWordMatches = Array.from(str.matchAll(/\[([^\]]+)\]\(([^)]+)\)|\p{sc=Han}|[^\s\|\-|\p{sc=Han}]+/gu));

const targetWords = allWordMatches.slice(0, numWordsToCount);

Expand Down

0 comments on commit 2db0241

Please sign in to comment.