Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

feat: use npx to run cspell - #78

Closed
sjwall wants to merge 1 commit into
davidmh:mainfrom
sjwall:feat/npx
Closed

feat: use npx to run cspell#78
sjwall wants to merge 1 commit into
davidmh:mainfrom
sjwall:feat/npx

Conversation

@sjwall

@sjwall sjwall commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

I have CSpell installed per project rather than globally so the command fails as it can't find CSpell on the environment path.
CSpell requires node, node comes with npx, npx can find CSpell install on the environment path or local node_modules

@davidmh

davidmh commented Jul 30, 2025

Copy link
Copy Markdown
Owner

Hi @sjwall, have you tried defining your cspell sources with the prefer_local option?

Something like:

{
  sources = {
    cspell.diagnostics.with({ prefer_local = "node_modules/.bin" }),
    cspell.code_actions.with({ prefer_local = "node_modules/.bin" }),
  },
}

That's a feature from null-ls/none-ls, it tries finding the command in the provided directory, relative to your cwd, and it's the recommended way of working with project-specific dependencies.

@sjwall

sjwall commented Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @davidmh that works 🙌

@davidmh

davidmh commented Jul 30, 2025

Copy link
Copy Markdown
Owner

Solved through user-config

@davidmh davidmh closed this Jul 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants