Skip to content
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

Langauge Specific file encoding setting #19890

Closed
Sleaker opened this issue Feb 4, 2017 · 5 comments
Closed

Langauge Specific file encoding setting #19890

Sleaker opened this issue Feb 4, 2017 · 5 comments
Assignees
Labels
config VS Code configuration, set up issues *duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality file-explorer Explorer widget issues

Comments

@Sleaker
Copy link

Sleaker commented Feb 4, 2017

  • VSCode Version: 1.9 stable release
  • OS Version: Windows 10

Ability to set default file encoding on a per-language basis.

I have files for older programming languages that I need to open with Codepage 852 or 437 but I can't set the default file encoding on a per language basis. These files are not in self-contained repositories so setting a workspace-wide setting doesn't work, and for the most part everything else is UTF. I'd like to be able to add a setting in the language configuration to open a file with specific encoding by default and override the workspace ##default.

@rmunn
Copy link
Contributor

rmunn commented Feb 4, 2017

Note that this does not appear to be a duplicate of #10444, since this issue is about being able to set the encoding on a language-specific basis in config so that files never opened before will be opened with the specified encoding.

@bpasero bpasero added feature-request Request for new features or functionality file-explorer Explorer widget issues config VS Code configuration, set up issues labels Feb 4, 2017
@Sleaker
Copy link
Author

Sleaker commented Feb 6, 2017

@rmunn - that is correct. This request is for files that have not been opened before. It would be nice if this was something that a plugin could also set the defaults for in their own settings as I have a custom plugin I made for the language I'm using. It would be doubly cool if I could set the encodings different for different file extensions within a language configuration, but that might be a bit out of scope or too difficult to manage.

@bpasero
Copy link
Member

bpasero commented Sep 11, 2017

The following syntax is now supported in settings:

{
  "[language id]": {
    "files.encoding": "any encoding"
  }
}

Note: due to the nature of this setting applying on file reading, it is not possible to assign the encoding for languages who define their kind through the first line of the text content. This only works by looking at the path of the file to determine its file association.

@Sleaker
Copy link
Author

Sleaker commented Sep 12, 2017

@bpasero - you listed the syntax for the main launguage id in the main settings, does that mean it's also able to be set in the language specific settings of a plugin that adds a new language?

@bpasero
Copy link
Member

bpasero commented Sep 13, 2017

@Sleaker yes!

"configurationDefaults": {
  "[language id]": {
    "files.encoding": "any encoding"
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
config VS Code configuration, set up issues *duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality file-explorer Explorer widget issues
Projects
None yet
Development

No branches or pull requests

3 participants