lat.md 0.10.3 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ export type SourceRef = {
9
9
  target: string;
10
10
  file: string;
11
11
  line: number;
12
+ endLine: number;
12
13
  snippet: string;
13
14
  };
14
15
  export type SectionFound = {
@@ -52,6 +52,7 @@ export async function getSection(ctx, query) {
52
52
  seen.add(targetLower);
53
53
  const symbolPart = hashIdx === -1 ? '' : ref.target.slice(hashIdx + 1);
54
54
  let line = 0;
55
+ let endLine = 0;
55
56
  let snippet = '';
56
57
  if (symbolPart) {
57
58
  const { found, symbols } = await resolveSourceSymbol(filePart, symbolPart, ctx.projectRoot);
@@ -62,6 +63,7 @@ export async function getSection(ctx, query) {
62
63
  : s.name === parts[1] && s.parent === parts[0]);
63
64
  if (sym) {
64
65
  line = sym.startLine;
66
+ endLine = sym.endLine;
65
67
  try {
66
68
  const src = await readFile(join(ctx.projectRoot, filePart), 'utf-8');
67
69
  const srcLines = src.split('\n');
@@ -79,6 +81,7 @@ export async function getSection(ctx, query) {
79
81
  target: ref.target,
80
82
  file: filePart,
81
83
  line,
84
+ endLine,
82
85
  snippet,
83
86
  });
84
87
  }
@@ -181,7 +184,9 @@ export function formatSectionOutput(ctx, result) {
181
184
  }
182
185
  for (const ref of outgoingSourceRefs) {
183
186
  const loc = ref.line
184
- ? `${s.dim(` (${ref.file}:${ref.line})`)}`
187
+ ? ref.endLine && ref.endLine !== ref.line
188
+ ? `${s.dim(` (${ref.file}:${ref.line}-${ref.endLine})`)}`
189
+ : `${s.dim(` (${ref.file}:${ref.line})`)}`
185
190
  : `${s.dim(` (${ref.file})`)}`;
186
191
  parts.push(`${s.dim('*')} [[${s.cyan(ref.target)}]]${loc}`);
187
192
  if (ref.snippet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lat.md",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "A knowledge graph for your codebase, written in markdown",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.30.2",