MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / jumpToLineColInUri

Method jumpToLineColInUri

src/extension/commands/edit.ts:28–50  ·  view source on GitHub ↗
(uri: vs.Uri, lineNumber?: number, columnNumber?: number, inOtherEditorColumn?: boolean)

Source from the content-addressed store, hash-verified

26 }
27
28 private async jumpToLineColInUri(uri: vs.Uri, lineNumber?: number, columnNumber?: number, inOtherEditorColumn?: boolean) {
29 if (uri?.scheme !== "file")
30 return;
31
32 // When navigating while using the inspector, we don't expect this file to replace
33 // the inspector tab, so we always target a column that's showing an editor.
34 const column = inOtherEditorColumn
35 ? firstEditorColumn() || vs.ViewColumn.Beside
36 : vs.ViewColumn.Active;
37
38 const doc = await vs.workspace.openTextDocument(uri);
39 const editor = await vs.window.showTextDocument(doc, column, inOtherEditorColumn);
40 if (lineNumber) {
41 const line = doc.lineAt(lineNumber > 0 ? lineNumber - 1 : 0);
42 if (!columnNumber || columnNumber > line.range.end.character)
43 columnNumber = line.firstNonWhitespaceCharacterIndex;
44 else if (columnNumber > 0) {
45 columnNumber--;
46 }
47 const char = line.range.start.translate({ characterDelta: columnNumber });
48 showCode(editor, line.range, line.range, new vs.Range(char, char));
49 }
50 }
51
52 private async writeRecommendedSettings(options?: { showNotification?: boolean }) {
53 const topLevelConfig = vs.workspace.getConfiguration("", null);

Callers

nothing calls this directly

Calls 2

firstEditorColumnFunction · 0.90
showCodeFunction · 0.90

Tested by

no test coverage detected