-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow workspace relative files.associations setting #12805
Comments
@octref for that I think you should set: {
"files.associations": {
"**/src/*.js": "typescript"
}
} Since it is totally valid to open files without having a workspace open we cannot allow workspace relative paths here. |
But things like |
That is true but just allowing workspace relative paths is causing many issues because they do not work once you have no workspace open. How would you solve that? |
How about only applying global Or if you meant adding relative path to workspace settings in general, how about allowing |
I am not sure I understand the suggestion. For one a user might not easily understand the difference between workspace and global association setting, it is too subtle. And then while we could support |
The only potential solution I see is to allow for workspace relative paths only when you configure workspace settings (as opposed to global settings). But this needs lots of guidance to the user to make this understandable. I am open for suggestions and PRs if someone wants to jump in. |
@bpasero Agree with your views on implementation. I just found this issue after trying to set a relative |
It is sad that there is no way to configure a workspace to e.g. treat only files in the root folder in a special way. I don't understand why it would be complicated to either only allow that in the workspace settings file or ignore such entries whenever there is no workspace. Why does the workspace "files.associations" configuration support global paths at all? That feels like really bad design IMHO. Example of a workspace configuration that does not do, what one would expect which is treating files in the workspace root specially: {
"files.associations": {
"/*.{yml,yaml}": "ansible",
}
} Instead I have to do this in a workspace configuration making it strictly non-portable: {
"files.associations": {
"/home/user/projects/myproject/*.{yml,yaml}": "ansible",
}
} There appears to be no clean alternative as I do not want all yaml files in that workspace to be handled by that extension and it will be tedious to add each and every subfolder to the configuration hoping that it won't also match a path segment on some user's workspace path. Please consider reopening this issue at least as this currently is a won't-fix-without-existing-workaround. |
I encountered this today. It was extra perplexing since I also have the following in my "typescript.tsdk": "./common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib" It appears that // .vscode/settings.json
{
"files.associations": {
"./common/config/rush/*.json": "jsonc" // ← this doesn't work
},
"typescript.tsdk": "./common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib" // ← this does
} |
Currently, if I have a project
test
, with a filetest/src/app.js
. I need this workspace setting to get it recognized as TypeSscript:I wish I could do
The text was updated successfully, but these errors were encountered: