Comments (6)
I'm also running into this, and discovered an interesting thing:
- we have a vscodium workspace with dprint config in the root (with no includes)
- 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)
- if i open from the file explorer then i get a relative workspace path and dprint works just fine
from dprint-vscode.
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.
hmm i wonder if is potentially related to multi-root workspaces?
from dprint-vscode.
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.
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.
Oh, that seems like a bug. Thanks for reporting back! I will investigate it soon.
from dprint-vscode.
Related Issues (20)
- Support "dprint" task in deno.json
- Ignore searching the target folder in rust projects
- Feature request: Add an option to configure a custom location for .dprint.json HOT 7
- don't focus outputChannel on errors HOT 2
- Format selection does not consider dprint a valid formatter
- Rename Dprint: Reset to Dprint: Restart
- Lazily initialize sub configurations HOT 1
- Bug: v0.15.1 stopped working HOT 2
- The path of "includes" should be relative from dprint.json
- Log when no configuration file found HOT 1
- dprint-ignore comments ignored by vscode plugin but honoured when running the dprint cli directly HOT 2
- dprint.experimentalLsp prevents config schema from being loaded HOT 1
- Diagnostics in the IDE HOT 3
- Error starting LSP server when folder without installed dprint is opened HOT 1
- The formatter stopped formatting files when saving HOT 1
- `dprint.json` file is ignored HOT 1
- VS Code ignores `dprint.json` and stops formatting with `dprint` version `0.16.1` on Mac HOT 4
- dprint not working in vscode v1.90? HOT 2
- don't lock the `dprint` executable when the LSP is running
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dprint-vscode.