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.
package/dist/src/cli/section.js
CHANGED
|
@@ -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
|
-
?
|
|
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) {
|