fix: address review comments - use substring instead of deprecated substr, use Number() for type conversion

This commit is contained in:
Hannes Rudolph 2026-01-07 14:55:05 -07:00
parent f72ba57df8
commit b760452ee3
2 changed files with 3 additions and 3 deletions

View file

@ -22,7 +22,7 @@ export interface CodeSnippet {
* Creates a unique ID for a code snippet
*/
export function createCodeSnippetId(): string {
return `snippet-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
return `snippet-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`
}
/**

View file

@ -688,8 +688,8 @@ export class ClineProvider
const codeSnippet: CodeSnippet = {
id: createCodeSnippetId(),
filePath: params.filePath as string,
startLine: params.startLine as unknown as number,
endLine: params.endLine as unknown as number,
startLine: Number(params.startLine),
endLine: Number(params.endLine),
content: params.selectedText as string,
timestamp: Date.now(),
}