Giter VIP home page Giter VIP logo

Comments (6)

gotjoshua avatar gotjoshua commented on June 18, 2024 1

I'm also running into this, and discovered an interesting thing:

  1. we have a vscodium workspace with dprint config in the root (with no includes)
  2. if i open a file from cli or via click through from another package in the monorepo i get an absolute path - and dprint will not work (with the same cannot format 'TypeScript'-files error)
  3. if i open from the file explorer then i get a relative workspace path and dprint works just fine

from dprint-vscode.

dsherret avatar dsherret commented on June 18, 2024

It works for me in 1.75.0 insiders. Do you have a dprint configuration file in the folder? It's necessary at the moment in order to define the plugins.

from dprint-vscode.

scottbessler avatar scottbessler commented on June 18, 2024

hmm i wonder if is potentially related to multi-root workspaces?

from dprint-vscode.

dsherret avatar dsherret commented on June 18, 2024

Maybe. I have tested for that scenario in the past. Does it work when not in a multi-root workspace?

You might want to set the following option in your settings:

{
  "dprint.verbose": true
}

Then in the "Output" pane select "dprint". It should log everything it's doing.

from dprint-vscode.

scottbessler avatar scottbessler commented on June 18, 2024

Ok I think I figured it out, and it was related to my includes expecting to resolve relative to the location of the dprint.json file.

Our code-workspace file exists in a subfolder we'll call foo:

  "folders": [
    {
      "path": ".",
      "name": "foo"
    },
    {
      "path": "..",
      "name": "root"
    }
  ],

I had the dprint.json in the "foo" folder

The ts/js code is in foo/packages/**

So I had:

"includes": ["packages/**/*.{ts,tsx,js,jsx,mjs}"],

And the verbose logs show:

[VERBOSE] Reading file: /redacted/repo/foo/dprint.json
[VERBOSE] Checking path exists: /redacted/dprint/cache/plugins/dprint-plugin-prettier/0.19.0/aarch64/dprint-plugin-prettier
[VERBOSE] Reading file: /redacted/dprint/cache/plugins/dprint-plugin-typescript/0.81.1-aarch64.cached
[VERBOSE] Checking can format: /redacted/repo/foo/packages/bar/src/index.ts
[VERBOSE] Response - File not matched: /redacted/repo/foo/packages/bar/src/index.ts

which led me to try changing my includes to:

"includes": ["**/packages/**/*.{ts,tsx,js,jsx,mjs}"],

which seems to have resolved my issue.

from dprint-vscode.

dsherret avatar dsherret commented on June 18, 2024

Oh, that seems like a bug. Thanks for reporting back! I will investigate it soon.

from dprint-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.