Skip to content

Commit

Permalink
Stream chinese text in chat character-by-character (#214046)
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jun 1, 2024
1 parent e0e011c commit fca05df
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 fca05df

Please sign in to comment.