atom0s
atom0s

Reputation: 495

Add Formatting To Custom File Association

I have an extension installed to add custom handling of a HTML/CSS/JS environment that has custom features for the Sciter UI library. However, this extension requires me to associate the file types I want to use the custom sciter verions of things, such as:

"files.associations": {
    "*.scs": "sciter-css",
    "*.shtm": "sciter-html",
    "*.shtml": "sciter-html"
},

While the majority of things are normal HTML, there are some special features that are added in the extensions language files.

Is there a way for me to use these custom associations but still have the ability to use the built-in / default HTML formatting when I tell VSCode to format the document? (Same for CSS, and JS.)

Upvotes: 3

Views: 1728

Answers (1)

Llewey
Llewey

Reputation: 9222

Edit:

Based on the information I'm hearing from you, you might be able to use the beautify extension with these settings in your user or workspace settings:

{
  "beautify.language": {
    "js": ["js", "json", "tiscript"]
    "css": ["css", "scss", "sciter-css"],
    "html": ["htm", "html", "sciter-html"]
    // ^^ providing just an array sets the VS Code file type
  }
}

End Edit

As a general answer, unfortunately no.

There can only be one active "language" for a document. Though there is a discussion here about allowing multiple languages.

The extension author either needs to add their features to the existing html, javascript, and CSS languages, or the developer themselves need to add the basic functionality for those languages.

Also, instead of using a language ID at all, the extension author could also provide functionality based on the file extensions directly and allow the user to provide a different set of file extensions in the settings if they need them.

Upvotes: 3

Related Questions