296
return undefined;
297
}
299
>
const sourceLabel = '~/.zsh_history';
300
const home = remoteEnvironment?.userHome?.fsPath ?? env['HOME'];
301
const resolvedFile = await fetchFileContents(home, '.zsh_history', false, fileService, remoteAgentService);
302
>
if (resolvedFile === undefined) {
history.ts
303
return undefined;
304
}
305
>
const isExtendedHistory = /^:\s\d+:\d+;/.test(resolvedFile.content);
history.ts
306
const fileLines = resolvedFile.content.split(isExtendedHistory ? /\:\s\d+\:\d+;/ : /(?<!\\)\n/);
307
const result: Set<string> = new Set();
308
for (let i = 0; i < fileLines.length; i++) {
309
>
const sanitized = fileLines[i].replace(/\\\n/g, '\n').trim();
history.ts
310
>
if (sanitized.length > 0) {
311
>
result.add(sanitized);
312
>
}
313
>
}
314
>
return {
315
>
sourceLabel,
316
>
sourceResource: resolvedFile.resource,
317
>
commands: Array.from(result.values())
318
>
};
319
>
}
320
321