Skip to content

feat: add max_ts_server_memory initialization option#91

Merged
jpike88 merged 1 commit into
nathansbradshaw:mainfrom
ShayanAbbas1:add-max-ts-server-memory-option
Jul 24, 2026
Merged

feat: add max_ts_server_memory initialization option#91
jpike88 merged 1 commit into
nathansbradshaw:mainfrom
ShayanAbbas1:add-max-ts-server-memory-option

Conversation

@ShayanAbbas1

Copy link
Copy Markdown
Contributor

Problem

In large workspaces (e.g. Nx monorepos), the Angular language server exceeds node's default heap limit (~4 GB) while loading the project graph and crashes. Zed restarts it, it crashes again — an endless loop where template navigation and completions never work. In Zed's logs this shows up as escalating request timeouts followed by:

Get definition via angular failed: Server reset the connection
Broken pipe (os error 32)
... via angular failed: server shut down

On my Angular 19 monorepo (~10 apps, ~20 libs) the server died every ~3 minutes, 11 restarts in a day, and was effectively unusable. Other node-based servers in Zed already handle this — e.g. Zed launches eslint with --max-old-space-size=8192, and vtsls exposes maxTsServerMemory.

Change

Adds an opt-in max_ts_server_memory initialization option (in MB), passed to node as --max-old-space-size, following the same pattern as the existing angular_language_server_version / typescript_version options:

{
  "lsp": {
    "angular": {
      "initialization_options": {
        "max_ts_server_memory": 8192
      }
    }
  }
}

Left unset, behavior is unchanged.

Testing

  • cargo build and cargo fmt -- --check pass.
  • Installed as a dev extension and verified against the monorepo that exposed the problem: the server launches with --max-old-space-size=8192 and stays alive well past the point where it previously OOM-crashed; template go-to-definition works.
  • README section added documenting the option.

@jpike88

jpike88 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

your pr has conflicts, pleaes resolve them thanks

In large workspaces (e.g. Nx monorepos) the Angular language server can
exceed node's default heap limit (~4 GB) while loading the project graph,
causing it to crash and restart in a loop (request timeouts followed by
'server shut down' in Zed's logs).

Add an opt-in max_ts_server_memory initialization option (in MB), passed
to node as --max-old-space-size, following the same pattern as the
existing version options. Left unset, behavior is unchanged.
@ShayanAbbas1
ShayanAbbas1 force-pushed the add-max-ts-server-memory-option branch from 0120beb to 06ed8e7 Compare July 24, 2026 09:24
@ShayanAbbas1

Copy link
Copy Markdown
Contributor Author

@nathansbradshaw please review, i have tested it and am using the same workflow in my local dev. This would help with bigger projects.

@jpike88 jpike88 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@jpike88
jpike88 merged commit ec18847 into nathansbradshaw:main Jul 24, 2026
@jpike88

jpike88 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

@nathansbradshaw able to publiush a new version please thanks mate

@nathansbradshaw

Copy link
Copy Markdown
Owner

@jpike88 I think if you open a PR for the zed extensions, the Zed team will be able to help you get a new version pushed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants