vim-prettier icon indicating copy to clipboard operation
vim-prettier copied to clipboard

Prettier Executable resolution doesn't consider nested node_modules

Open dan-diaz opened this issue 4 months ago • 0 comments

Doesn't work When opening nvim at my project's top-most level, where there is no direct node_modules, the plugin will not execute on index.js because it cannot find the assocaited prettier installation.

~/project_directory:$ nvim ./
~/project_directory:
  /native
    /node_modules
      /prettier
    package.json
  /web
    /node_modules
      /prettier
    index.js
    package.json

:PrettierCliPath ->> no prettier executable installation found

Works Opening the project at the subdirectory that directly contains a node_modules folder with the prettier installation, the plugin will execute successfully.

~/project_directory:$ nvim ./web
~/project_directory/web:
  /node_modules
    /prettier
  index.js
  package.json

:PrettierCliPath ->> /home/dan/project_directory/web/node_modules/.bin/prettier

Suggestion Have vim-prettier resolve the executable by first looking at the directory which contains the file and traversing up through parent directories from there, instead of starting at the root directory.

dan-diaz avatar Jul 15 '25 02:07 dan-diaz