简体   繁体   中英

VSCode Associating a file without extension to xml

I want to associate all files without extension to xml format in VSCode.

When I do below, it makes all files (even with extensions) as xml. "files.associations": { "*": "xml" }

Any way to achieve this?

This solution does not work for the latest versions.

"files.associations": {
    "[!.]*": "xml",
},

For the latest versions, you need to add a rule for each file length.

The example shows a solution for files up to 30 characters long.

Far from the best solution, but no better solution has yet been found.

"files.associations": {
    "[!.]": "xml",
    "[!.][!.]": "xml",
    "[!.][!.][!.]": "xml",
    "[!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
    "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": "xml",
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM