Getting the vim angular language server working inside a NX monorepo

The angular language server in vim acts up when started inside the NX monorepo. This can easily be solved.

Getting the vim angular language server working inside a NX monorepo

When working on an Angular project inside an NX Monorepo, the angular language server has problems finding the root directory. This problem arises because the server relies on the presence of the “angular.json” file to determine the root directory. However, we can easily resolve this inconvenience by incorporating the “nx.json” file into the root directory pattern.

To address this matter effectively, we can utilize the NeoVim plugin called lsp-zero. Here’s an example of how to set it up:

local lsp = require("lsp-zero")
lsp.preset("recommended")

lsp.configure('angularls', {
  root_dir = require("lspconfig")["util"].root_pattern("angular.json", "nx.json")
})

lsp.setup()

Or if we are using LazyVim and nvim-lspconfig we can use the following configuration:

{
  "neovim/nvim-lspconfig",
  opts = {
    setup = {
      angularls = function(_, opts)
        opts.root_dir = require("lspconfig.util").root_pattern("angular.json", "nx.json")
        require("lspconfig").angularls.setup({ { server = opts } })
      end,
    },
  },
}

More Articles

Generate Commit Messages with Ollama in Neovim

Generate Commit Messages with Ollama in Neovim

Generate conventional commit messages from staged diffs using Ollama. Run it locally for privacy and offline, or use cloud models for speed.

Adding Umami analytics to the OpenClaw morning brief

Adding Umami analytics to the OpenClaw morning brief

An agent skill that fetches traffic data from Umami, and how it fits into a daily automated briefing.

Setting up Google Calendar sync for OpenClaw

Setting up Google Calendar sync for OpenClaw

How I set up read-only Google Calendar sync for my personal AI assistant running on a home server VM.

Better Clipboard Handling in Claude Code

Better Clipboard Handling in Claude Code

A plugin that makes clipboard operations in Claude Code more reliable and natural to use.

Get notified when Claude Code needs your input

Get notified when Claude Code needs your input

Stop constantly checking your terminal. Set up notifications that alert you when Claude Code is ready for your input.

Auto-format generated Code with Claude Code Hooks

Auto-format generated Code with Claude Code Hooks

How to set up a PostToolUse hook in Claude Code to automatically run prettier after every file edit or write operation.

PWA Web Share Target on Android: The Absolute URL Fix

PWA Web Share Target on Android: The Absolute URL Fix

Getting the Web Share Target API to work on Android PWAs can be frustrating. Your manifest looks correct, but the app never appears in the share sheet. Here is what finally worked.

Standard function keys on external keyboards in MacOS

Standard function keys on external keyboards in MacOS

Configure Karabiner Elements to use standard function keys on external keyboards while keeping media keys on your MacBook.

How to Clear Cloudflare Cache using a webhook

How to Clear Cloudflare Cache using a webhook

Automatically purge Cloudflare cache using webhooks and API tokens.