Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Dependencies view: `getParent` loops forever on untitled documents, extension host runs out of memory

Đang mở Phù hợp với người mới
#4,230 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@efegokdemir đang làm issue này rồi.

Từ ngày 10/10/2026.

  • #4231 của @efegokdemir — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript, vscode
Lĩnh vực
tooling

Hướng nghiên cứu

Vòng lặp nằm trong vscode/src/dependenciesTree.ts: getParent (khoảng dòng 55) đi ngược lên cho đến khi chạm gốc đường dẫn, còn activeEditorDidChange (khoảng dòng 92) reveal URI của bất kỳ editor đang active nào bất kể scheme, nên các tài liệu untitled bị duyệt mãi không dừng. Hãy bắt đầu bằng việc đọc hai hàm này và treeVisibilityDidChange, hàm này cũng reveal currentVisibleItem đã ghi nhớ. Công việc hoàn tất khi kích hoạt một editor untitled không còn gây ra reveal hay việc duyệt cha nữa, và getParent trả về undefined với đường dẫn cha không phải tuyệt đối hoặc không tiến triển.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Description
Ruby LSP Information
VS Code Version

1.141.0

Ruby LSP Extension Version

0.10.6

Ruby LSP Server Version

0.26.11

Ruby LSP Add-ons
  • Ruby LSP Rails (0.4.8)
  • RuboCop (1.86.1)
Ruby Version

3.4.7

Ruby Version Manager

mise

Installed Extensions
Click to expand
  • bruno (6.0.0)
  • claude-code (2.1.296)
  • gitlab-workflow (7.2.0)
  • ruby-extensions-pack (0.1.14)
  • ruby-lsp (0.10.6)
  • sorbet-vscode-extension (0.3.47)
  • sql-developer (26.3.0)
  • vscode-yaml (1.25.0)
Ruby LSP Settings
Click to expand
Workspace
{}
User
{
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": true,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": false,
    "codeLens": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "auto"
  },
  "customRubyCommand": "",
  "formatter": "rubocop_internal",
  "linters": [
    "rubocop_internal"
  ],
  "bundleGemfile": "",
  "testTimeout": 30,
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "sh",
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {},
  "sigOpacityLevel": "1"
}

Also: Remote – Dev Containers on linux-arm64 (Apple Silicon host), explorer.autoReveal left at its default (true). All versions above are the latest stable releases, and the same code is still on main.

Reproduction steps
  1. Start the Ruby LSP in VS Code by opening a Rails project.
  2. In the Explorer, expand the Dependencies view so its contents are visible.
  3. Create an untitled document with File → New Text File (Untitled-N).
  4. Click a saved file, then click back to the untitled tab.
  5. The extension host's memory starts climbing straight away (591 MB → 1.46 GB in about 20 seconds) until V8 aborts it with JavaScript heap out of memory. The VS Code window hangs in the meantime.

No other extensions are needed. We first hit this through Oracle SQL Developer worksheets, which are also untitled documents.

It also triggers if an untitled editor is active while the Dependencies view is hidden and you then show the view, because currentVisibleItem is remembered and revealed in treeVisibilityDidChange.

Expected: nothing happens, because an untitled document can't be part of any gem.

Code snippet or error message

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Extension Host Process exited with code: null, signal: SIGABRT.

Heap-allocation profile of the extension host while memory was growing:

-- live allocations by extension
 65.3%  (vscode core)
 34.3%  shopify.ruby-lsp
-- top allocating functions
 49.0%  (vscode core) :: r              extensionHostProcess.js:28
 34.1%  shopify.ruby-lsp :: getParent   extension.js:79
 15.5%  (vscode core) :: (anon)         extensionHostProcess.js:294
  0.3%  (vscode core) :: _resolveParent extensionHostProcess.js:294
  0.3%  (vscode core) :: joinPath       extensionHostProcess.js:28

The cause seems to be in vscode/src/dependenciesTree.ts. activeEditorDidChange (line 92) wraps any active editor's URI in a GemFilePath and reveals it, whatever its scheme. TreeView.reveal then calls getParent (line 55) until it returns undefined, and getParent only stops when parentUri.path === path.parse(parentUri.path).root:

getParent(element: BundlerTreeNode): vscode.ProviderResult<BundlerTreeNode> {
  const parentUri = vscode.Uri.joinPath(element.resourceUri, "..");
  const rootPath = path.parse(parentUri.path).root;

  if (parentUri.path === rootPath) {
    return undefined;
  }
  // ...otherwise returns a gem root or a new GemDirectoryPath(parentUri)
}

For a file: URI the walk ends at /. An untitled document's path has no leading /, so rootPath is "", and joining .. never produces "":

/workspaces/app/db/x.sql -> /workspaces/app/db -> /workspaces/app -> /workspaces -> /   (stops)
Untitled-2               -> . -> .. -> ../.. -> ../../.. -> ../../../.. -> ...         (never stops)

(The trace comes from running the same check with path.posix.join in Node. The profile above matches it.)

Possible fix: skip non-file: URIs in activeEditorDidChange, ideally only revealing URIs under one of gemRootFolders. As a safety net, getParent could return undefined when the parent path isn't absolute or equals the current path:

const uri = editor?.document.uri;
if (!uri || uri.scheme !== "file") {
  return;
}

Workaround: hide the Dependencies view, or set "explorer.autoReveal": false.

Ngôn ngữ chính
Ruby
Star
2k
Fork
283
Merge trung bình
9 giờ 18 phút
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Shopify/ruby-lsp

Tất cả issue của Shopify/ruby-lsp

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.