Skip to content

Commit 9416176

Browse files
Fix context help identation (#62)
* fix(context-help): correct indentation alignment in context help display * fix(context-help): correct indentation alignment in context help display * Ajust identation sintax
1 parent 5b5bee8 commit 9416176

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/ccs/commands/contextHelp.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export async function resolveContextExpression(): Promise<void> {
7878

7979
type ContextExpressionInfo = {
8080
text: string;
81-
replacementEnd?: vscode.Position;
81+
replacementRange?: vscode.Range;
8282
};
8383

8484
function getContextExpressionInfo(document: vscode.TextDocument, selection: vscode.Selection): ContextExpressionInfo {
@@ -88,19 +88,16 @@ function getContextExpressionInfo(document: vscode.TextDocument, selection: vsco
8888
};
8989
}
9090

91-
const startLine = selection.start.line;
92-
const start = document.lineAt(startLine).range.start;
91+
let replacementRange = new vscode.Range(selection.start, selection.end);
9392

94-
let lastLine = selection.end.line;
9593
if (selection.end.character === 0 && selection.end.line > selection.start.line) {
96-
lastLine = selection.end.line - 1;
94+
const adjustedEnd = document.lineAt(selection.end.line - 1).range.end;
95+
replacementRange = new vscode.Range(selection.start, adjustedEnd);
9796
}
9897

99-
const end = document.lineAt(lastLine).range.end;
100-
10198
return {
102-
text: document.getText(new vscode.Range(start, end)),
103-
replacementEnd: end,
99+
text: document.getText(replacementRange),
100+
replacementRange,
104101
};
105102
}
106103

@@ -164,9 +161,7 @@ async function applyResolvedTextExpression(
164161
const fallbackLine = document.lineAt(selection.active.line);
165162
rangeToReplace = fallbackLine.range;
166163
} else {
167-
const start = document.lineAt(selection.start.line).range.start;
168-
const replacementEnd = contextInfo.replacementEnd ?? document.lineAt(selection.end.line).range.end;
169-
rangeToReplace = new vscode.Range(start, replacementEnd);
164+
rangeToReplace = contextInfo.replacementRange ?? new vscode.Range(selection.start, selection.end);
170165
}
171166

172167
await editor.edit((editBuilder) => {

0 commit comments

Comments
 (0)