microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.01k stars 29.2k forks source link

File extension specific settings #35350

Open esprehn opened 7 years ago

esprehn commented 7 years ago

This was discussed here: https://github.com/Microsoft/vscode/issues/1587

but instead what was implemented was language specific settings. That doesn't help us where we have the same language in files with different extensions but what to impose different settings on them.

(ex. I have a DSL like language that looks like JS, I want to make it syntax highlight as JS, but disable validation because some things aren't quit right. Having to fork the JS language bindings for that and maintain it is unfortunate.)

KieranP commented 1 year ago

I too would find this useful. Our use case is as follows: We are redesigning our web application. In one folder we have all the old legacy CSS/JS, which doesn't conform to our new coding style/formatters. In another folder, we have all our new CSS/JS, which we want formatting to run on save for. We have turned on format on save for JS/CSS, but that means that now when we edit the old CSS/JS, it tries to format that, leading to lots of changes in the diff. Would be helpful to be able to turn off format on save for a path.

"[css][scss][javascript][typescript]": {
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
},
"[app/assets/**/*]": {
   "editor.formatOnSave": false
}
shaneknysh commented 1 year ago

Given that this is 6 years old now and the only response from anyone close to being on the vs code team has been: "no one wants this" and "use an extention" I think it is probably safe to move on with the assumption it is never going to happen.

Gretchen Wieners will make "Fetch" happen faster than this will be addressed.

gmusante commented 11 months ago

👍

Keavon commented 9 months ago

Just throwing in my support for this since it hasn't had any activity in a couple months.

My use case: I use Prettier to format my regular JSON files, but I have another file type that stores a whole bunch of data in JSON format and I have "files.associations": { "*.my-file-extension": "json" } set up for syntax highlighting. There's a bug in the Prettier formatter which breaks the JSON in these files, so I want to use the "vscode.json-language-features" formatter for my custom data type. Right now it seems to be one or the other, I can't set Prettier for regular JSON and JSON Language Features for my custom file extension JSON file.

aradalvand commented 6 months ago

Almost 7 years since this issue was created and such a basic feature still hasn't been implemented. Why the hell are you not even reacting to an open issue with this many upvotes?!

Embarrassing. Absolutely shameful. You've proven yourselves to be outrageously irresponsible; congratulations.

geekley commented 6 months ago

not even reacting to an open issue with this many upvotes

I'd assume that on a repo with 5000+ open issues (probably the # 1 most issues in github), most/all devs have notifications disabled so they won't be overwhelmed with comments every second; thus I think they're only notified when specifically @ pinged.

shaneknysh commented 6 months ago

After 7 years not having notifications on is not an excuse for not addressing g this issue.

6 years ago we got a "use an extension" answer and a "won't fix" resolution. there is still not an extension that handles many of these use cases elegantly.

I messaged the vscode TikTok account and asked them to feature this issue in a video.

starball5 commented 6 months ago

Related on Stack Overflow: vscode setting for specific filename

ascpixi commented 5 months ago

Joining in to show my support! This would be great for my build system, which uses Python-based build manifests. These files have some stuff pre-imported in, so it would be great if I could disable type checking just for those files.

I'm using "python.analysis.ignore": ["**/component.build"] for now, but it leaves a lot to be desired - it doesn't even highlight the most basic syntax errors. :(

Frexuz commented 3 months ago

my use case that doesn't work, is to support chained file extensions:

  "[html.erb]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "aliariff.vscode-erb-beautify"
  },

it seems it doesn't match the saved file... (im guessing it's only matching against the file's last .erb extension?)

i only want to beautify html templates with this plugin, but not other template files that also uses the erb engine (like server provisioning config templates)

gjsjohnmurray commented 3 months ago

@Frexuz this issue is asking for a new feature that doesn't yet exist even for simple (single dot) file extensions.

CEbbinghaus commented 1 month ago

Is this going to require another "[x, y, x]": treatment where someone just implements a naive version and the team steal it and make it work properly? I think that may be the fastest way to get it into main.

Haven't comprehensively checked all messages but I feel like the general want is for a globbing syntax to allow for overriding settings based on the file. Since a glob pattern might overlap with the language [markdown] syntax we may want to consider a different style. How about something like "(glob pattern)". And all it would require is a pure glob match against the currently open file within the editor and that should do it. Anybody got other considerations for the design or does that cover most use cases?